Added fixes to redef_box and to writing pycac restart files

This commit is contained in:
Alex Selimov 2020-11-19 13:57:57 -05:00
parent 0620a07847
commit f92e80f9db
5 changed files with 22 additions and 11 deletions

View File

@ -73,10 +73,15 @@ module box
integer :: i integer :: i
do i = 1, 3 if(all(abs(box_bd) < lim_zero)) then
if(temp_box_bd(2*i-1) < box_bd(2*i-1)) box_bd(2*i-1) = temp_box_bd(2*i-1) box_bd = temp_box_bd
if(temp_box_bd(2*i) > box_bd(2*i)) box_bd(2*i) = temp_box_bd(2*i) else
end do do i = 1, 3
if(temp_box_bd(2*i-1) < box_bd(2*i-1)) box_bd(2*i-1) = temp_box_bd(2*i-1)
if(temp_box_bd(2*i) > box_bd(2*i)) box_bd(2*i) = temp_box_bd(2*i)
end do
end if
return return
end subroutine grow_box end subroutine grow_box

View File

@ -379,7 +379,7 @@ module io
!NOTE: This code doesn't work for arbitrary number of basis atoms per node. It assumes that the !NOTE: This code doesn't work for arbitrary number of basis atoms per node. It assumes that the
!each element has only 1 atom type at the node. !each element has only 1 atom type at the node.
character(len=100), intent(in) :: file character(len=100), intent(in) :: file
integer :: interp_max, i, j, inod, ibasis, ip, unique_index(50), unique_size(50), unique_num, & integer :: interp_max, i, j, inod, ibasis, ip, unique_index(50), unique_size(50), unique_type(50), unique_num, &
etype etype
real(kind=dp) :: box_vec(3) real(kind=dp) :: box_vec(3)
@ -426,6 +426,7 @@ module io
unique_num = unique_num + 1 unique_num = unique_num + 1
unique_index(unique_num) = i unique_index(unique_num) = i
unique_size(unique_num) = size_ele(i) unique_size(unique_num) = size_ele(i)
unique_type(unique_num) = lat_ele(i)
end do eleloop end do eleloop
!Calculate the max number of atoms per element !Calculate the max number of atoms per element
@ -486,7 +487,7 @@ module io
do i = 1, ele_num do i = 1, ele_num
!Figure out the ele type !Figure out the ele type
do j = 1, unique_num do j = 1, unique_num
if ( unique_size(j) == size_ele(i)) then if ( (unique_size(j) == size_ele(i)).and.(unique_type(j) == lat_ele(i))) then
etype = j etype = j
exit exit
endif endif

View File

@ -14,6 +14,7 @@ module mode_convert
character(len=100) :: infile character(len=100) :: infile
real(kind = dp) :: temp_box_bd(6) real(kind = dp) :: temp_box_bd(6)
!First read in the file !First read in the file
temp_box_bd(:) = 0.0_dp
call get_command_argument(2, infile) call get_command_argument(2, infile)
call get_in_file(infile) call get_in_file(infile)
call read_in(1, (/0.0_dp,0.0_dp,0.0_dp/), temp_box_bd) call read_in(1, (/0.0_dp,0.0_dp,0.0_dp/), temp_box_bd)

View File

@ -25,6 +25,7 @@ module mode_merge
shift_flag = .false. shift_flag = .false.
shift_vec(:) = 0.0_dp shift_vec(:) = 0.0_dp
temp_box_bd(:) = 0.0_dp
!First we parse the merge command !First we parse the merge command
call parse_command(arg_pos) call parse_command(arg_pos)
@ -41,7 +42,6 @@ module mode_merge
if ((i==1).or.(trim(adjustl(dim)) == 'none')) then if ((i==1).or.(trim(adjustl(dim)) == 'none')) then
call read_in(i, displace, temp_box_bd) call read_in(i, displace, temp_box_bd)
call grow_box(temp_box_bd)
else else
select case(trim(adjustl(dim))) select case(trim(adjustl(dim)))
case('x') case('x')
@ -53,7 +53,6 @@ module mode_merge
end select end select
call read_in(i, displace, temp_box_bd) call read_in(i, displace, temp_box_bd)
call grow_box(temp_box_bd)
end if end if
if(shift_flag) call shift(new_starts, i) if(shift_flag) call shift(new_starts, i)

View File

@ -20,6 +20,10 @@ module opt_redef_box
!First parse the argument !First parse the argument
call parse_redef_box(arg_pos) call parse_redef_box(arg_pos)
print *, '------------------------------------------------------------'
print *, 'Option redef_box'
print *, '------------------------------------------------------------'
!Now first filter atoms that don't fit in the new box bounds and delete them !Now first filter atoms that don't fit in the new box bounds and delete them
delete_num = 0 delete_num = 0
do i = 1, atom_num do i = 1, atom_num
@ -68,6 +72,7 @@ module opt_redef_box
call delete_elements(delete_num, delete_list(1:delete_num)) call delete_elements(delete_num, delete_list(1:delete_num))
print *, "Old box_bd: ", box_bd, " is redefined to new box boundaries: ", new_bd
box_bd=new_bd box_bd=new_bd
box_bc = new_bc box_bc = new_bc