4 |
|
|
5 |
|
!! @author Charles F. Vardeman II |
6 |
|
!! @author Matthew Meineke |
7 |
< |
!! @version $Id: do_Forces.F90,v 1.21 2003-03-17 20:42:57 gezelter Exp $, $Date: 2003-03-17 20:42:57 $, $Name: not supported by cvs2svn $, $Revision: 1.21 $ |
7 |
> |
!! @version $Id: do_Forces.F90,v 1.22 2003-03-17 21:07:50 gezelter Exp $, $Date: 2003-03-17 21:07:50 $, $Name: not supported by cvs2svn $, $Revision: 1.22 $ |
8 |
|
|
9 |
|
module do_Forces |
10 |
|
use simulation |
25 |
|
#define __FORTRAN90 |
26 |
|
#include "fForceField.h" |
27 |
|
|
28 |
– |
type (ffstruct), public :: thisFF |
29 |
– |
|
28 |
|
logical, save :: do_forces_initialized = .false. |
29 |
|
logical, save :: FF_uses_LJ |
30 |
|
logical, save :: FF_uses_sticky |
38 |
|
|
39 |
|
contains |
40 |
|
|
41 |
< |
subroutine init_FF(setThisFF, thisStat) |
41 |
> |
subroutine init_FF(LJMIXPOLICY, use_RF_c, thisStat) |
42 |
|
|
43 |
< |
type (ffstruct) :: setThisFF |
43 |
> |
integer, intent(in) :: LJMIXPOLICY |
44 |
> |
logical(kind=2), intent(in) :: use_RF_c |
45 |
|
|
46 |
|
integer, intent(out) :: thisStat |
47 |
|
integer :: my_status, nMatches |
50 |
|
!! assume things are copacetic, unless they aren't |
51 |
|
thisStat = 0 |
52 |
|
|
54 |
– |
thisFF = setThisFF |
55 |
– |
|
53 |
|
!! Fortran's version of a cast: |
54 |
< |
FF_uses_RF = thisFF%use_RF |
54 |
> |
FF_uses_RF = use_RF_c |
55 |
|
|
56 |
|
!! init_FF is called *after* all of the atom types have been |
57 |
|
!! defined in atype_module using the new_atype subroutine. |
58 |
|
!! |
59 |
|
!! this will scan through the known atypes and figure out what |
60 |
|
!! interactions are used by the force field. |
61 |
< |
|
61 |
> |
|
62 |
|
FF_uses_LJ = .false. |
63 |
|
FF_uses_sticky = .false. |
64 |
|
FF_uses_dipoles = .false. |
68 |
|
call getMatchingElementList(atypes, "is_LJ", .true., nMatches, MatchList) |
69 |
|
deallocate(MatchList) |
70 |
|
if (nMatches .gt. 0) FF_uses_LJ = .true. |
71 |
< |
|
71 |
> |
|
72 |
|
call getMatchingElementList(atypes, "is_DP", .true., nMatches, MatchList) |
73 |
|
deallocate(MatchList) |
74 |
|
if (nMatches .gt. 0) FF_uses_dipoles = .true. |
75 |
< |
|
75 |
> |
|
76 |
|
call getMatchingElementList(atypes, "is_Sticky", .true., nMatches, & |
77 |
|
MatchList) |
78 |
|
deallocate(MatchList) |
81 |
|
call getMatchingElementList(atypes, "is_GB", .true., nMatches, MatchList) |
82 |
|
deallocate(MatchList) |
83 |
|
if (nMatches .gt. 0) FF_uses_GB = .true. |
84 |
< |
|
84 |
> |
|
85 |
|
call getMatchingElementList(atypes, "is_EAM", .true., nMatches, MatchList) |
86 |
|
deallocate(MatchList) |
87 |
|
if (nMatches .gt. 0) FF_uses_EAM = .true. |
88 |
< |
|
88 |
> |
|
89 |
|
!! check to make sure the FF_uses_RF setting makes sense |
90 |
< |
|
90 |
> |
|
91 |
|
if (FF_uses_RF) then |
92 |
|
if (FF_uses_dipoles) then |
93 |
|
call initialize_rf() |
99 |
|
endif |
100 |
|
|
101 |
|
if (FF_uses_LJ) then |
102 |
< |
|
103 |
< |
select case (thisFF%LJ_Mixing_Policy) |
104 |
< |
case (thisFF%LB_MIXING_RULE) |
105 |
< |
call init_lj_FF('LB', my_status) |
106 |
< |
case (thiFF%EXPLICIT_MIXING_RULE) |
107 |
< |
call init_lj_FF('Explicity, my_status) |
102 |
> |
|
103 |
> |
select case (LJMIXPOLICY) |
104 |
> |
case (LB_MIXING_RULE) |
105 |
> |
call init_lj_FF(LB_MIXING_RULE, my_status) |
106 |
> |
case (EXPLICIT_MIXING_RULE) |
107 |
> |
call init_lj_FF(EXPLICIT_MIXING_RULE, my_status) |
108 |
|
case default |
109 |
|
write(default_error,*) 'unknown LJ Mixing Policy!' |
110 |
|
thisStat = -1 |
111 |
|
return |
112 |
< |
end select |
112 |
> |
end select |
113 |
|
if (my_status /= 0) then |
114 |
|
thisStat = -1 |
115 |
|
return |
123 |
|
return |
124 |
|
end if |
125 |
|
endif |
126 |
< |
|
126 |
> |
|
127 |
|
|
128 |
|
do_forces_initialized = .true. |
129 |
|
|
130 |
|
end subroutine init_FF |
131 |
< |
|
131 |
> |
|
132 |
|
|
133 |
|
|
134 |
|
!! Does force loop over i,j pairs. Calls do_pair to calculates forces. |
135 |
< |
a!-------------------------------------------------------------> |
135 |
> |
!-------------------------------------------------------------> |
136 |
|
subroutine do_force_loop(q, A, u_l, f, t, tau, pot, do_pot_c, do_stress_c, & |
137 |
|
error) |
138 |
|
!! Position array provided by C, dimensioned by getNlocal |