From 3a59b23be786278c6bca02ec0de2f27a240849d0 Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Sat, 25 Apr 2020 14:42:57 -0400 Subject: [PATCH] Working bcc crystal structure when viewing in .lmp or .vtk format --- src/elements.f90 | 14 +++++++++----- src/io.f90 | 6 +++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/elements.f90 b/src/elements.f90 index 5240640..7e7f1c5 100644 --- a/src/elements.f90 +++ b/src/elements.f90 @@ -92,14 +92,15 @@ module elements 0.5_dp, -0.5_dp, 0.5_dp, & 1.0_dp, 0.0_dp, 1.0_dp, & 0.5_dp, 0.5_dp, 0.5_dp, & - 0.5_dp, 0.5_dp, -0.5_dp, & + -0.5_dp, 0.5_dp, 0.5_dp, & 0.0_dp, 0.0_dp, 1.0_dp, & - 0.5_dp, 0.5_dp, 1.5_dp /), & + 0.5_dp, 0.5_dp, 1.5_dp, & + 0.0_dp, 1.0_dp, 1.0_dp /), & shape(bcc_cell)) - bcc_mat = reshape((/ 0.5_dp, 0.5_dp, -0.5_dp, & - -0.5_dp, 0.5_dp, 0.5_dp, & - 0.5_dp, 0.5_dp, 0.5_dp /), & + bcc_mat = reshape((/ 0.5_dp, -0.5_dp, 0.5_dp, & + 0.5_dp, 0.5_dp, 0.5_dp, & + -0.5_dp, 0.5_dp, 0.5_dp /), & shape(bcc_mat)) @@ -148,6 +149,9 @@ module elements end if cell_mat(:, 1:8) = fcc_cell + adjustVar(:,1:8) cell_mat(:,1:8) = lapa * ((esize-1)*matmul(orient_mat, cell_mat(:,1:8))) + case('bcc') + cell_mat(:,1:8) = bcc_cell + cell_mat(:,1:8) = lapa* ((esize-1)*matmul(orient_mat, cell_mat(:,1:8))) case default print *, "Element type ", trim(ele_type), " currently not accepted" stop diff --git a/src/io.f90 b/src/io.f90 index f929e29..e46f941 100644 --- a/src/io.f90 +++ b/src/io.f90 @@ -162,7 +162,9 @@ module io write_num = atom_num do i = 1,ele_num if(type_ele(i) == 'fcc') write_num = write_num + size_ele(i)**3 + if(type_ele(i) == 'bcc') write_num = write_num + size_ele(i)**3 end do + !Write total number of atoms + elements write(11, '(i16, a)') write_num, ' atoms' !Write number of atom types @@ -196,7 +198,7 @@ module io do i = 1, ele_num call interpolate_atoms(type_ele(i), size_ele(i), lat_ele(i), r_node(:,:,:,i), type_interp, r_interp) select case(trim(adjustl(type_ele(i)))) - case('fcc') + case('fcc','bcc') do iatom = 1, basisnum(lat_ele(i))*size_ele(i)**3 interp_num = interp_num+1 call apply_periodic(r_interp(:,iatom)) @@ -339,6 +341,7 @@ module io end do close(11) + !Now we write the vtk file for the elements open(unit=11, file='cg_'//trim(adjustl(file)), action='write', status='replace',position='rewind') write(11,1) write(11,2) @@ -357,6 +360,7 @@ module io write(11,5) ele_num do i = 1, ele_num if(trim(adjustl(type_ele(i))) == 'fcc') write(11, '(i16)') 12 + if(trim(adjustl(type_ele(i))) == 'bcc') write(11, '(i16)') 12 end do write(11,12) ele_num write(11,20)