diff --git a/src/box.f90 b/src/box.f90 index c179136..9f2c7b2 100644 --- a/src/box.f90 +++ b/src/box.f90 @@ -73,10 +73,15 @@ module box integer :: i - 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 + if(all(abs(box_bd) < lim_zero)) then + box_bd = temp_box_bd + else + 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 end subroutine grow_box diff --git a/src/io.f90 b/src/io.f90 index b1bd053..95760c9 100644 --- a/src/io.f90 +++ b/src/io.f90 @@ -379,7 +379,7 @@ module io !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. 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 real(kind=dp) :: box_vec(3) @@ -426,6 +426,7 @@ module io unique_num = unique_num + 1 unique_index(unique_num) = i unique_size(unique_num) = size_ele(i) + unique_type(unique_num) = lat_ele(i) end do eleloop !Calculate the max number of atoms per element @@ -486,7 +487,7 @@ module io do i = 1, ele_num !Figure out the ele type 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 exit endif @@ -670,7 +671,7 @@ module io temp_box_bd(2*i-1) = temp_box_bd(2*i-1) + newdisplace(i) temp_box_bd(2*i) = temp_box_bd(2*i) + newdisplace(i) end do - + call grow_box(temp_box_bd) !Read in the number of sub_boxes and allocate the variables read(11, *) n diff --git a/src/mode_convert.f90 b/src/mode_convert.f90 index 3bb8a3b..eb89994 100644 --- a/src/mode_convert.f90 +++ b/src/mode_convert.f90 @@ -14,6 +14,7 @@ module mode_convert character(len=100) :: infile real(kind = dp) :: temp_box_bd(6) !First read in the file + temp_box_bd(:) = 0.0_dp call get_command_argument(2, infile) call get_in_file(infile) call read_in(1, (/0.0_dp,0.0_dp,0.0_dp/), temp_box_bd) @@ -21,4 +22,4 @@ module mode_convert arg_pos = 3 end subroutine convert -end module mode_convert \ No newline at end of file +end module mode_convert diff --git a/src/mode_merge.f90 b/src/mode_merge.f90 index afc9bba..242ecd2 100644 --- a/src/mode_merge.f90 +++ b/src/mode_merge.f90 @@ -25,6 +25,7 @@ module mode_merge shift_flag = .false. shift_vec(:) = 0.0_dp + temp_box_bd(:) = 0.0_dp !First we parse the merge command call parse_command(arg_pos) @@ -41,7 +42,6 @@ module mode_merge if ((i==1).or.(trim(adjustl(dim)) == 'none')) then call read_in(i, displace, temp_box_bd) - call grow_box(temp_box_bd) else select case(trim(adjustl(dim))) case('x') @@ -53,7 +53,6 @@ module mode_merge end select call read_in(i, displace, temp_box_bd) - call grow_box(temp_box_bd) end if if(shift_flag) call shift(new_starts, i) @@ -168,4 +167,4 @@ module mode_merge end if end subroutine shift -end module mode_merge \ No newline at end of file +end module mode_merge diff --git a/src/opt_redef_box.f90 b/src/opt_redef_box.f90 index 8d0d30f..da86342 100644 --- a/src/opt_redef_box.f90 +++ b/src/opt_redef_box.f90 @@ -20,6 +20,10 @@ module opt_redef_box !First parse the argument 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 delete_num = 0 do i = 1, atom_num @@ -68,6 +72,7 @@ module opt_redef_box 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_bc = new_bc