Square loop option

master
Alex 5 years ago
parent 20546dc267
commit e76187bd3c

@ -291,36 +291,51 @@ module opt_disl
a3 = 3 a3 = 3
end select end select
!Calculate loop perimeter if(loop_radius < 0.0_dp) then
perimeter = 2.0_dp*pi*loop_radius xLoop(:,:) = 0.d0
xLoop(1,a1) = centroid(1) - loop_radius
!Define the number of points forming the loop xLoop(1,a2) = centroid(2) - loop_radius
! The following criteria are used as a trade-off between xLoop(1,a3) = centroid(3)
! good accuracy and computational efficiency: xLoop(2,a1) = centroid(1) + loop_radius
! - each dislocation segment should have a length of 5 angströms; xLoop(2,a2) = centroid(2) - loop_radius
! - the loop should contain at least 3 points xLoop(2,a3) = centroid(3)
! (for very small loops, this will result in segments shorter than 5 A); xLoop(3,a1) = centroid(1) + loop_radius
! - there should not be more than 100 points xLoop(3,a2) = centroid(2) + loop_radius
! (for very large loops, this will result in segments longer than 5 A). xLoop(3,a3) = centroid(3)
Npoints = MAX( 3 , MIN( NINT(perimeter/5.d0) , 100 ) ) xLoop(4,a1) = centroid(1) - loop_radius
xLoop(4,a2) = centroid(2) + loop_radius
!angle between two consecutive points xLoop(4,a3) = centroid(3)
theta = 2.0_dp*pi / dble(Npoints) else
!Calculate loop perimeter
!allocate xLoop perimeter = 2.0_dp*pi*loop_radius
allocate(xLoop(Npoints,3))
xLoop(:,:) = 0.0_dp !Define the number of points forming the loop
! The following criteria are used as a trade-off between
!Calculate the position of each point in the loop ! good accuracy and computational efficiency:
angle = 0.0_dp ! - each dislocation segment should have a length of 5 angströms;
do i = 1, size(xLoop,1) ! - the loop should contain at least 3 points
xLoop(i,a1) = centroid(a1) + loop_radius*dcos(angle) ! (for very small loops, this will result in segments shorter than 5 A);
xLoop(i,a2) = centroid(a2) + loop_radius*dsin(angle) ! - there should not be more than 100 points
xLoop(i,a3) = centroid(a3) ! (for very large loops, this will result in segments longer than 5 A).
! Increment angle for next point Npoints = MAX( 3 , MIN( NINT(perimeter/5.d0) , 100 ) )
angle = angle + theta
end do !angle between two consecutive points
theta = 2.0_dp*pi / dble(Npoints)
!allocate xLoop
allocate(xLoop(Npoints,3))
xLoop(:,:) = 0.0_dp
!Calculate the position of each point in the loop
angle = 0.0_dp
do i = 1, size(xLoop,1)
xLoop(i,a1) = centroid(a1) + loop_radius*dcos(angle)
xLoop(i,a2) = centroid(a2) + loop_radius*dsin(angle)
xLoop(i,a3) = centroid(a3)
! Increment angle for next point
angle = angle + theta
end do
end if
!Now actually calculate the displacement created by a loop for every atom !Now actually calculate the displacement created by a loop for every atom
do i = 1, atom_num do i = 1, atom_num
u = 0.0_dp u = 0.0_dp

Loading…
Cancel
Save