16 |
|
#define __FORTRAN90 |
17 |
|
#include "fSimulation.h" |
18 |
|
|
19 |
< |
type (simtype), public :: thisSim |
19 |
> |
type (simtype), public, save :: thisSim |
20 |
|
|
21 |
|
logical, save :: simulation_setup_complete = .false. |
22 |
|
|
27 |
|
integer, allocatable, dimension(:), public :: excludesGlobal |
28 |
|
integer, allocatable, dimension(:), public :: molMembershipList |
29 |
|
|
30 |
– |
real(kind=dp), save :: rcut2 = 0.0_DP |
31 |
– |
real(kind=dp), save :: rcut6 = 0.0_DP |
32 |
– |
real(kind=dp), save :: rlist2 = 0.0_DP |
30 |
|
real(kind=dp), public, dimension(3,3), save :: Hmat, HmatInv |
31 |
|
logical, public, save :: boxIsOrthorhombic |
32 |
|
|
33 |
|
public :: SimulationSetup |
34 |
|
public :: getNlocal |
35 |
|
public :: setBox |
39 |
– |
public :: setRcut |
40 |
– |
public :: getRcut |
41 |
– |
public :: getRlist |
42 |
– |
public :: getRrf |
43 |
– |
public :: getRt |
36 |
|
public :: getDielect |
37 |
|
public :: SimUsesPBC |
38 |
|
public :: SimUsesLJ |
39 |
+ |
public :: SimUsesCharges |
40 |
|
public :: SimUsesDipoles |
41 |
|
public :: SimUsesSticky |
42 |
|
public :: SimUsesRF |
50 |
|
|
51 |
|
subroutine SimulationSetup(setThisSim, CnGlobal, CnLocal, c_idents, & |
52 |
|
CnLocalExcludes, CexcludesLocal, CnGlobalExcludes, CexcludesGlobal, & |
53 |
< |
CmolMembership, & |
53 |
> |
CmolMembership, mfact, ngroup, groupList, groupStart, & |
54 |
|
status) |
55 |
|
|
56 |
|
type (simtype) :: setThisSim |
65 |
|
!! Result status, success = 0, status = -1 |
66 |
|
integer, intent(out) :: status |
67 |
|
integer :: i, me, thisStat, alloc_stat, myNode |
68 |
+ |
|
69 |
+ |
!! mass factors used for molecular cutoffs |
70 |
+ |
real ( kind = dp ), dimension(3,nLocal) :: mfact |
71 |
+ |
integer, intent(in):: ngroup |
72 |
+ |
integer, dimension(nLocal),intent(in) :: groupList |
73 |
+ |
integer, dimension(ngroup),intent(in) :: groupStart |
74 |
+ |
|
75 |
|
#ifdef IS_MPI |
76 |
|
integer, allocatable, dimension(:) :: c_idents_Row |
77 |
|
integer, allocatable, dimension(:) :: c_idents_Col |
88 |
|
nGlobal = CnGlobal |
89 |
|
|
90 |
|
thisSim = setThisSim |
91 |
– |
rcut2 = thisSim%rcut * thisSim%rcut |
92 |
– |
rcut6 = rcut2 * rcut2 * rcut2 |
93 |
– |
rlist2 = thisSim%rlist * thisSim%rlist |
91 |
|
|
92 |
|
nExcludes_Global = CnGlobalExcludes |
93 |
|
nExcludes_Local = CnLocalExcludes |
150 |
|
deallocate(c_idents_Row) |
151 |
|
endif |
152 |
|
|
153 |
< |
#else |
153 |
> |
#endif |
154 |
> |
|
155 |
> |
! We build the local atid's for both mpi and nonmpi |
156 |
|
do i = 1, nLocal |
157 |
|
|
158 |
|
me = getFirstMatchingElement(atypes, "c_ident", c_idents(i)) |
159 |
|
atid(i) = me |
160 |
|
|
161 |
|
enddo |
163 |
– |
#endif |
162 |
|
|
163 |
|
|
164 |
|
|
165 |
+ |
|
166 |
|
do i = 1, nExcludes_Local |
167 |
|
excludesLocal(1,i) = CexcludesLocal(1,i) |
168 |
|
excludesLocal(2,i) = CexcludesLocal(2,i) |
196 |
|
return |
197 |
|
end subroutine setBox |
198 |
|
|
200 |
– |
subroutine setRcut(new_rcut, status) |
201 |
– |
real(kind = dp) :: new_rcut |
202 |
– |
integer :: myStatus, status |
203 |
– |
thisSim%rcut = new_rcut |
204 |
– |
rcut2 = thisSim%rcut * thisSim%rcut |
205 |
– |
rcut6 = rcut2 * rcut2 * rcut2 |
206 |
– |
status = 0 |
207 |
– |
return |
208 |
– |
end subroutine setRcut |
209 |
– |
|
210 |
– |
subroutine getRcut(thisrcut,rc2,rc6,status) |
211 |
– |
real( kind = dp ), intent(out) :: thisrcut |
212 |
– |
real( kind = dp ), intent(out), optional :: rc2 |
213 |
– |
real( kind = dp ), intent(out), optional :: rc6 |
214 |
– |
integer, optional :: status |
215 |
– |
|
216 |
– |
if (present(status)) status = 0 |
217 |
– |
|
218 |
– |
if (.not.simulation_setup_complete ) then |
219 |
– |
if (present(status)) status = -1 |
220 |
– |
return |
221 |
– |
end if |
222 |
– |
|
223 |
– |
thisrcut = thisSim%rcut |
224 |
– |
if(present(rc2)) rc2 = rcut2 |
225 |
– |
if(present(rc6)) rc6 = rcut6 |
226 |
– |
end subroutine getRcut |
227 |
– |
|
228 |
– |
subroutine getRlist(thisrlist,rl2,status) |
229 |
– |
real( kind = dp ), intent(out) :: thisrlist |
230 |
– |
real( kind = dp ), intent(out), optional :: rl2 |
231 |
– |
|
232 |
– |
integer, optional :: status |
233 |
– |
|
234 |
– |
if (present(status)) status = 0 |
235 |
– |
|
236 |
– |
if (.not.simulation_setup_complete ) then |
237 |
– |
if (present(status)) status = -1 |
238 |
– |
return |
239 |
– |
end if |
240 |
– |
|
241 |
– |
thisrlist = thisSim%rlist |
242 |
– |
if(present(rl2)) rl2 = rlist2 |
243 |
– |
end subroutine getRlist |
244 |
– |
|
245 |
– |
function getRrf() result(rrf) |
246 |
– |
real( kind = dp ) :: rrf |
247 |
– |
rrf = thisSim%rrf |
248 |
– |
write(*,*) 'getRrf = ', rrf |
249 |
– |
end function getRrf |
250 |
– |
|
251 |
– |
function getRt() result(rt) |
252 |
– |
real( kind = dp ) :: rt |
253 |
– |
rt = thisSim%rt |
254 |
– |
write(*,*) 'getRt = ', rt |
255 |
– |
end function getRt |
256 |
– |
|
199 |
|
function getDielect() result(dielect) |
200 |
|
real( kind = dp ) :: dielect |
201 |
|
dielect = thisSim%dielect |
216 |
|
doesit = thisSim%SIM_uses_sticky |
217 |
|
end function SimUsesSticky |
218 |
|
|
219 |
+ |
function SimUsesCharges() result(doesit) |
220 |
+ |
logical :: doesit |
221 |
+ |
doesit = thisSim%SIM_uses_charges |
222 |
+ |
end function SimUsesCharges |
223 |
+ |
|
224 |
|
function SimUsesDipoles() result(doesit) |
225 |
|
logical :: doesit |
226 |
|
doesit = thisSim%SIM_uses_dipoles |