|
|
@ -12,8 +12,8 @@ module mode_create
|
|
|
|
|
|
|
|
|
|
|
|
character(len=100) :: name, element_type
|
|
|
|
character(len=100) :: name, element_type
|
|
|
|
real(kind = dp) :: lattice_parameter, orient(3,3), cell_mat(3,8), box_len(3), basis(3,3), origin(3), maxlen(3), &
|
|
|
|
real(kind = dp) :: lattice_parameter, orient(3,3), cell_mat(3,8), box_len(3), basis(3,3), origin(3), maxlen(3), &
|
|
|
|
orient_inv(3,3), box_vert(3,8), maxbd(3), lattice_space(3)
|
|
|
|
orient_inv(3,3), box_vert(3,8), maxbd(3), lattice_space(3), duplicate(3)
|
|
|
|
integer :: esize, duplicate(3), ix, iy, iz, box_lat_vert(3,8), lat_ele_num, lat_atom_num, bd_in_lat(6), &
|
|
|
|
integer :: esize, ix, iy, iz, box_lat_vert(3,8), lat_ele_num, lat_atom_num, bd_in_lat(6), &
|
|
|
|
basis_pos(3,10)
|
|
|
|
basis_pos(3,10)
|
|
|
|
logical :: dup_flag, dim_flag
|
|
|
|
logical :: dup_flag, dim_flag
|
|
|
|
|
|
|
|
|
|
|
@ -58,16 +58,15 @@ module mode_create
|
|
|
|
|
|
|
|
|
|
|
|
allocate(r_node_temp(3,max_basisnum,max_ng_node))
|
|
|
|
allocate(r_node_temp(3,max_basisnum,max_ng_node))
|
|
|
|
|
|
|
|
|
|
|
|
if(dup_flag) then
|
|
|
|
!Get the inverse orientation matrix we will need later
|
|
|
|
|
|
|
|
call matrix_inverse(orient,3,orient_inv)
|
|
|
|
|
|
|
|
|
|
|
|
!We initialize the cell with a lattice_parameter of 1 because we will add the lattice parameter later
|
|
|
|
if(dup_flag) then
|
|
|
|
call cell_init(1.0_dp, esize, element_type, orient, cell_mat)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!Define box vertices
|
|
|
|
do i = 1, 8
|
|
|
|
do i = 1, 8
|
|
|
|
box_vert(:,i) = duplicate(:)*esize*lattice_space(:)*cubic_cell(:,i) + origin(:)
|
|
|
|
box_vert(:,i) = duplicate(:)*esize*lattice_space(:)*cubic_cell(:,i) + (origin(:)/lattice_parameter)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
call matrix_inverse(orient,3,orient_inv)
|
|
|
|
|
|
|
|
!Now get the rotated box vertex positions in lattice space. Should be integer units
|
|
|
|
!Now get the rotated box vertex positions in lattice space. Should be integer units
|
|
|
|
box_lat_vert = int(matmul(fcc_inv, matmul(orient_inv, box_vert)))+1
|
|
|
|
box_lat_vert = int(matmul(fcc_inv, matmul(orient_inv, box_vert)))+1
|
|
|
|
!Find the new maxlen
|
|
|
|
!Find the new maxlen
|
|
|
@ -76,21 +75,25 @@ module mode_create
|
|
|
|
box_bd(2*i) = maxval(box_vert(i,:)) - 0.25_dp*lattice_space(i)
|
|
|
|
box_bd(2*i) = maxval(box_vert(i,:)) - 0.25_dp*lattice_space(i)
|
|
|
|
box_bd(2*i-1) = origin(i)-0.25_dp*lattice_space(i)
|
|
|
|
box_bd(2*i-1) = origin(i)-0.25_dp*lattice_space(i)
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
!and then call the build function with the correct transformation matrix
|
|
|
|
|
|
|
|
select case(trim(adjustl(element_type)))
|
|
|
|
|
|
|
|
case('fcc')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call build_with_rhomb(box_lat_vert, fcc_mat)
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
|
|
|
print *, "Element type ", trim(adjustl(element_type)), " not accepted in mode create, please specify a supported ", &
|
|
|
|
|
|
|
|
"element type"
|
|
|
|
|
|
|
|
stop 3
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!Now that it is multiply by the lattice parameter
|
|
|
|
|
|
|
|
box_bd = box_bd*lattice_parameter
|
|
|
|
|
|
|
|
else if(dim_flag) then
|
|
|
|
else if(dim_flag) then
|
|
|
|
continue
|
|
|
|
!As a note everything is defined so that the lattice parameter is multiplied in at the end
|
|
|
|
|
|
|
|
!so we have to divide all the real Angstroms units by the lattice parameter
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!Define box_vertices
|
|
|
|
|
|
|
|
do i = 1, 8
|
|
|
|
|
|
|
|
box_vert(:,i) = (cubic_cell(:,i)*box_len(:) + origin(:))/lattice_parameter
|
|
|
|
|
|
|
|
end do
|
|
|
|
|
|
|
|
!Now get the rotated box vertex positions in lattice space. Should be integer units
|
|
|
|
|
|
|
|
box_lat_vert = int(matmul(fcc_inv, matmul(orient_inv, box_vert)))+1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!Now get the box_bd in lattice units
|
|
|
|
|
|
|
|
do i = 1, 3
|
|
|
|
|
|
|
|
box_bd(2*i) = (box_len(i)+origin(i))/lattice_parameter
|
|
|
|
|
|
|
|
box_bd(2*i-1) = origin(i)/lattice_parameter
|
|
|
|
|
|
|
|
end do
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
|
|
call cell_init(lattice_parameter, esize, element_type, orient, cell_mat)
|
|
|
|
call cell_init(lattice_parameter, esize, element_type, orient, cell_mat)
|
|
|
@ -112,6 +115,19 @@ module mode_create
|
|
|
|
|
|
|
|
|
|
|
|
!If we passed the dup_flag or dim_flag then we have to convert the lattice points and add them to the atom/element arrays
|
|
|
|
!If we passed the dup_flag or dim_flag then we have to convert the lattice points and add them to the atom/element arrays
|
|
|
|
if(dup_flag.or.dim_flag) then
|
|
|
|
if(dup_flag.or.dim_flag) then
|
|
|
|
|
|
|
|
!Call the build function with the correct transformation matrix
|
|
|
|
|
|
|
|
select case(trim(adjustl(element_type)))
|
|
|
|
|
|
|
|
case('fcc')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
call build_with_rhomb(box_lat_vert, fcc_mat)
|
|
|
|
|
|
|
|
case default
|
|
|
|
|
|
|
|
print *, "Element type ", trim(adjustl(element_type)), " not accepted in mode create, please specify a supported ", &
|
|
|
|
|
|
|
|
"element type"
|
|
|
|
|
|
|
|
stop 3
|
|
|
|
|
|
|
|
end select
|
|
|
|
|
|
|
|
!Now that it is built multiply by the lattice parameter
|
|
|
|
|
|
|
|
box_bd = box_bd*lattice_parameter
|
|
|
|
|
|
|
|
|
|
|
|
!Allocate variables
|
|
|
|
!Allocate variables
|
|
|
|
call alloc_ele_arrays(lat_ele_num, lat_atom_num*basisnum(1))
|
|
|
|
call alloc_ele_arrays(lat_ele_num, lat_atom_num*basisnum(1))
|
|
|
|
if(lat_atom_num > 0) then
|
|
|
|
if(lat_atom_num > 0) then
|
|
|
@ -208,13 +224,21 @@ module mode_create
|
|
|
|
|
|
|
|
|
|
|
|
!If the duplicate command is passed then we extract the information on the new bounds.
|
|
|
|
!If the duplicate command is passed then we extract the information on the new bounds.
|
|
|
|
case('duplicate')
|
|
|
|
case('duplicate')
|
|
|
|
|
|
|
|
if(dim_flag) STOP "Both duplicate and dim options cannot be used in mode_create"
|
|
|
|
dup_flag = .true.
|
|
|
|
dup_flag = .true.
|
|
|
|
do i = 1, 3
|
|
|
|
do i = 1, 3
|
|
|
|
call get_command_argument(arg_pos, textholder)
|
|
|
|
call get_command_argument(arg_pos, textholder)
|
|
|
|
read(textholder, *) duplicate(i)
|
|
|
|
read(textholder, *) duplicate(i)
|
|
|
|
arg_pos = arg_pos + 1
|
|
|
|
arg_pos = arg_pos + 1
|
|
|
|
end do
|
|
|
|
end do
|
|
|
|
|
|
|
|
case('dim')
|
|
|
|
|
|
|
|
if(dup_flag) STOP "Both duplicate and dim options cannot be used in mode_create"
|
|
|
|
|
|
|
|
dim_flag = .true.
|
|
|
|
|
|
|
|
do i = 1, 3
|
|
|
|
|
|
|
|
call get_command_argument(arg_pos, textholder)
|
|
|
|
|
|
|
|
read(textholder, *) box_len(i)
|
|
|
|
|
|
|
|
arg_pos = arg_pos + 1
|
|
|
|
|
|
|
|
end do
|
|
|
|
case('origin')
|
|
|
|
case('origin')
|
|
|
|
do i = 1, 3
|
|
|
|
do i = 1, 3
|
|
|
|
call get_command_argument(arg_pos, textholder)
|
|
|
|
call get_command_argument(arg_pos, textholder)
|
|
|
|