43 |
|
|
44 |
|
module simulation |
45 |
|
use definitions |
46 |
+ |
use status |
47 |
+ |
use linearAlgebra |
48 |
|
use neighborLists |
49 |
|
use force_globals |
50 |
|
use vector_class |
91 |
|
#endif |
92 |
|
|
93 |
|
real(kind=dp), public, dimension(3,3), save :: Hmat, HmatInv |
94 |
+ |
real(kind=dp), save :: DangerRcut |
95 |
|
logical, public, save :: boxIsOrthorhombic |
96 |
|
|
97 |
|
public :: SimulationSetup |
98 |
|
public :: getNlocal |
99 |
|
public :: setBox |
100 |
+ |
public :: checkBox |
101 |
|
public :: getDielect |
102 |
|
public :: SimUsesPBC |
103 |
|
|
119 |
|
public :: SimHasAtype |
120 |
|
public :: SimUsesSC |
121 |
|
public :: SimUsesMEAM |
122 |
+ |
public :: setHmatDangerousRcutValue |
123 |
|
|
124 |
|
contains |
125 |
|
|
483 |
|
subroutine setBox(cHmat, cHmatInv, cBoxIsOrthorhombic) |
484 |
|
real(kind=dp), dimension(3,3) :: cHmat, cHmatInv |
485 |
|
integer :: cBoxIsOrthorhombic |
486 |
< |
integer :: smallest, status, i |
486 |
> |
integer :: smallest, status |
487 |
|
|
488 |
|
Hmat = cHmat |
489 |
|
HmatInv = cHmatInv |
493 |
|
boxIsOrthorhombic = .true. |
494 |
|
endif |
495 |
|
|
496 |
< |
return |
496 |
> |
call checkBox() |
497 |
> |
return |
498 |
|
end subroutine setBox |
499 |
|
|
500 |
+ |
subroutine checkBox() |
501 |
+ |
|
502 |
+ |
integer :: i |
503 |
+ |
real(kind=dp), dimension(3) :: hx, hy, hz, ax, ay, az, piped |
504 |
+ |
character(len = statusMsgSize) :: errMsg |
505 |
+ |
|
506 |
+ |
hx = Hmat(1,:) |
507 |
+ |
hy = Hmat(2,:) |
508 |
+ |
hz = Hmat(3,:) |
509 |
+ |
|
510 |
+ |
ax = cross_product(hy, hz) |
511 |
+ |
ay = cross_product(hx, hz) |
512 |
+ |
az = cross_product(hx, hy) |
513 |
+ |
|
514 |
+ |
ax = ax / length(ax) |
515 |
+ |
ay = ay / length(ay) |
516 |
+ |
az = az / length(az) |
517 |
+ |
|
518 |
+ |
piped(1) = abs(dot_product(ax, hx)) |
519 |
+ |
piped(2) = abs(dot_product(ay, hy)) |
520 |
+ |
piped(3) = abs(dot_product(az, hz)) |
521 |
+ |
|
522 |
+ |
do i = 1, 3 |
523 |
+ |
if ((0.5_dp * piped(i)).lt.DangerRcut) then |
524 |
+ |
write(errMsg, '(a94,f9.4,a1)') 'One of the dimensions of the Periodic ' & |
525 |
+ |
// 'Box is smaller than ' // newline // tab // & |
526 |
+ |
'the largest cutoff radius' // & |
527 |
+ |
' (rCut = ', DangerRcut, ')' |
528 |
+ |
call handleError("checkBox", errMsg) |
529 |
+ |
end if |
530 |
+ |
enddo |
531 |
+ |
return |
532 |
+ |
end subroutine checkBox |
533 |
+ |
|
534 |
|
function getDielect() result(dielect) |
535 |
|
real( kind = dp ) :: dielect |
536 |
|
dielect = thisSim%dielect |
734 |
|
n = nLocal |
735 |
|
end function getNlocal |
736 |
|
|
737 |
+ |
subroutine setHmatDangerousRcutValue(dangerWillRobinson) |
738 |
+ |
real(kind=dp), intent(in) :: dangerWillRobinson |
739 |
+ |
DangerRcut = dangerWillRobinson |
740 |
|
|
741 |
+ |
call checkBox() |
742 |
|
|
743 |
+ |
return |
744 |
+ |
end subroutine setHmatDangerousRcutValue |
745 |
|
|
746 |
|
|
747 |
+ |
|
748 |
|
end module simulation |