| 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 |
| 33 |
< |
real(kind=dp), public, dimension(3), save :: box |
| 34 |
< |
|
| 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 :: setBox_3d |
| 40 |
– |
public :: getBox |
| 41 |
– |
public :: setRcut |
| 42 |
– |
public :: getRcut |
| 43 |
– |
public :: getRlist |
| 44 |
– |
public :: getRrf |
| 45 |
– |
public :: getRt |
| 36 |
|
public :: getDielect |
| 37 |
|
public :: SimUsesPBC |
| 38 |
|
public :: SimUsesLJ |
| 39 |
+ |
public :: SimUsesCharges |
| 40 |
|
public :: SimUsesDipoles |
| 41 |
|
public :: SimUsesSticky |
| 42 |
|
public :: SimUsesRF |
| 45 |
|
public :: SimRequiresPrepairCalc |
| 46 |
|
public :: SimRequiresPostpairCalc |
| 47 |
|
public :: SimUsesDirectionalAtoms |
| 57 |
– |
|
| 58 |
– |
interface getBox |
| 59 |
– |
module procedure getBox_3d |
| 60 |
– |
module procedure getBox_1d |
| 61 |
– |
end interface |
| 48 |
|
|
| 63 |
– |
interface setBox |
| 64 |
– |
module procedure setBox_3d |
| 65 |
– |
module procedure setBox_1d |
| 66 |
– |
end interface |
| 67 |
– |
|
| 49 |
|
contains |
| 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 |
| 103 |
– |
rcut2 = thisSim%rcut * thisSim%rcut |
| 104 |
– |
rcut6 = rcut2 * rcut2 * rcut2 |
| 105 |
– |
rlist2 = thisSim%rlist * thisSim%rlist |
| 106 |
– |
box = thisSim%box |
| 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 |
| 176 |
– |
#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) |
| 180 |
|
|
| 181 |
|
end subroutine SimulationSetup |
| 182 |
|
|
| 183 |
< |
subroutine setBox_3d(new_box_size) |
| 184 |
< |
real(kind=dp), dimension(3) :: new_box_size |
| 183 |
> |
subroutine setBox(cHmat, cHmatInv, cBoxIsOrthorhombic) |
| 184 |
> |
real(kind=dp), dimension(3,3) :: cHmat, cHmatInv |
| 185 |
> |
integer :: cBoxIsOrthorhombic |
| 186 |
|
integer :: smallest, status, i |
| 187 |
< |
|
| 188 |
< |
thisSim%box = new_box_size |
| 189 |
< |
box = thisSim%box |
| 190 |
< |
|
| 187 |
> |
|
| 188 |
> |
Hmat = cHmat |
| 189 |
> |
HmatInv = cHmatInv |
| 190 |
> |
if (cBoxIsOrthorhombic .eq. 0 ) then |
| 191 |
> |
boxIsOrthorhombic = .false. |
| 192 |
> |
else |
| 193 |
> |
boxIsOrthorhombic = .true. |
| 194 |
> |
endif |
| 195 |
> |
|
| 196 |
|
return |
| 197 |
< |
end subroutine setBox_3d |
| 206 |
< |
|
| 207 |
< |
subroutine setBox_1d(dim, new_box_size) |
| 208 |
< |
integer :: dim, status |
| 209 |
< |
real(kind=dp) :: new_box_size |
| 210 |
< |
thisSim%box(dim) = new_box_size |
| 211 |
< |
box(dim) = thisSim%box(dim) |
| 212 |
< |
end subroutine setBox_1d |
| 213 |
< |
|
| 214 |
< |
subroutine setRcut(new_rcut, status) |
| 215 |
< |
real(kind = dp) :: new_rcut |
| 216 |
< |
integer :: myStatus, status |
| 217 |
< |
thisSim%rcut = new_rcut |
| 218 |
< |
rcut2 = thisSim%rcut * thisSim%rcut |
| 219 |
< |
rcut6 = rcut2 * rcut2 * rcut2 |
| 220 |
< |
status = 0 |
| 221 |
< |
return |
| 222 |
< |
end subroutine setRcut |
| 197 |
> |
end subroutine setBox |
| 198 |
|
|
| 224 |
– |
function getBox_3d() result(thisBox) |
| 225 |
– |
real( kind = dp ), dimension(3) :: thisBox |
| 226 |
– |
thisBox = thisSim%box |
| 227 |
– |
end function getBox_3d |
| 228 |
– |
|
| 229 |
– |
function getBox_1d(dim) result(thisBox) |
| 230 |
– |
integer, intent(in) :: dim |
| 231 |
– |
real( kind = dp ) :: thisBox |
| 232 |
– |
|
| 233 |
– |
thisBox = thisSim%box(dim) |
| 234 |
– |
end function getBox_1d |
| 235 |
– |
|
| 236 |
– |
subroutine getRcut(thisrcut,rc2,rc6,status) |
| 237 |
– |
real( kind = dp ), intent(out) :: thisrcut |
| 238 |
– |
real( kind = dp ), intent(out), optional :: rc2 |
| 239 |
– |
real( kind = dp ), intent(out), optional :: rc6 |
| 240 |
– |
integer, optional :: status |
| 241 |
– |
|
| 242 |
– |
if (present(status)) status = 0 |
| 243 |
– |
|
| 244 |
– |
if (.not.simulation_setup_complete ) then |
| 245 |
– |
if (present(status)) status = -1 |
| 246 |
– |
return |
| 247 |
– |
end if |
| 248 |
– |
|
| 249 |
– |
thisrcut = thisSim%rcut |
| 250 |
– |
if(present(rc2)) rc2 = rcut2 |
| 251 |
– |
if(present(rc6)) rc6 = rcut6 |
| 252 |
– |
end subroutine getRcut |
| 253 |
– |
|
| 254 |
– |
subroutine getRlist(thisrlist,rl2,status) |
| 255 |
– |
real( kind = dp ), intent(out) :: thisrlist |
| 256 |
– |
real( kind = dp ), intent(out), optional :: rl2 |
| 257 |
– |
|
| 258 |
– |
integer, optional :: status |
| 259 |
– |
|
| 260 |
– |
if (present(status)) status = 0 |
| 261 |
– |
|
| 262 |
– |
if (.not.simulation_setup_complete ) then |
| 263 |
– |
if (present(status)) status = -1 |
| 264 |
– |
return |
| 265 |
– |
end if |
| 266 |
– |
|
| 267 |
– |
thisrlist = thisSim%rlist |
| 268 |
– |
if(present(rl2)) rl2 = rlist2 |
| 269 |
– |
end subroutine getRlist |
| 270 |
– |
|
| 271 |
– |
function getRrf() result(rrf) |
| 272 |
– |
real( kind = dp ) :: rrf |
| 273 |
– |
rrf = thisSim%rrf |
| 274 |
– |
write(*,*) 'getRrf = ', rrf, thisSim%rrf |
| 275 |
– |
end function getRrf |
| 276 |
– |
|
| 277 |
– |
function getRt() result(rt) |
| 278 |
– |
real( kind = dp ) :: rt |
| 279 |
– |
rt = thisSim%rt |
| 280 |
– |
end function getRt |
| 281 |
– |
|
| 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 |