Add norefine option

development
Alex Selimov 4 years ago
parent db8428113d
commit 7a39612164

@ -58,6 +58,8 @@ module caller
arg_pos = arg_pos + 1 arg_pos = arg_pos + 1
case('-wrap') case('-wrap')
arg_pos = arg_pos + 1 arg_pos = arg_pos + 1
case('-norefine')
arg_pos = arg_pos + 1
case('-orient') case('-orient')
call orient_opt(arg_pos) call orient_opt(arg_pos)
case('-unorient') case('-unorient')

@ -10,7 +10,7 @@ module io
integer :: outfilenum = 0, infilenum = 0 integer :: outfilenum = 0, infilenum = 0
character(len=100) :: outfiles(100), infiles(100), in_lattice_type='' character(len=100) :: outfiles(100), infiles(100), in_lattice_type=''
logical :: force_overwrite logical :: force_overwrite, norefine
real(kind=dp) :: in_lapa=0.0 real(kind=dp) :: in_lapa=0.0
public public
contains contains
@ -33,7 +33,7 @@ module io
temp_outfile = filename temp_outfile = filename
end if end if
!Infinite loop which only exists if user provides valid filetype !Infinite loop which only exits if user provides valid filetype
overwrite = 'r' overwrite = 'r'
do while(.true.) do while(.true.)
@ -225,7 +225,7 @@ module io
subroutine write_ldump(file) subroutine write_ldump(file)
!This subroutine will only work if element data is defined !This subroutine will only work if element data is defined
character(len = *), intent(in) :: file character(len = *), intent(in) :: file
integer :: write_num, i, iatom integer :: write_num, i, iatom, ibasis, inod
logical :: write_dat logical :: write_dat
integer :: type_interp(max_basisnum*max_esize**3), interp_num 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) 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 !Calculate total atom number
write_num = atom_num write_num = atom_num
do i = 1,ele_num if(norefine)then
if(type_ele(i) == 'fcc') write_num = write_num + size_ele(i)**3 do i =1, ele_num
if(type_ele(i) == 'bcc') write_num = write_num + size_ele(i)**3 write_num = write_num + 8*basisnum(lat_ele(i))
end do 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 total number of atoms
write(11,2) write_num write(11,2) write_num
!Write box information !Write box information
@ -274,33 +281,54 @@ module io
end do end do
end if end if
!Write refined element atomic positions !If we have the norefine flag then just write the nodal data points
interp_num = 0
do i = 1, ele_num if(norefine) then
if(write_dat) then interp_num = 0
call interpolate_atoms(type_ele(i), size_ele(i), lat_ele(i), r_node(:,:,:,i), type_interp, r_interp, & do i =1, ele_num
energy_node(:,:,i), force_node(:,:,:,i), virial_node(:,:,:,i), data_interp) do inod =1, ng_node(lat_ele(i))
else do ibasis=1, basisnum(lat_ele(i))
call interpolate_atoms(type_ele(i), size_ele(i), lat_ele(i), r_node(:,:,:,i), type_interp, r_interp) if(write_dat) then
end if write(11, '(2i16, 13f23.15)') atom_num+interp_num, basis_type(ibasis,lat_ele(i)), &
select case(trim(adjustl(type_ele(i)))) r_node(:, ibasis, inod, i), energy_node(ibasis,inod,i), force_node(:, ibasis, inod, i), &
case('fcc','bcc') virial_node(:, ibasis, inod, i)
if(write_dat) then else
do iatom = 1, basisnum(lat_ele(i))*size_ele(i)**3
interp_num = interp_num+1 write(11, '(2i16, 3f23.15)') atom_num+interp_num, basis_type(ibasis,lat_ele(i)), &
call apply_periodic(r_interp(:,iatom)) r_node(:, ibasis, inod, i)
write(11, '(2i16, 13f23.15)') atom_num+interp_num, type_interp(iatom), r_interp(:,iatom), & end if
data_interp(:,iatom) interp_num = interp_num +1
end do 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 else
do iatom = 1, basisnum(lat_ele(i))*size_ele(i)**3 call interpolate_atoms(type_ele(i), size_ele(i), lat_ele(i), r_node(:,:,:,i), type_interp, r_interp)
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 if
end select select case(trim(adjustl(type_ele(i))))
end do 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 end subroutine write_ldump
subroutine write_lmpcac(file) subroutine write_lmpcac(file)

@ -40,6 +40,7 @@ program main
call box_init call box_init
call random_seed call random_seed
force_overwrite=.false. force_overwrite=.false.
norefine=.false.
wrap_flag = .false. wrap_flag = .false.
end_mode_arg = 0 end_mode_arg = 0
@ -62,6 +63,9 @@ program main
case('-wrap') case('-wrap')
wrap_flag=.true. wrap_flag=.true.
case('-norefine')
norefine=.true.
case('-set_cac') case('-set_cac')
call set_cac(i) call set_cac(i)
case('-set_types') case('-set_types')

Loading…
Cancel
Save