diff --git a/src/caller.f90 b/src/caller.f90 index df29501..54c520e 100644 --- a/src/caller.f90 +++ b/src/caller.f90 @@ -58,6 +58,8 @@ module caller arg_pos = arg_pos + 1 case('-wrap') arg_pos = arg_pos + 1 + case('-norefine') + arg_pos = arg_pos + 1 case('-orient') call orient_opt(arg_pos) case('-unorient') diff --git a/src/io.f90 b/src/io.f90 index 5472c00..9798c51 100644 --- a/src/io.f90 +++ b/src/io.f90 @@ -10,7 +10,7 @@ module io integer :: outfilenum = 0, infilenum = 0 character(len=100) :: outfiles(100), infiles(100), in_lattice_type='' - logical :: force_overwrite + logical :: force_overwrite, norefine real(kind=dp) :: in_lapa=0.0 public contains @@ -33,7 +33,7 @@ module io temp_outfile = filename end if - !Infinite loop which only exists if user provides valid filetype + !Infinite loop which only exits if user provides valid filetype overwrite = 'r' do while(.true.) @@ -225,7 +225,7 @@ module io subroutine write_ldump(file) !This subroutine will only work if element data is defined character(len = *), intent(in) :: file - integer :: write_num, i, iatom + integer :: write_num, i, iatom, ibasis, inod logical :: write_dat integer :: type_interp(max_basisnum*max_esize**3), interp_num real(kind=dp) :: r_interp(3, max_basisnum*max_esize**3), data_interp(10, max_basisnum*max_esize**3) @@ -246,10 +246,17 @@ module io !Calculate total atom number 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 + if(norefine)then + do i =1, ele_num + write_num = write_num + 8*basisnum(lat_ele(i)) + end do + else + + 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 + end if !Write total number of atoms write(11,2) write_num !Write box information @@ -274,33 +281,54 @@ module io end do end if - !Write refined element atomic positions - interp_num = 0 - do i = 1, ele_num - if(write_dat) then - call interpolate_atoms(type_ele(i), size_ele(i), lat_ele(i), r_node(:,:,:,i), type_interp, r_interp, & - energy_node(:,:,i), force_node(:,:,:,i), virial_node(:,:,:,i), data_interp) - else - call interpolate_atoms(type_ele(i), size_ele(i), lat_ele(i), r_node(:,:,:,i), type_interp, r_interp) - end if - select case(trim(adjustl(type_ele(i)))) - case('fcc','bcc') - if(write_dat) then - do iatom = 1, basisnum(lat_ele(i))*size_ele(i)**3 - interp_num = interp_num+1 - call apply_periodic(r_interp(:,iatom)) - write(11, '(2i16, 13f23.15)') atom_num+interp_num, type_interp(iatom), r_interp(:,iatom), & - data_interp(:,iatom) + !If we have the norefine flag then just write the nodal data points + + if(norefine) then + interp_num = 0 + do i =1, ele_num + do inod =1, ng_node(lat_ele(i)) + do ibasis=1, basisnum(lat_ele(i)) + if(write_dat) then + write(11, '(2i16, 13f23.15)') atom_num+interp_num, basis_type(ibasis,lat_ele(i)), & + r_node(:, ibasis, inod, i), energy_node(ibasis,inod,i), force_node(:, ibasis, inod, i), & + virial_node(:, ibasis, inod, i) + else + + write(11, '(2i16, 3f23.15)') atom_num+interp_num, basis_type(ibasis,lat_ele(i)), & + r_node(:, ibasis, inod, i) + end if + interp_num = interp_num +1 end do + end do + end do + else + interp_num = 0 + do i = 1, ele_num + if(write_dat) then + call interpolate_atoms(type_ele(i), size_ele(i), lat_ele(i), r_node(:,:,:,i), type_interp, r_interp, & + energy_node(:,:,i), force_node(:,:,:,i), virial_node(:,:,:,i), data_interp) else - do iatom = 1, basisnum(lat_ele(i))*size_ele(i)**3 - interp_num = interp_num+1 - call apply_periodic(r_interp(:,iatom)) - write(11, '(2i16, 3f23.15)') atom_num+interp_num, type_interp(iatom), r_interp(:,iatom) - end do + call interpolate_atoms(type_ele(i), size_ele(i), lat_ele(i), r_node(:,:,:,i), type_interp, r_interp) end if - end select - end do + select case(trim(adjustl(type_ele(i)))) + case('fcc','bcc') + if(write_dat) then + do iatom = 1, basisnum(lat_ele(i))*size_ele(i)**3 + interp_num = interp_num+1 + call apply_periodic(r_interp(:,iatom)) + write(11, '(2i16, 13f23.15)') atom_num+interp_num, type_interp(iatom), r_interp(:,iatom), & + data_interp(:,iatom) + end do + else + do iatom = 1, basisnum(lat_ele(i))*size_ele(i)**3 + interp_num = interp_num+1 + call apply_periodic(r_interp(:,iatom)) + write(11, '(2i16, 3f23.15)') atom_num+interp_num, type_interp(iatom), r_interp(:,iatom) + end do + end if + end select + end do + end if end subroutine write_ldump subroutine write_lmpcac(file) diff --git a/src/main.f90 b/src/main.f90 index e508ece..296530b 100644 --- a/src/main.f90 +++ b/src/main.f90 @@ -40,6 +40,7 @@ program main call box_init call random_seed force_overwrite=.false. + norefine=.false. wrap_flag = .false. end_mode_arg = 0 @@ -61,6 +62,9 @@ program main !This lets us know if we need to wrap atomic positions back into the cell case('-wrap') wrap_flag=.true. + + case('-norefine') + norefine=.true. case('-set_cac') call set_cac(i)