25 |
|
integer, public, save :: nExcludes_Local = 0 |
26 |
|
integer, allocatable, dimension(:,:), public :: excludesLocal |
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 |
67 |
|
|
68 |
|
contains |
69 |
|
|
70 |
< |
subroutine SimulationSetup(setThisSim, nComponents, c_idents, & |
70 |
> |
subroutine SimulationSetup(setThisSim, nGlobal, nLocal, c_idents, & |
71 |
|
CnLocalExcludes, CexcludesLocal, CnGlobalExcludes, CexcludesGlobal, & |
72 |
+ |
CmolMembership, & |
73 |
|
status) |
74 |
|
|
75 |
|
type (simtype) :: setThisSim |
76 |
< |
integer, intent(inout) :: nComponents |
77 |
< |
integer, dimension(nComponents),intent(inout) :: c_idents |
76 |
> |
integer, intent(inout) :: nGlobal, nLocal |
77 |
> |
integer, dimension(nLocal),intent(inout) :: c_idents |
78 |
|
|
79 |
|
integer :: CnLocalExcludes |
80 |
|
integer, dimension(2,CnLocalExcludes), intent(in) :: CexcludesLocal |
81 |
|
integer :: CnGlobalExcludes |
82 |
|
integer, dimension(CnGlobalExcludes), intent(in) :: CexcludesGlobal |
83 |
+ |
integer, dimension(nGlobal),intent(in) :: CmolMembership |
84 |
|
!! Result status, success = 0, status = -1 |
85 |
|
integer, intent(out) :: status |
86 |
|
integer :: i, me, thisStat, alloc_stat, myNode |
96 |
|
|
97 |
|
! copy C struct into fortran type |
98 |
|
thisSim = setThisSim |
99 |
< |
natoms = nComponents |
99 |
> |
natoms = nLocal |
100 |
|
rcut2 = thisSim%rcut * thisSim%rcut |
101 |
|
rcut6 = rcut2 * rcut2 * rcut2 |
102 |
|
rlist2 = thisSim%rlist * thisSim%rlist |
107 |
|
|
108 |
|
call InitializeForceGlobals(natoms, thisStat) |
109 |
|
if (thisStat /= 0) then |
110 |
+ |
write(default_error,*) "SimSetup: InitializeForceGlobals error" |
111 |
|
status = -1 |
112 |
|
return |
113 |
|
endif |
114 |
|
|
115 |
|
call InitializeSimGlobals(thisStat) |
116 |
|
if (thisStat /= 0) then |
117 |
+ |
write(default_error,*) "SimSetup: InitializeSimGlobals error" |
118 |
|
status = -1 |
119 |
|
return |
120 |
|
endif |
164 |
|
endif |
165 |
|
|
166 |
|
#else |
167 |
< |
do i = 1, nComponents |
167 |
> |
do i = 1, nLocal |
168 |
|
|
169 |
|
me = getFirstMatchingElement(atypes, "c_ident", c_idents(i)) |
170 |
|
atid(i) = me |
172 |
|
enddo |
173 |
|
#endif |
174 |
|
|
170 |
– |
!! Create neighbor lists |
171 |
– |
call expandNeighborList(nComponents, thisStat) |
172 |
– |
if (thisStat /= 0) then |
173 |
– |
status = -1 |
174 |
– |
return |
175 |
– |
endif |
175 |
|
|
176 |
|
|
177 |
|
do i = 1, nExcludes_Local |
183 |
|
excludesGlobal(i) = CexcludesGlobal(i) |
184 |
|
enddo |
185 |
|
|
186 |
+ |
do i = 1, nGlobal |
187 |
+ |
molMemberShipList(i) = CmolMembership(i) |
188 |
+ |
! write(0,*) 'molMembershipList(',i,') = ', molMemberShipList(i) |
189 |
+ |
enddo |
190 |
+ |
|
191 |
|
if (status == 0) simulation_setup_complete = .true. |
192 |
|
|
193 |
|
end subroutine SimulationSetup |
352 |
|
thisStat = -1 |
353 |
|
return |
354 |
|
endif |
355 |
+ |
|
356 |
+ |
allocate(molMembershipList(getNlocal()), stat=alloc_stat) |
357 |
+ |
if (alloc_stat /= 0 ) then |
358 |
+ |
thisStat = -1 |
359 |
+ |
return |
360 |
+ |
endif |
361 |
|
|
362 |
|
end subroutine InitializeSimGlobals |
363 |
|
|
364 |
|
subroutine FreeSimGlobals() |
365 |
|
|
366 |
|
!We free in the opposite order in which we allocate in. |
367 |
< |
|
367 |
> |
|
368 |
> |
if (allocated(molMembershipList)) deallocate(molMembershipList) |
369 |
|
if (allocated(excludesGlobal)) deallocate(excludesGlobal) |
370 |
|
if (allocated(excludesLocal)) deallocate(excludesLocal) |
371 |
|
|