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 |
|
|
113 |
|
public :: SimUsesShapes |
114 |
|
public :: SimUsesFLARB |
115 |
|
public :: SimUsesRF |
116 |
+ |
public :: SimUsesSF |
117 |
|
public :: SimRequiresPrepairCalc |
118 |
|
public :: SimRequiresPostpairCalc |
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 |
588 |
|
doesit = thisSim%SIM_uses_EAM |
589 |
|
end function SimUsesEAM |
590 |
|
|
591 |
+ |
|
592 |
+ |
function SimUsesSC() result(doesit) |
593 |
+ |
logical :: doesit |
594 |
+ |
doesit = thisSim%SIM_uses_SC |
595 |
+ |
end function SimUsesSC |
596 |
+ |
|
597 |
+ |
function SimUsesMEAM() result(doesit) |
598 |
+ |
logical :: doesit |
599 |
+ |
doesit = thisSim%SIM_uses_MEAM |
600 |
+ |
end function SimUsesMEAM |
601 |
+ |
|
602 |
+ |
|
603 |
|
function SimUsesShapes() result(doesit) |
604 |
|
logical :: doesit |
605 |
|
doesit = thisSim%SIM_uses_Shapes |
615 |
|
doesit = thisSim%SIM_uses_RF |
616 |
|
end function SimUsesRF |
617 |
|
|
618 |
+ |
function SimUsesSF() result(doesit) |
619 |
+ |
logical :: doesit |
620 |
+ |
doesit = thisSim%SIM_uses_SF |
621 |
+ |
end function SimUsesSF |
622 |
+ |
|
623 |
|
function SimRequiresPrepairCalc() result(doesit) |
624 |
|
logical :: doesit |
625 |
< |
doesit = thisSim%SIM_uses_EAM |
625 |
> |
doesit = thisSim%SIM_uses_EAM .or. thisSim%SIM_uses_SC & |
626 |
> |
.or. thisSim%SIM_uses_MEAM |
627 |
|
end function SimRequiresPrepairCalc |
628 |
|
|
629 |
|
function SimRequiresPostpairCalc() result(doesit) |
630 |
|
logical :: doesit |
631 |
< |
doesit = thisSim%SIM_uses_RF |
631 |
> |
doesit = thisSim%SIM_uses_RF .or. thisSim%SIM_uses_SF |
632 |
|
end function SimRequiresPostpairCalc |
633 |
|
|
634 |
|
! Function returns true if the simulation has this atype |
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 |