45 |
|
|
46 |
|
!! @author Charles F. Vardeman II |
47 |
|
!! @author Matthew Meineke |
48 |
< |
!! @version $Id: doForces.F90,v 1.65 2005-11-01 19:24:54 chrisfen Exp $, $Date: 2005-11-01 19:24:54 $, $Name: not supported by cvs2svn $, $Revision: 1.65 $ |
48 |
> |
!! @version $Id: doForces.F90,v 1.74 2005-12-30 23:15:59 chuckv Exp $, $Date: 2005-12-30 23:15:59 $, $Name: not supported by cvs2svn $, $Revision: 1.74 $ |
49 |
|
|
50 |
|
|
51 |
|
module doForces |
62 |
|
use shapes |
63 |
|
use vector_class |
64 |
|
use eam |
65 |
+ |
use suttonchen |
66 |
|
use status |
67 |
|
#ifdef IS_MPI |
68 |
|
use mpiSimulation |
87 |
|
logical, save :: haveInteractionHash = .false. |
88 |
|
logical, save :: haveGtypeCutoffMap = .false. |
89 |
|
logical, save :: haveDefaultCutoffs = .false. |
90 |
< |
logical, save :: haveRlist = .false. |
90 |
> |
logical, save :: haveSkinThickness = .false. |
91 |
> |
logical, save :: haveElectrostaticSummationMethod = .false. |
92 |
> |
logical, save :: haveCutoffPolicy = .false. |
93 |
> |
logical, save :: VisitCutoffsAfterComputing = .false. |
94 |
|
|
95 |
|
logical, save :: FF_uses_DirectionalAtoms |
96 |
|
logical, save :: FF_uses_Dipoles |
97 |
|
logical, save :: FF_uses_GayBerne |
98 |
|
logical, save :: FF_uses_EAM |
99 |
+ |
logical, save :: FF_uses_SC |
100 |
+ |
logical, save :: FF_uses_MEAM |
101 |
+ |
|
102 |
|
|
103 |
|
logical, save :: SIM_uses_DirectionalAtoms |
104 |
|
logical, save :: SIM_uses_EAM |
105 |
+ |
logical, save :: SIM_uses_SC |
106 |
+ |
logical, save :: SIM_uses_MEAM |
107 |
|
logical, save :: SIM_requires_postpair_calc |
108 |
|
logical, save :: SIM_requires_prepair_calc |
109 |
|
logical, save :: SIM_uses_PBC |
110 |
|
|
111 |
|
integer, save :: electrostaticSummationMethod |
112 |
+ |
integer, save :: cutoffPolicy = TRADITIONAL_CUTOFF_POLICY |
113 |
|
|
114 |
+ |
real(kind=dp), save :: defaultRcut, defaultRsw, largestRcut |
115 |
+ |
real(kind=dp), save :: skinThickness |
116 |
+ |
logical, save :: defaultDoShift |
117 |
+ |
|
118 |
|
public :: init_FF |
119 |
< |
public :: setDefaultCutoffs |
119 |
> |
public :: setCutoffs |
120 |
> |
public :: cWasLame |
121 |
> |
public :: setElectrostaticMethod |
122 |
> |
public :: setCutoffPolicy |
123 |
> |
public :: setSkinThickness |
124 |
|
public :: do_force_loop |
107 |
– |
public :: createInteractionHash |
108 |
– |
public :: createGtypeCutoffMap |
109 |
– |
public :: getStickyCut |
110 |
– |
public :: getStickyPowerCut |
111 |
– |
public :: getGayBerneCut |
112 |
– |
public :: getEAMCut |
113 |
– |
public :: getShapeCut |
125 |
|
|
126 |
|
#ifdef PROFILE |
127 |
|
public :: getforcetime |
149 |
|
end type gtypeCutoffs |
150 |
|
type(gtypeCutoffs), dimension(:,:), allocatable :: gtypeCutoffMap |
151 |
|
|
141 |
– |
integer, save :: cutoffPolicy = TRADITIONAL_CUTOFF_POLICY |
142 |
– |
real(kind=dp),save :: defaultRcut, defaultRsw, defaultRlist |
143 |
– |
real(kind=dp),save :: listSkin |
144 |
– |
|
152 |
|
contains |
153 |
|
|
154 |
< |
subroutine createInteractionHash(status) |
154 |
> |
subroutine createInteractionHash() |
155 |
|
integer :: nAtypes |
149 |
– |
integer, intent(out) :: status |
156 |
|
integer :: i |
157 |
|
integer :: j |
158 |
|
integer :: iHash |
164 |
|
logical :: i_is_GB |
165 |
|
logical :: i_is_EAM |
166 |
|
logical :: i_is_Shape |
167 |
+ |
logical :: i_is_SC |
168 |
+ |
logical :: i_is_MEAM |
169 |
|
logical :: j_is_LJ |
170 |
|
logical :: j_is_Elect |
171 |
|
logical :: j_is_Sticky |
173 |
|
logical :: j_is_GB |
174 |
|
logical :: j_is_EAM |
175 |
|
logical :: j_is_Shape |
176 |
+ |
logical :: j_is_SC |
177 |
+ |
logical :: j_is_MEAM |
178 |
|
real(kind=dp) :: myRcut |
179 |
|
|
170 |
– |
status = 0 |
171 |
– |
|
180 |
|
if (.not. associated(atypes)) then |
181 |
< |
call handleError("atype", "atypes was not present before call of createInteractionHash!") |
174 |
< |
status = -1 |
181 |
> |
call handleError("doForces", "atypes was not present before call of createInteractionHash!") |
182 |
|
return |
183 |
|
endif |
184 |
|
|
185 |
|
nAtypes = getSize(atypes) |
186 |
|
|
187 |
|
if (nAtypes == 0) then |
188 |
< |
status = -1 |
188 |
> |
call handleError("doForces", "nAtypes was zero during call of createInteractionHash!") |
189 |
|
return |
190 |
|
end if |
191 |
|
|
211 |
|
call getElementProperty(atypes, i, "is_GayBerne", i_is_GB) |
212 |
|
call getElementProperty(atypes, i, "is_EAM", i_is_EAM) |
213 |
|
call getElementProperty(atypes, i, "is_Shape", i_is_Shape) |
214 |
+ |
call getElementProperty(atypes, i, "is_SC", i_is_SC) |
215 |
+ |
call getElementProperty(atypes, i, "is_MEAM", i_is_MEAM) |
216 |
|
|
217 |
|
do j = i, nAtypes |
218 |
|
|
226 |
|
call getElementProperty(atypes, j, "is_GayBerne", j_is_GB) |
227 |
|
call getElementProperty(atypes, j, "is_EAM", j_is_EAM) |
228 |
|
call getElementProperty(atypes, j, "is_Shape", j_is_Shape) |
229 |
+ |
call getElementProperty(atypes, j, "is_SC", j_is_SC) |
230 |
+ |
call getElementProperty(atypes, j, "is_MEAM", j_is_MEAM) |
231 |
|
|
232 |
|
if (i_is_LJ .and. j_is_LJ) then |
233 |
|
iHash = ior(iHash, LJ_PAIR) |
249 |
|
iHash = ior(iHash, EAM_PAIR) |
250 |
|
endif |
251 |
|
|
252 |
+ |
if (i_is_SC .and. j_is_SC) then |
253 |
+ |
iHash = ior(iHash, SC_PAIR) |
254 |
+ |
endif |
255 |
+ |
|
256 |
|
if (i_is_GB .and. j_is_GB) iHash = ior(iHash, GAYBERNE_PAIR) |
257 |
|
if (i_is_GB .and. j_is_LJ) iHash = ior(iHash, GAYBERNE_LJ) |
258 |
|
if (i_is_LJ .and. j_is_GB) iHash = ior(iHash, GAYBERNE_LJ) |
272 |
|
haveInteractionHash = .true. |
273 |
|
end subroutine createInteractionHash |
274 |
|
|
275 |
< |
subroutine createGtypeCutoffMap(stat) |
275 |
> |
subroutine createGtypeCutoffMap() |
276 |
|
|
262 |
– |
integer, intent(out), optional :: stat |
277 |
|
logical :: i_is_LJ |
278 |
|
logical :: i_is_Elect |
279 |
|
logical :: i_is_Sticky |
281 |
|
logical :: i_is_GB |
282 |
|
logical :: i_is_EAM |
283 |
|
logical :: i_is_Shape |
284 |
+ |
logical :: i_is_SC |
285 |
|
logical :: GtypeFound |
286 |
|
|
287 |
|
integer :: myStatus, nAtypes, i, j, istart, iend, jstart, jend |
289 |
|
integer :: nGroupsInRow |
290 |
|
integer :: nGroupsInCol |
291 |
|
integer :: nGroupTypesRow,nGroupTypesCol |
292 |
< |
real(kind=dp):: thisSigma, bigSigma, thisRcut, tradRcut, tol, skin |
292 |
> |
real(kind=dp):: thisSigma, bigSigma, thisRcut, tradRcut, tol |
293 |
|
real(kind=dp) :: biggestAtypeCutoff |
294 |
|
|
280 |
– |
stat = 0 |
295 |
|
if (.not. haveInteractionHash) then |
296 |
< |
call createInteractionHash(myStatus) |
283 |
< |
if (myStatus .ne. 0) then |
284 |
< |
write(default_error, *) 'createInteractionHash failed in doForces!' |
285 |
< |
stat = -1 |
286 |
< |
return |
287 |
< |
endif |
296 |
> |
call createInteractionHash() |
297 |
|
endif |
298 |
|
#ifdef IS_MPI |
299 |
|
nGroupsInRow = getNgroupsInRow(plan_group_row) |
311 |
|
call getElementProperty(atypes, i, "is_GayBerne", i_is_GB) |
312 |
|
call getElementProperty(atypes, i, "is_EAM", i_is_EAM) |
313 |
|
call getElementProperty(atypes, i, "is_Shape", i_is_Shape) |
314 |
< |
|
314 |
> |
call getElementProperty(atypes, i, "is_SC", i_is_SC) |
315 |
|
|
316 |
|
if (haveDefaultCutoffs) then |
317 |
|
atypeMaxCutoff(i) = defaultRcut |
344 |
|
thisRcut = getShapeCut(i) |
345 |
|
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
346 |
|
endif |
347 |
+ |
if (i_is_SC) then |
348 |
+ |
thisRcut = getSCCut(i) |
349 |
+ |
if (thisRCut .gt. atypeMaxCutoff(i)) atypeMaxCutoff(i) = thisRCut |
350 |
+ |
endif |
351 |
|
endif |
352 |
< |
|
340 |
< |
|
352 |
> |
|
353 |
|
if (atypeMaxCutoff(i).gt.biggestAtypeCutoff) then |
354 |
|
biggestAtypeCutoff = atypeMaxCutoff(i) |
355 |
|
endif |
356 |
|
|
357 |
|
endif |
358 |
|
enddo |
347 |
– |
|
348 |
– |
|
359 |
|
|
360 |
|
istart = 1 |
361 |
|
jstart = 1 |
399 |
|
allocate(groupToGtypeCol(jend)) |
400 |
|
end if |
401 |
|
|
402 |
< |
if(.not.associated(groupToGtypeCol)) then |
403 |
< |
allocate(groupToGtypeCol(jend)) |
402 |
> |
if(.not.associated(groupMaxCutoffCol)) then |
403 |
> |
allocate(groupMaxCutoffCol(jend)) |
404 |
|
else |
405 |
< |
deallocate(groupToGtypeCol) |
406 |
< |
allocate(groupToGtypeCol(jend)) |
405 |
> |
deallocate(groupMaxCutoffCol) |
406 |
> |
allocate(groupMaxCutoffCol(jend)) |
407 |
|
end if |
408 |
|
if(.not.associated(gtypeMaxCutoffCol)) then |
409 |
|
allocate(gtypeMaxCutoffCol(jend)) |
426 |
|
|
427 |
|
tol = 1.0d-6 |
428 |
|
nGroupTypesRow = 0 |
429 |
< |
|
429 |
> |
nGroupTypesCol = 0 |
430 |
|
do i = istart, iend |
431 |
|
n_in_i = groupStartRow(i+1) - groupStartRow(i) |
432 |
|
groupMaxCutoffRow(i) = 0.0_dp |
441 |
|
groupMaxCutoffRow(i)=atypeMaxCutoff(me_i) |
442 |
|
endif |
443 |
|
enddo |
434 |
– |
|
444 |
|
if (nGroupTypesRow.eq.0) then |
445 |
|
nGroupTypesRow = nGroupTypesRow + 1 |
446 |
|
gtypeMaxCutoffRow(nGroupTypesRow) = groupMaxCutoffRow(i) |
503 |
|
groupMaxCutoffCol => groupMaxCutoffRow |
504 |
|
#endif |
505 |
|
|
497 |
– |
|
498 |
– |
|
499 |
– |
|
500 |
– |
|
506 |
|
!! allocate the gtypeCutoffMap here. |
507 |
|
allocate(gtypeCutoffMap(nGroupTypesRow,nGroupTypesCol)) |
508 |
|
!! then we do a double loop over all the group TYPES to find the cutoff |
509 |
|
!! map between groups of two types |
510 |
|
tradRcut = max(maxval(gtypeMaxCutoffRow),maxval(gtypeMaxCutoffCol)) |
511 |
|
|
512 |
< |
do i = 1, nGroupTypesRow |
512 |
> |
do i = 1, nGroupTypesRow |
513 |
|
do j = 1, nGroupTypesCol |
514 |
|
|
515 |
|
select case(cutoffPolicy) |
524 |
|
return |
525 |
|
end select |
526 |
|
gtypeCutoffMap(i,j)%rcut = thisRcut |
527 |
+ |
|
528 |
+ |
if (thisRcut.gt.largestRcut) largestRcut = thisRcut |
529 |
+ |
|
530 |
|
gtypeCutoffMap(i,j)%rcutsq = thisRcut*thisRcut |
523 |
– |
skin = defaultRlist - defaultRcut |
524 |
– |
listSkin = skin ! set neighbor list skin thickness |
525 |
– |
gtypeCutoffMap(i,j)%rlistsq = (thisRcut + skin)**2 |
531 |
|
|
532 |
+ |
if (.not.haveSkinThickness) then |
533 |
+ |
skinThickness = 1.0_dp |
534 |
+ |
endif |
535 |
+ |
|
536 |
+ |
gtypeCutoffMap(i,j)%rlistsq = (thisRcut + skinThickness)**2 |
537 |
+ |
|
538 |
|
! sanity check |
539 |
|
|
540 |
|
if (haveDefaultCutoffs) then |
544 |
|
endif |
545 |
|
enddo |
546 |
|
enddo |
547 |
+ |
|
548 |
|
if(allocated(gtypeMaxCutoffRow)) deallocate(gtypeMaxCutoffRow) |
549 |
|
if(allocated(groupMaxCutoffRow)) deallocate(groupMaxCutoffRow) |
550 |
|
if(allocated(atypeMaxCutoff)) deallocate(atypeMaxCutoff) |
558 |
|
haveGtypeCutoffMap = .true. |
559 |
|
end subroutine createGtypeCutoffMap |
560 |
|
|
561 |
< |
subroutine setDefaultCutoffs(defRcut, defRsw, defRlist, cutPolicy) |
550 |
< |
real(kind=dp),intent(in) :: defRcut, defRsw, defRlist |
551 |
< |
integer, intent(in) :: cutPolicy |
561 |
> |
subroutine setCutoffs(defRcut, defRsw) |
562 |
|
|
563 |
+ |
real(kind=dp),intent(in) :: defRcut, defRsw |
564 |
+ |
character(len = statusMsgSize) :: errMsg |
565 |
+ |
integer :: localError |
566 |
+ |
|
567 |
|
defaultRcut = defRcut |
568 |
|
defaultRsw = defRsw |
569 |
< |
defaultRlist = defRlist |
570 |
< |
cutoffPolicy = cutPolicy |
569 |
> |
|
570 |
> |
defaultDoShift = .false. |
571 |
> |
if (abs(defaultRcut-defaultRsw) .lt. 0.0001) then |
572 |
> |
|
573 |
> |
write(errMsg, *) & |
574 |
> |
'cutoffRadius and switchingRadius are set to the same', newline & |
575 |
> |
// tab, 'value. OOPSE will use shifted ', newline & |
576 |
> |
// tab, 'potentials instead of switching functions.' |
577 |
> |
|
578 |
> |
call handleInfo("setCutoffs", errMsg) |
579 |
> |
|
580 |
> |
defaultDoShift = .true. |
581 |
> |
|
582 |
> |
endif |
583 |
|
|
584 |
+ |
localError = 0 |
585 |
+ |
call setLJDefaultCutoff( defaultRcut, defaultDoShift ) |
586 |
+ |
call setElectrostaticCutoffRadius( defaultRcut, defaultRsw ) |
587 |
+ |
call setCutoffEAM( defaultRcut, localError) |
588 |
+ |
if (localError /= 0) then |
589 |
+ |
write(errMsg, *) 'An error has occured in setting the EAM cutoff' |
590 |
+ |
call handleError("setCutoffs", errMsg) |
591 |
+ |
end if |
592 |
+ |
call set_switch(GROUP_SWITCH, defaultRsw, defaultRcut) |
593 |
+ |
|
594 |
|
haveDefaultCutoffs = .true. |
595 |
< |
end subroutine setDefaultCutoffs |
595 |
> |
haveGtypeCutoffMap = .false. |
596 |
> |
end subroutine setCutoffs |
597 |
|
|
598 |
+ |
subroutine cWasLame() |
599 |
+ |
|
600 |
+ |
VisitCutoffsAfterComputing = .true. |
601 |
+ |
return |
602 |
+ |
|
603 |
+ |
end subroutine cWasLame |
604 |
+ |
|
605 |
|
subroutine setCutoffPolicy(cutPolicy) |
606 |
< |
|
606 |
> |
|
607 |
|
integer, intent(in) :: cutPolicy |
608 |
+ |
|
609 |
|
cutoffPolicy = cutPolicy |
610 |
< |
call createGtypeCutoffMap() |
611 |
< |
end subroutine setCutoffPolicy |
567 |
< |
|
610 |
> |
haveCutoffPolicy = .true. |
611 |
> |
haveGtypeCutoffMap = .false. |
612 |
|
|
613 |
< |
subroutine setSimVariables() |
614 |
< |
SIM_uses_DirectionalAtoms = SimUsesDirectionalAtoms() |
615 |
< |
SIM_uses_EAM = SimUsesEAM() |
572 |
< |
SIM_requires_postpair_calc = SimRequiresPostpairCalc() |
573 |
< |
SIM_requires_prepair_calc = SimRequiresPrepairCalc() |
574 |
< |
SIM_uses_PBC = SimUsesPBC() |
613 |
> |
end subroutine setCutoffPolicy |
614 |
> |
|
615 |
> |
subroutine setElectrostaticMethod( thisESM ) |
616 |
|
|
617 |
< |
haveSIMvariables = .true. |
617 |
> |
integer, intent(in) :: thisESM |
618 |
|
|
619 |
< |
return |
620 |
< |
end subroutine setSimVariables |
619 |
> |
electrostaticSummationMethod = thisESM |
620 |
> |
haveElectrostaticSummationMethod = .true. |
621 |
> |
|
622 |
> |
end subroutine setElectrostaticMethod |
623 |
|
|
624 |
+ |
subroutine setSkinThickness( thisSkin ) |
625 |
+ |
|
626 |
+ |
real(kind=dp), intent(in) :: thisSkin |
627 |
+ |
|
628 |
+ |
skinThickness = thisSkin |
629 |
+ |
haveSkinThickness = .true. |
630 |
+ |
haveGtypeCutoffMap = .false. |
631 |
+ |
|
632 |
+ |
end subroutine setSkinThickness |
633 |
+ |
|
634 |
+ |
subroutine setSimVariables() |
635 |
+ |
SIM_uses_DirectionalAtoms = SimUsesDirectionalAtoms() |
636 |
+ |
SIM_uses_EAM = SimUsesEAM() |
637 |
+ |
SIM_requires_postpair_calc = SimRequiresPostpairCalc() |
638 |
+ |
SIM_requires_prepair_calc = SimRequiresPrepairCalc() |
639 |
+ |
SIM_uses_PBC = SimUsesPBC() |
640 |
+ |
|
641 |
+ |
haveSIMvariables = .true. |
642 |
+ |
|
643 |
+ |
return |
644 |
+ |
end subroutine setSimVariables |
645 |
+ |
|
646 |
|
subroutine doReadyCheck(error) |
647 |
|
integer, intent(out) :: error |
648 |
|
|
651 |
|
error = 0 |
652 |
|
|
653 |
|
if (.not. haveInteractionHash) then |
654 |
< |
myStatus = 0 |
590 |
< |
call createInteractionHash(myStatus) |
591 |
< |
if (myStatus .ne. 0) then |
592 |
< |
write(default_error, *) 'createInteractionHash failed in doForces!' |
593 |
< |
error = -1 |
594 |
< |
return |
595 |
< |
endif |
654 |
> |
call createInteractionHash() |
655 |
|
endif |
656 |
|
|
657 |
|
if (.not. haveGtypeCutoffMap) then |
658 |
< |
myStatus = 0 |
600 |
< |
call createGtypeCutoffMap(myStatus) |
601 |
< |
if (myStatus .ne. 0) then |
602 |
< |
write(default_error, *) 'createGtypeCutoffMap failed in doForces!' |
603 |
< |
error = -1 |
604 |
< |
return |
605 |
< |
endif |
658 |
> |
call createGtypeCutoffMap() |
659 |
|
endif |
660 |
|
|
661 |
+ |
|
662 |
+ |
if (VisitCutoffsAfterComputing) then |
663 |
+ |
call set_switch(GROUP_SWITCH, largestRcut, largestRcut) |
664 |
+ |
endif |
665 |
+ |
|
666 |
+ |
|
667 |
|
if (.not. haveSIMvariables) then |
668 |
|
call setSimVariables() |
669 |
|
endif |
697 |
|
end subroutine doReadyCheck |
698 |
|
|
699 |
|
|
700 |
< |
subroutine init_FF(thisESM, thisStat) |
700 |
> |
subroutine init_FF(thisStat) |
701 |
|
|
643 |
– |
integer, intent(in) :: thisESM |
702 |
|
integer, intent(out) :: thisStat |
703 |
|
integer :: my_status, nMatches |
704 |
|
integer, pointer :: MatchList(:) => null() |
706 |
|
!! assume things are copacetic, unless they aren't |
707 |
|
thisStat = 0 |
708 |
|
|
651 |
– |
electrostaticSummationMethod = thisESM |
652 |
– |
|
709 |
|
!! init_FF is called *after* all of the atom types have been |
710 |
|
!! defined in atype_module using the new_atype subroutine. |
711 |
|
!! |
716 |
|
FF_uses_Dipoles = .false. |
717 |
|
FF_uses_GayBerne = .false. |
718 |
|
FF_uses_EAM = .false. |
719 |
+ |
FF_uses_SC = .false. |
720 |
|
|
721 |
|
call getMatchingElementList(atypes, "is_Directional", .true., & |
722 |
|
nMatches, MatchList) |
732 |
|
|
733 |
|
call getMatchingElementList(atypes, "is_EAM", .true., nMatches, MatchList) |
734 |
|
if (nMatches .gt. 0) FF_uses_EAM = .true. |
735 |
+ |
|
736 |
+ |
call getMatchingElementList(atypes, "is_SC", .true., nMatches, MatchList) |
737 |
+ |
if (nMatches .gt. 0) FF_uses_SC = .true. |
738 |
|
|
739 |
|
|
740 |
|
haveSaneForceField = .true. |
806 |
|
real( kind = DP ) :: rVal |
807 |
|
real(kind=dp),dimension(3) :: d_atm, d_grp, fpair, fij |
808 |
|
real(kind=dp) :: rfpot, mu_i, virial |
809 |
+ |
real(kind=dp):: rCut |
810 |
|
integer :: me_i, me_j, n_in_i, n_in_j |
811 |
|
logical :: is_dp_i |
812 |
|
integer :: neighborListSize |
880 |
|
! (but only on the first time through): |
881 |
|
if (loop .eq. loopStart) then |
882 |
|
#ifdef IS_MPI |
883 |
< |
call checkNeighborList(nGroupsInRow, q_group_row, listSkin, & |
883 |
> |
call checkNeighborList(nGroupsInRow, q_group_row, skinThickness, & |
884 |
|
update_nlist) |
885 |
|
#else |
886 |
< |
call checkNeighborList(nGroups, q_group, listSkin, & |
886 |
> |
call checkNeighborList(nGroups, q_group, skinThickness, & |
887 |
|
update_nlist) |
888 |
|
#endif |
889 |
|
endif |
963 |
|
|
964 |
|
list(nlist) = j |
965 |
|
endif |
966 |
< |
|
906 |
< |
if (loop .eq. PAIR_LOOP) then |
907 |
< |
vij = 0.0d0 |
908 |
< |
fij(1:3) = 0.0d0 |
909 |
< |
endif |
966 |
> |
|
967 |
|
|
968 |
< |
call get_switch(rgrpsq, sw, dswdr, rgrp, group_switch, & |
969 |
< |
in_switching_region) |
968 |
> |
|
969 |
> |
if (rgrpsq < gtypeCutoffMap(groupToGtypeRow(i),groupToGtypeCol(j))%rCutsq) then |
970 |
|
|
971 |
< |
n_in_j = groupStartCol(j+1) - groupStartCol(j) |
972 |
< |
|
973 |
< |
do ia = groupStartRow(i), groupStartRow(i+1)-1 |
974 |
< |
|
975 |
< |
atom1 = groupListRow(ia) |
976 |
< |
|
977 |
< |
inner: do jb = groupStartCol(j), groupStartCol(j+1)-1 |
978 |
< |
|
979 |
< |
atom2 = groupListCol(jb) |
980 |
< |
|
981 |
< |
if (skipThisPair(atom1, atom2)) cycle inner |
971 |
> |
rCut = gtypeCutoffMap(groupToGtypeRow(i),groupToGtypeCol(j))%rCut |
972 |
> |
if (loop .eq. PAIR_LOOP) then |
973 |
> |
vij = 0.0d0 |
974 |
> |
fij(1:3) = 0.0d0 |
975 |
> |
endif |
976 |
> |
|
977 |
> |
call get_switch(rgrpsq, sw, dswdr, rgrp, & |
978 |
> |
group_switch, in_switching_region) |
979 |
> |
|
980 |
> |
n_in_j = groupStartCol(j+1) - groupStartCol(j) |
981 |
> |
|
982 |
> |
do ia = groupStartRow(i), groupStartRow(i+1)-1 |
983 |
|
|
984 |
< |
if ((n_in_i .eq. 1).and.(n_in_j .eq. 1)) then |
985 |
< |
d_atm(1:3) = d_grp(1:3) |
986 |
< |
ratmsq = rgrpsq |
987 |
< |
else |
984 |
> |
atom1 = groupListRow(ia) |
985 |
> |
|
986 |
> |
inner: do jb = groupStartCol(j), groupStartCol(j+1)-1 |
987 |
> |
|
988 |
> |
atom2 = groupListCol(jb) |
989 |
> |
|
990 |
> |
if (skipThisPair(atom1, atom2)) cycle inner |
991 |
> |
|
992 |
> |
if ((n_in_i .eq. 1).and.(n_in_j .eq. 1)) then |
993 |
> |
d_atm(1:3) = d_grp(1:3) |
994 |
> |
ratmsq = rgrpsq |
995 |
> |
else |
996 |
|
#ifdef IS_MPI |
997 |
< |
call get_interatomic_vector(q_Row(:,atom1), & |
998 |
< |
q_Col(:,atom2), d_atm, ratmsq) |
997 |
> |
call get_interatomic_vector(q_Row(:,atom1), & |
998 |
> |
q_Col(:,atom2), d_atm, ratmsq) |
999 |
|
#else |
1000 |
< |
call get_interatomic_vector(q(:,atom1), & |
1001 |
< |
q(:,atom2), d_atm, ratmsq) |
1000 |
> |
call get_interatomic_vector(q(:,atom1), & |
1001 |
> |
q(:,atom2), d_atm, ratmsq) |
1002 |
|
#endif |
1003 |
< |
endif |
1004 |
< |
|
1005 |
< |
if (loop .eq. PREPAIR_LOOP) then |
1003 |
> |
endif |
1004 |
> |
|
1005 |
> |
if (loop .eq. PREPAIR_LOOP) then |
1006 |
|
#ifdef IS_MPI |
1007 |
< |
call do_prepair(atom1, atom2, ratmsq, d_atm, sw, & |
1008 |
< |
rgrpsq, d_grp, do_pot, do_stress, & |
1009 |
< |
eFrame, A, f, t, pot_local) |
1007 |
> |
call do_prepair(atom1, atom2, ratmsq, d_atm, sw, & |
1008 |
> |
rgrpsq, d_grp, rCut, do_pot, do_stress, & |
1009 |
> |
eFrame, A, f, t, pot_local) |
1010 |
|
#else |
1011 |
< |
call do_prepair(atom1, atom2, ratmsq, d_atm, sw, & |
1012 |
< |
rgrpsq, d_grp, do_pot, do_stress, & |
1013 |
< |
eFrame, A, f, t, pot) |
1011 |
> |
call do_prepair(atom1, atom2, ratmsq, d_atm, sw, & |
1012 |
> |
rgrpsq, d_grp, rCut, do_pot, do_stress, & |
1013 |
> |
eFrame, A, f, t, pot) |
1014 |
|
#endif |
1015 |
< |
else |
1015 |
> |
else |
1016 |
|
#ifdef IS_MPI |
1017 |
< |
call do_pair(atom1, atom2, ratmsq, d_atm, sw, & |
1018 |
< |
do_pot, eFrame, A, f, t, pot_local, vpair, & |
1019 |
< |
fpair, d_grp, rgrp) |
1017 |
> |
call do_pair(atom1, atom2, ratmsq, d_atm, sw, & |
1018 |
> |
do_pot, eFrame, A, f, t, pot_local, vpair, & |
1019 |
> |
fpair, d_grp, rgrp, rCut) |
1020 |
|
#else |
1021 |
< |
call do_pair(atom1, atom2, ratmsq, d_atm, sw, & |
1022 |
< |
do_pot, eFrame, A, f, t, pot, vpair, fpair, & |
1023 |
< |
d_grp, rgrp) |
1021 |
> |
call do_pair(atom1, atom2, ratmsq, d_atm, sw, & |
1022 |
> |
do_pot, eFrame, A, f, t, pot, vpair, fpair, & |
1023 |
> |
d_grp, rgrp, rCut) |
1024 |
|
#endif |
1025 |
+ |
vij = vij + vpair |
1026 |
+ |
fij(1:3) = fij(1:3) + fpair(1:3) |
1027 |
+ |
endif |
1028 |
+ |
enddo inner |
1029 |
+ |
enddo |
1030 |
|
|
1031 |
< |
vij = vij + vpair |
1032 |
< |
fij(1:3) = fij(1:3) + fpair(1:3) |
1033 |
< |
endif |
1034 |
< |
enddo inner |
1035 |
< |
enddo |
1036 |
< |
|
1037 |
< |
if (loop .eq. PAIR_LOOP) then |
1038 |
< |
if (in_switching_region) then |
1039 |
< |
swderiv = vij*dswdr/rgrp |
1040 |
< |
fij(1) = fij(1) + swderiv*d_grp(1) |
970 |
< |
fij(2) = fij(2) + swderiv*d_grp(2) |
971 |
< |
fij(3) = fij(3) + swderiv*d_grp(3) |
972 |
< |
|
973 |
< |
do ia=groupStartRow(i), groupStartRow(i+1)-1 |
974 |
< |
atom1=groupListRow(ia) |
975 |
< |
mf = mfactRow(atom1) |
1031 |
> |
if (loop .eq. PAIR_LOOP) then |
1032 |
> |
if (in_switching_region) then |
1033 |
> |
swderiv = vij*dswdr/rgrp |
1034 |
> |
fij(1) = fij(1) + swderiv*d_grp(1) |
1035 |
> |
fij(2) = fij(2) + swderiv*d_grp(2) |
1036 |
> |
fij(3) = fij(3) + swderiv*d_grp(3) |
1037 |
> |
|
1038 |
> |
do ia=groupStartRow(i), groupStartRow(i+1)-1 |
1039 |
> |
atom1=groupListRow(ia) |
1040 |
> |
mf = mfactRow(atom1) |
1041 |
|
#ifdef IS_MPI |
1042 |
< |
f_Row(1,atom1) = f_Row(1,atom1) + swderiv*d_grp(1)*mf |
1043 |
< |
f_Row(2,atom1) = f_Row(2,atom1) + swderiv*d_grp(2)*mf |
1044 |
< |
f_Row(3,atom1) = f_Row(3,atom1) + swderiv*d_grp(3)*mf |
1042 |
> |
f_Row(1,atom1) = f_Row(1,atom1) + swderiv*d_grp(1)*mf |
1043 |
> |
f_Row(2,atom1) = f_Row(2,atom1) + swderiv*d_grp(2)*mf |
1044 |
> |
f_Row(3,atom1) = f_Row(3,atom1) + swderiv*d_grp(3)*mf |
1045 |
|
#else |
1046 |
< |
f(1,atom1) = f(1,atom1) + swderiv*d_grp(1)*mf |
1047 |
< |
f(2,atom1) = f(2,atom1) + swderiv*d_grp(2)*mf |
1048 |
< |
f(3,atom1) = f(3,atom1) + swderiv*d_grp(3)*mf |
1046 |
> |
f(1,atom1) = f(1,atom1) + swderiv*d_grp(1)*mf |
1047 |
> |
f(2,atom1) = f(2,atom1) + swderiv*d_grp(2)*mf |
1048 |
> |
f(3,atom1) = f(3,atom1) + swderiv*d_grp(3)*mf |
1049 |
|
#endif |
1050 |
< |
enddo |
1051 |
< |
|
1052 |
< |
do jb=groupStartCol(j), groupStartCol(j+1)-1 |
1053 |
< |
atom2=groupListCol(jb) |
1054 |
< |
mf = mfactCol(atom2) |
1050 |
> |
enddo |
1051 |
> |
|
1052 |
> |
do jb=groupStartCol(j), groupStartCol(j+1)-1 |
1053 |
> |
atom2=groupListCol(jb) |
1054 |
> |
mf = mfactCol(atom2) |
1055 |
|
#ifdef IS_MPI |
1056 |
< |
f_Col(1,atom2) = f_Col(1,atom2) - swderiv*d_grp(1)*mf |
1057 |
< |
f_Col(2,atom2) = f_Col(2,atom2) - swderiv*d_grp(2)*mf |
1058 |
< |
f_Col(3,atom2) = f_Col(3,atom2) - swderiv*d_grp(3)*mf |
1056 |
> |
f_Col(1,atom2) = f_Col(1,atom2) - swderiv*d_grp(1)*mf |
1057 |
> |
f_Col(2,atom2) = f_Col(2,atom2) - swderiv*d_grp(2)*mf |
1058 |
> |
f_Col(3,atom2) = f_Col(3,atom2) - swderiv*d_grp(3)*mf |
1059 |
|
#else |
1060 |
< |
f(1,atom2) = f(1,atom2) - swderiv*d_grp(1)*mf |
1061 |
< |
f(2,atom2) = f(2,atom2) - swderiv*d_grp(2)*mf |
1062 |
< |
f(3,atom2) = f(3,atom2) - swderiv*d_grp(3)*mf |
1060 |
> |
f(1,atom2) = f(1,atom2) - swderiv*d_grp(1)*mf |
1061 |
> |
f(2,atom2) = f(2,atom2) - swderiv*d_grp(2)*mf |
1062 |
> |
f(3,atom2) = f(3,atom2) - swderiv*d_grp(3)*mf |
1063 |
|
#endif |
1064 |
< |
enddo |
1065 |
< |
endif |
1066 |
< |
|
1067 |
< |
if (do_stress) call add_stress_tensor(d_grp, fij) |
1064 |
> |
enddo |
1065 |
> |
endif |
1066 |
> |
|
1067 |
> |
if (do_stress) call add_stress_tensor(d_grp, fij) |
1068 |
> |
endif |
1069 |
|
endif |
1070 |
< |
end if |
1070 |
> |
endif |
1071 |
|
enddo |
1072 |
< |
|
1072 |
> |
|
1073 |
|
enddo outer |
1074 |
|
|
1075 |
|
if (update_nlist) then |
1174 |
|
endif |
1175 |
|
|
1176 |
|
|
1177 |
< |
!!$ if (electrostaticSummationMethod.eq.REACTION_FIELD) then |
1177 |
> |
if (electrostaticSummationMethod.eq.REACTION_FIELD) then |
1178 |
|
|
1179 |
|
! loop over the excludes to accumulate RF stuff we've |
1180 |
|
! left out of the normal pair loop |
1198 |
|
#endif |
1199 |
|
endif |
1200 |
|
enddo |
1201 |
< |
!!$ endif |
1201 |
> |
endif |
1202 |
|
enddo |
1203 |
|
endif |
1204 |
|
|
1228 |
|
end subroutine do_force_loop |
1229 |
|
|
1230 |
|
subroutine do_pair(i, j, rijsq, d, sw, do_pot, & |
1231 |
< |
eFrame, A, f, t, pot, vpair, fpair, d_grp, r_grp) |
1231 |
> |
eFrame, A, f, t, pot, vpair, fpair, d_grp, r_grp, rCut) |
1232 |
|
|
1233 |
|
real( kind = dp ) :: vpair, sw |
1234 |
|
real( kind = dp ), dimension(LR_POT_TYPES) :: pot |
1245 |
|
real ( kind = dp ), intent(inout) :: r_grp |
1246 |
|
real ( kind = dp ), intent(inout) :: d(3) |
1247 |
|
real ( kind = dp ), intent(inout) :: d_grp(3) |
1248 |
+ |
real ( kind = dp ), intent(inout) :: rCut |
1249 |
|
real ( kind = dp ) :: r |
1250 |
|
integer :: me_i, me_j |
1251 |
|
|
1266 |
|
iHash = InteractionHash(me_i, me_j) |
1267 |
|
|
1268 |
|
if ( iand(iHash, LJ_PAIR).ne.0 ) then |
1269 |
< |
call do_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1269 |
> |
call do_lj_pair(i, j, d, r, rijsq, rcut, sw, vpair, fpair, & |
1270 |
|
pot(VDW_POT), f, do_pot) |
1271 |
|
endif |
1272 |
|
|
1273 |
|
if ( iand(iHash, ELECTROSTATIC_PAIR).ne.0 ) then |
1274 |
< |
call doElectrostaticPair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1274 |
> |
call doElectrostaticPair(i, j, d, r, rijsq, rcut, sw, vpair, fpair, & |
1275 |
|
pot(ELECTROSTATIC_POT), eFrame, f, t, do_pot) |
1276 |
|
endif |
1277 |
|
|
1291 |
|
endif |
1292 |
|
|
1293 |
|
if ( iand(iHash, GAYBERNE_LJ).ne.0 ) then |
1294 |
< |
call do_gb_lj_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1294 |
> |
call do_gb_lj_pair(i, j, d, r, rijsq, rcut, sw, vpair, fpair, & |
1295 |
|
pot(VDW_POT), A, f, t, do_pot) |
1296 |
|
endif |
1297 |
|
|
1309 |
|
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1310 |
|
pot(VDW_POT), A, f, t, do_pot) |
1311 |
|
endif |
1312 |
+ |
|
1313 |
+ |
if ( iand(iHash, SC_PAIR).ne.0 ) then |
1314 |
+ |
call do_SC_pair(i, j, d, r, rijsq, rcut, sw, vpair, fpair, & |
1315 |
+ |
pot(METALLIC_POT), f, do_pot) |
1316 |
+ |
endif |
1317 |
+ |
|
1318 |
+ |
|
1319 |
|
|
1320 |
|
end subroutine do_pair |
1321 |
|
|
1322 |
< |
subroutine do_prepair(i, j, rijsq, d, sw, rcijsq, dc, & |
1322 |
> |
subroutine do_prepair(i, j, rijsq, d, sw, rcijsq, dc, rCut, & |
1323 |
|
do_pot, do_stress, eFrame, A, f, t, pot) |
1324 |
|
|
1325 |
|
real( kind = dp ) :: sw |
1331 |
|
|
1332 |
|
logical, intent(inout) :: do_pot, do_stress |
1333 |
|
integer, intent(in) :: i, j |
1334 |
< |
real ( kind = dp ), intent(inout) :: rijsq, rcijsq |
1334 |
> |
real ( kind = dp ), intent(inout) :: rijsq, rcijsq, rCut |
1335 |
|
real ( kind = dp ) :: r, rc |
1336 |
|
real ( kind = dp ), intent(inout) :: d(3), dc(3) |
1337 |
|
|
1350 |
|
iHash = InteractionHash(me_i, me_j) |
1351 |
|
|
1352 |
|
if ( iand(iHash, EAM_PAIR).ne.0 ) then |
1353 |
< |
call calc_EAM_prepair_rho(i, j, d, r, rijsq ) |
1353 |
> |
call calc_EAM_prepair_rho(i, j, d, r, rijsq) |
1354 |
> |
endif |
1355 |
> |
|
1356 |
> |
if ( iand(iHash, SC_PAIR).ne.0 ) then |
1357 |
> |
call calc_SC_prepair_rho(i, j, d, r, rijsq, rcut ) |
1358 |
|
endif |
1359 |
|
|
1360 |
|
end subroutine do_prepair |
1367 |
|
if (FF_uses_EAM .and. SIM_uses_EAM) then |
1368 |
|
call calc_EAM_preforce_Frho(nlocal,pot(METALLIC_POT)) |
1369 |
|
endif |
1370 |
+ |
if (FF_uses_SC .and. SIM_uses_SC) then |
1371 |
+ |
call calc_SC_preforce_Frho(nlocal,pot(METALLIC_POT)) |
1372 |
+ |
endif |
1373 |
|
|
1374 |
|
|
1375 |
|
end subroutine do_preforce |
1460 |
|
call clean_EAM() |
1461 |
|
endif |
1462 |
|
|
1382 |
– |
rf = 0.0_dp |
1463 |
|
tau_Temp = 0.0_dp |
1464 |
|
virial_Temp = 0.0_dp |
1465 |
|
end subroutine zero_work_arrays |
1553 |
|
|
1554 |
|
function FF_RequiresPrepairCalc() result(doesit) |
1555 |
|
logical :: doesit |
1556 |
< |
doesit = FF_uses_EAM |
1556 |
> |
doesit = FF_uses_EAM .or. FF_uses_SC & |
1557 |
> |
.or. FF_uses_MEAM |
1558 |
|
end function FF_RequiresPrepairCalc |
1559 |
|
|
1560 |
|
#ifdef PROFILE |