Fix to reading and writing .xyz data

development
Alex Selimov 3 years ago
parent f92e80f9db
commit 4f3d88b774

@ -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

Loading…
Cancel
Save