From 4f3d88b7746f62d99994da3198de6c4290e50745 Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Mon, 30 Nov 2020 11:52:38 -0500 Subject: [PATCH] Fix to reading and writing .xyz data --- src/io.f90 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/io.f90 b/src/io.f90 index 95760c9..29ac73e 100644 --- a/src/io.f90 +++ b/src/io.f90 @@ -119,7 +119,7 @@ module io !This is the simplest visualization subroutine, it writes out all nodal positions and atom positions to an xyz file character(len=100), intent(in) :: file - integer :: i, inod, ibasis + integer :: i, inod, ibasis, outn open(unit=11, file=trim(adjustl(file)), action='write', status='replace',position='rewind') @@ -128,21 +128,32 @@ module io !Write comment line write(11, '(a)') "#Node + atom file created using cacmb" + outn=0 !Write nodal positions do i = 1, ele_num do inod = 1, ng_node(lat_ele(i)) do ibasis = 1, basisnum(lat_ele(i)) write(11, '(2i16, 3f23.15)') basis_type(ibasis,lat_ele(i)), 1, r_node(:,ibasis,inod,i) + outn = outn + 1 end do end do end do + if(outn /= node_num) then + print *, "outn", outn, " doesn't equal node_num ", node_num + end if + !Write atom positions do i = 1, atom_num write(11, '(2i16, 3f23.15)') type_atom(i), 0, r_atom(:,i) + outn = outn + 1 end do + if((outn-atom_num) /= atom_num) then + print *, "outn", (outn-node_num), " doesn't equal atom_num ", atom_num + end if + !Finish writing close(11) end subroutine write_xyz @@ -1062,7 +1073,6 @@ module io end do call add_element(tag, fcc, esize+1, lat_type, sub_box_num, re) call add_element_data(ele_num, ee, fe, ve) - node_num = node_num + 8 end do end if call set_max_esize