| 6 |
|
use force_globals |
| 7 |
|
use vector_class |
| 8 |
|
use atype_module |
| 9 |
– |
use lj |
| 9 |
|
#ifdef IS_MPI |
| 10 |
|
use mpiSimulation |
| 11 |
|
#endif |
| 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 |
| 68 |
|
contains |
| 69 |
|
|
| 70 |
|
subroutine SimulationSetup(setThisSim, nComponents, c_idents, & |
| 71 |
< |
CnLocalExcludes, CexcludesLocal, CnGlobalExcludes, CexcludesGlobal, & |
| 71 |
> |
CnLocalExcludes, CexcludesLocal, CnGlobalExcludes, CexcludesGlobal, CmolMembership, & |
| 72 |
|
status) |
| 73 |
|
|
| 74 |
|
type (simtype) :: setThisSim |
| 79 |
|
integer, dimension(2,CnLocalExcludes), intent(in) :: CexcludesLocal |
| 80 |
|
integer :: CnGlobalExcludes |
| 81 |
|
integer, dimension(CnGlobalExcludes), intent(in) :: CexcludesGlobal |
| 82 |
+ |
integer, dimension(nComponents),intent(in) :: CmolMembership |
| 83 |
|
!! Result status, success = 0, status = -1 |
| 84 |
|
integer, intent(out) :: status |
| 85 |
|
integer :: i, me, thisStat, alloc_stat, myNode |
| 106 |
|
|
| 107 |
|
call InitializeForceGlobals(natoms, thisStat) |
| 108 |
|
if (thisStat /= 0) then |
| 109 |
+ |
write(default_error,*) "SimSetup: InitializeForceGlobals error" |
| 110 |
|
status = -1 |
| 111 |
|
return |
| 112 |
|
endif |
| 113 |
|
|
| 114 |
|
call InitializeSimGlobals(thisStat) |
| 115 |
|
if (thisStat /= 0) then |
| 116 |
+ |
write(default_error,*) "SimSetup: InitializeSimGlobals error" |
| 117 |
|
status = -1 |
| 118 |
|
return |
| 119 |
|
endif |
| 171 |
|
enddo |
| 172 |
|
#endif |
| 173 |
|
|
| 171 |
– |
!! Create neighbor lists |
| 172 |
– |
call expandNeighborList(nComponents, thisStat) |
| 173 |
– |
if (thisStat /= 0) then |
| 174 |
– |
status = -1 |
| 175 |
– |
return |
| 176 |
– |
endif |
| 174 |
|
|
| 175 |
|
|
| 176 |
|
do i = 1, nExcludes_Local |
| 181 |
|
do i = 1, nExcludes_Global |
| 182 |
|
excludesGlobal(i) = CexcludesGlobal(i) |
| 183 |
|
enddo |
| 184 |
< |
|
| 184 |
> |
|
| 185 |
> |
molMemberShipList = CmolMembership |
| 186 |
> |
|
| 187 |
|
if (status == 0) simulation_setup_complete = .true. |
| 188 |
|
|
| 189 |
|
end subroutine SimulationSetup |
| 195 |
|
thisSim%box = new_box_size |
| 196 |
|
box = thisSim%box |
| 197 |
|
|
| 199 |
– |
smallest = 1 |
| 200 |
– |
do i = 2, 3 |
| 201 |
– |
if (new_box_size(i) .lt. new_box_size(smallest)) smallest = i |
| 202 |
– |
end do |
| 203 |
– |
if (thisSim%rcut .gt. 0.5_dp * new_box_size(smallest)) & |
| 204 |
– |
call setRcut(0.5_dp * new_box_size(smallest), status) |
| 198 |
|
return |
| 199 |
|
end subroutine setBox_3d |
| 200 |
|
|
| 203 |
|
real(kind=dp) :: new_box_size |
| 204 |
|
thisSim%box(dim) = new_box_size |
| 205 |
|
box(dim) = thisSim%box(dim) |
| 213 |
– |
if (thisSim%rcut .gt. 0.5_dp * new_box_size) & |
| 214 |
– |
call setRcut(0.5_dp * new_box_size, status) |
| 206 |
|
end subroutine setBox_1d |
| 207 |
|
|
| 208 |
|
subroutine setRcut(new_rcut, status) |
| 211 |
|
thisSim%rcut = new_rcut |
| 212 |
|
rcut2 = thisSim%rcut * thisSim%rcut |
| 213 |
|
rcut6 = rcut2 * rcut2 * rcut2 |
| 223 |
– |
myStatus = 0 |
| 224 |
– |
call LJ_new_rcut(new_rcut, myStatus) |
| 225 |
– |
if (myStatus .ne. 0) then |
| 226 |
– |
write(default_error, *) 'LJ module refused our rcut!' |
| 227 |
– |
status = -1 |
| 228 |
– |
return |
| 229 |
– |
endif |
| 214 |
|
status = 0 |
| 215 |
|
return |
| 216 |
|
end subroutine setRcut |
| 348 |
|
thisStat = -1 |
| 349 |
|
return |
| 350 |
|
endif |
| 351 |
+ |
|
| 352 |
+ |
allocate(molMembershipList(getNlocal()), stat=alloc_stat) |
| 353 |
+ |
if (alloc_stat /= 0 ) then |
| 354 |
+ |
thisStat = -1 |
| 355 |
+ |
return |
| 356 |
+ |
endif |
| 357 |
|
|
| 358 |
|
end subroutine InitializeSimGlobals |
| 359 |
|
|
| 363 |
|
|
| 364 |
|
if (allocated(excludesGlobal)) deallocate(excludesGlobal) |
| 365 |
|
if (allocated(excludesLocal)) deallocate(excludesLocal) |
| 366 |
< |
|
| 366 |
> |
if (allocated(molMembershipList)) deallocate(molMembershipList) |
| 367 |
|
end subroutine FreeSimGlobals |
| 368 |
|
|
| 369 |
|
pure function getNlocal() result(nlocal) |