1 |
+ |
!! |
2 |
+ |
!! Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
+ |
!! |
4 |
+ |
!! The University of Notre Dame grants you ("Licensee") a |
5 |
+ |
!! non-exclusive, royalty free, license to use, modify and |
6 |
+ |
!! redistribute this software in source and binary code form, provided |
7 |
+ |
!! that the following conditions are met: |
8 |
+ |
!! |
9 |
+ |
!! 1. Acknowledgement of the program authors must be made in any |
10 |
+ |
!! publication of scientific results based in part on use of the |
11 |
+ |
!! program. An acceptable form of acknowledgement is citation of |
12 |
+ |
!! the article in which the program was described (Matthew |
13 |
+ |
!! A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
+ |
!! J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
+ |
!! Parallel Simulation Engine for Molecular Dynamics," |
16 |
+ |
!! J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
+ |
!! |
18 |
+ |
!! 2. Redistributions of source code must retain the above copyright |
19 |
+ |
!! notice, this list of conditions and the following disclaimer. |
20 |
+ |
!! |
21 |
+ |
!! 3. Redistributions in binary form must reproduce the above copyright |
22 |
+ |
!! notice, this list of conditions and the following disclaimer in the |
23 |
+ |
!! documentation and/or other materials provided with the |
24 |
+ |
!! distribution. |
25 |
+ |
!! |
26 |
+ |
!! This software is provided "AS IS," without a warranty of any |
27 |
+ |
!! kind. All express or implied conditions, representations and |
28 |
+ |
!! warranties, including any implied warranty of merchantability, |
29 |
+ |
!! fitness for a particular purpose or non-infringement, are hereby |
30 |
+ |
!! excluded. The University of Notre Dame and its licensors shall not |
31 |
+ |
!! be liable for any damages suffered by licensee as a result of |
32 |
+ |
!! using, modifying or distributing the software or its |
33 |
+ |
!! derivatives. In no event will the University of Notre Dame or its |
34 |
+ |
!! licensors be liable for any lost revenue, profit or data, or for |
35 |
+ |
!! direct, indirect, special, consequential, incidental or punitive |
36 |
+ |
!! damages, however caused and regardless of the theory of liability, |
37 |
+ |
!! arising out of the use of or inability to use software, even if the |
38 |
+ |
!! University of Notre Dame has been advised of the possibility of |
39 |
+ |
!! such damages. |
40 |
+ |
!! |
41 |
+ |
|
42 |
|
!! Fortran interface to C entry plug. |
43 |
|
|
44 |
|
module simulation |
84 |
|
|
85 |
|
real(kind=dp), public, dimension(3,3), save :: Hmat, HmatInv |
86 |
|
logical, public, save :: boxIsOrthorhombic |
87 |
< |
|
87 |
> |
|
88 |
|
public :: SimulationSetup |
89 |
|
public :: getNlocal |
90 |
|
public :: setBox |
91 |
|
public :: getDielect |
92 |
|
public :: SimUsesPBC |
93 |
< |
public :: SimUsesLJ |
93 |
> |
|
94 |
> |
public :: SimUsesDirectionalAtoms |
95 |
> |
public :: SimUsesLennardJones |
96 |
> |
public :: SimUsesElectrostatics |
97 |
|
public :: SimUsesCharges |
98 |
|
public :: SimUsesDipoles |
99 |
|
public :: SimUsesSticky |
100 |
< |
public :: SimUsesRF |
101 |
< |
public :: SimUsesGB |
100 |
> |
public :: SimUsesStickyPower |
101 |
> |
public :: SimUsesGayBerne |
102 |
|
public :: SimUsesEAM |
103 |
+ |
public :: SimUsesShapes |
104 |
+ |
public :: SimUsesFLARB |
105 |
+ |
public :: SimUsesRF |
106 |
|
public :: SimRequiresPrepairCalc |
107 |
|
public :: SimRequiresPostpairCalc |
108 |
< |
public :: SimUsesDirectionalAtoms |
109 |
< |
|
108 |
> |
|
109 |
> |
|
110 |
|
contains |
111 |
< |
|
111 |
> |
|
112 |
|
subroutine SimulationSetup(setThisSim, CnGlobal, CnLocal, c_idents, & |
113 |
|
CnLocalExcludes, CexcludesLocal, CnGlobalExcludes, CexcludesGlobal, & |
114 |
|
CmolMembership, Cmfact, CnGroups, CglobalGroupMembership, & |
181 |
|
nGroupsInRow = getNgroupsInRow(plan_group_row) |
182 |
|
nGroupsInCol = getNgroupsInCol(plan_group_col) |
183 |
|
mynode = getMyNode() |
184 |
< |
|
184 |
> |
|
185 |
|
allocate(c_idents_Row(nAtomsInRow),stat=alloc_stat) |
186 |
|
if (alloc_stat /= 0 ) then |
187 |
|
status = -1 |
214 |
|
if (allocated(c_idents_Row)) then |
215 |
|
deallocate(c_idents_Row) |
216 |
|
endif |
217 |
< |
|
217 |
> |
|
218 |
|
#endif |
219 |
|
|
220 |
|
#ifdef IS_MPI |
253 |
|
status = -1 |
254 |
|
return |
255 |
|
endif |
256 |
< |
|
256 |
> |
|
257 |
|
glPointer = 1 |
258 |
|
|
259 |
|
do i = 1, nGroupsInRow |
292 |
|
|
293 |
|
call gather(mfactLocal, mfactRow, plan_atom_row) |
294 |
|
call gather(mfactLocal, mfactCol, plan_atom_col) |
295 |
< |
|
295 |
> |
|
296 |
|
if (allocated(mfactLocal)) then |
297 |
|
deallocate(mfactLocal) |
298 |
|
end if |
352 |
|
mfactRow(i) = Cmfact(i) |
353 |
|
mfactCol(i) = Cmfact(i) |
354 |
|
end do |
355 |
< |
|
355 |
> |
|
356 |
|
#endif |
357 |
|
|
358 |
|
|
359 |
< |
! We build the local atid's for both mpi and nonmpi |
359 |
> |
! We build the local atid's for both mpi and nonmpi |
360 |
|
do i = 1, nLocal |
361 |
< |
|
361 |
> |
|
362 |
|
me = getFirstMatchingElement(atypes, "c_ident", c_idents(i)) |
363 |
|
atid(i) = me |
364 |
< |
|
364 |
> |
|
365 |
|
enddo |
366 |
|
|
367 |
|
do i = 1, nExcludes_Local |
384 |
|
#ifdef IS_MPI |
385 |
|
do j = 1, nAtomsInRow |
386 |
|
#else |
387 |
< |
do j = 1, nLocal |
387 |
> |
do j = 1, nLocal |
388 |
|
#endif |
389 |
< |
nSkipsForAtom(j) = 0 |
389 |
> |
nSkipsForAtom(j) = 0 |
390 |
|
#ifdef IS_MPI |
391 |
< |
id1 = AtomRowToGlobal(j) |
391 |
> |
id1 = AtomRowToGlobal(j) |
392 |
|
#else |
393 |
< |
id1 = j |
393 |
> |
id1 = j |
394 |
|
#endif |
395 |
< |
do i = 1, nExcludes_Local |
396 |
< |
if (excludesLocal(1,i) .eq. id1 ) then |
397 |
< |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
395 |
> |
do i = 1, nExcludes_Local |
396 |
> |
if (excludesLocal(1,i) .eq. id1 ) then |
397 |
> |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
398 |
|
|
399 |
< |
if (nSkipsForAtom(j) .gt. maxSkipsForAtom) then |
400 |
< |
maxSkipsForAtom = nSkipsForAtom(j) |
399 |
> |
if (nSkipsForAtom(j) .gt. maxSkipsForAtom) then |
400 |
> |
maxSkipsForAtom = nSkipsForAtom(j) |
401 |
> |
endif |
402 |
|
endif |
403 |
< |
endif |
404 |
< |
if (excludesLocal(2,i) .eq. id1 ) then |
357 |
< |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
403 |
> |
if (excludesLocal(2,i) .eq. id1 ) then |
404 |
> |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
405 |
|
|
406 |
< |
if (nSkipsForAtom(j) .gt. maxSkipsForAtom) then |
407 |
< |
maxSkipsForAtom = nSkipsForAtom(j) |
406 |
> |
if (nSkipsForAtom(j) .gt. maxSkipsForAtom) then |
407 |
> |
maxSkipsForAtom = nSkipsForAtom(j) |
408 |
> |
endif |
409 |
|
endif |
410 |
< |
endif |
411 |
< |
end do |
364 |
< |
enddo |
410 |
> |
end do |
411 |
> |
enddo |
412 |
|
|
413 |
|
#ifdef IS_MPI |
414 |
< |
allocate(skipsForAtom(nAtomsInRow, maxSkipsForAtom), stat=alloc_stat) |
414 |
> |
allocate(skipsForAtom(nAtomsInRow, maxSkipsForAtom), stat=alloc_stat) |
415 |
|
#else |
416 |
< |
allocate(skipsForAtom(nLocal, maxSkipsForAtom), stat=alloc_stat) |
416 |
> |
allocate(skipsForAtom(nLocal, maxSkipsForAtom), stat=alloc_stat) |
417 |
|
#endif |
418 |
< |
if (alloc_stat /= 0 ) then |
419 |
< |
write(*,*) 'Could not allocate skipsForAtom array' |
420 |
< |
return |
421 |
< |
endif |
418 |
> |
if (alloc_stat /= 0 ) then |
419 |
> |
write(*,*) 'Could not allocate skipsForAtom array' |
420 |
> |
return |
421 |
> |
endif |
422 |
|
|
423 |
|
#ifdef IS_MPI |
424 |
< |
do j = 1, nAtomsInRow |
424 |
> |
do j = 1, nAtomsInRow |
425 |
|
#else |
426 |
< |
do j = 1, nLocal |
426 |
> |
do j = 1, nLocal |
427 |
|
#endif |
428 |
< |
nSkipsForAtom(j) = 0 |
428 |
> |
nSkipsForAtom(j) = 0 |
429 |
|
#ifdef IS_MPI |
430 |
< |
id1 = AtomRowToGlobal(j) |
430 |
> |
id1 = AtomRowToGlobal(j) |
431 |
|
#else |
432 |
< |
id1 = j |
432 |
> |
id1 = j |
433 |
|
#endif |
434 |
< |
do i = 1, nExcludes_Local |
435 |
< |
if (excludesLocal(1,i) .eq. id1 ) then |
436 |
< |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
437 |
< |
! exclude lists have global ID's so this line is |
438 |
< |
! the same in MPI and non-MPI |
439 |
< |
id2 = excludesLocal(2,i) |
440 |
< |
skipsForAtom(j, nSkipsForAtom(j)) = id2 |
441 |
< |
endif |
442 |
< |
if (excludesLocal(2, i) .eq. id1 ) then |
443 |
< |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
444 |
< |
! exclude lists have global ID's so this line is |
445 |
< |
! the same in MPI and non-MPI |
446 |
< |
id2 = excludesLocal(1,i) |
447 |
< |
skipsForAtom(j, nSkipsForAtom(j)) = id2 |
448 |
< |
endif |
449 |
< |
end do |
450 |
< |
enddo |
404 |
< |
|
405 |
< |
do i = 1, nExcludes_Global |
406 |
< |
excludesGlobal(i) = CexcludesGlobal(i) |
407 |
< |
enddo |
434 |
> |
do i = 1, nExcludes_Local |
435 |
> |
if (excludesLocal(1,i) .eq. id1 ) then |
436 |
> |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
437 |
> |
! exclude lists have global ID's so this line is |
438 |
> |
! the same in MPI and non-MPI |
439 |
> |
id2 = excludesLocal(2,i) |
440 |
> |
skipsForAtom(j, nSkipsForAtom(j)) = id2 |
441 |
> |
endif |
442 |
> |
if (excludesLocal(2, i) .eq. id1 ) then |
443 |
> |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
444 |
> |
! exclude lists have global ID's so this line is |
445 |
> |
! the same in MPI and non-MPI |
446 |
> |
id2 = excludesLocal(1,i) |
447 |
> |
skipsForAtom(j, nSkipsForAtom(j)) = id2 |
448 |
> |
endif |
449 |
> |
end do |
450 |
> |
enddo |
451 |
|
|
452 |
< |
do i = 1, nGlobal |
453 |
< |
molMemberShipList(i) = CmolMembership(i) |
454 |
< |
enddo |
412 |
< |
|
413 |
< |
if (status == 0) simulation_setup_complete = .true. |
414 |
< |
|
415 |
< |
end subroutine SimulationSetup |
416 |
< |
|
417 |
< |
subroutine setBox(cHmat, cHmatInv, cBoxIsOrthorhombic) |
418 |
< |
real(kind=dp), dimension(3,3) :: cHmat, cHmatInv |
419 |
< |
integer :: cBoxIsOrthorhombic |
420 |
< |
integer :: smallest, status, i |
421 |
< |
|
422 |
< |
Hmat = cHmat |
423 |
< |
HmatInv = cHmatInv |
424 |
< |
if (cBoxIsOrthorhombic .eq. 0 ) then |
425 |
< |
boxIsOrthorhombic = .false. |
426 |
< |
else |
427 |
< |
boxIsOrthorhombic = .true. |
428 |
< |
endif |
429 |
< |
|
430 |
< |
return |
431 |
< |
end subroutine setBox |
452 |
> |
do i = 1, nExcludes_Global |
453 |
> |
excludesGlobal(i) = CexcludesGlobal(i) |
454 |
> |
enddo |
455 |
|
|
456 |
< |
function getDielect() result(dielect) |
457 |
< |
real( kind = dp ) :: dielect |
458 |
< |
dielect = thisSim%dielect |
436 |
< |
end function getDielect |
437 |
< |
|
438 |
< |
function SimUsesPBC() result(doesit) |
439 |
< |
logical :: doesit |
440 |
< |
doesit = thisSim%SIM_uses_PBC |
441 |
< |
end function SimUsesPBC |
456 |
> |
do i = 1, nGlobal |
457 |
> |
molMemberShipList(i) = CmolMembership(i) |
458 |
> |
enddo |
459 |
|
|
460 |
< |
function SimUsesLJ() result(doesit) |
444 |
< |
logical :: doesit |
445 |
< |
doesit = thisSim%SIM_uses_LJ |
446 |
< |
end function SimUsesLJ |
460 |
> |
if (status == 0) simulation_setup_complete = .true. |
461 |
|
|
462 |
< |
function SimUsesSticky() result(doesit) |
449 |
< |
logical :: doesit |
450 |
< |
doesit = thisSim%SIM_uses_sticky |
451 |
< |
end function SimUsesSticky |
462 |
> |
end subroutine SimulationSetup |
463 |
|
|
464 |
< |
function SimUsesCharges() result(doesit) |
465 |
< |
logical :: doesit |
466 |
< |
doesit = thisSim%SIM_uses_charges |
467 |
< |
end function SimUsesCharges |
464 |
> |
subroutine setBox(cHmat, cHmatInv, cBoxIsOrthorhombic) |
465 |
> |
real(kind=dp), dimension(3,3) :: cHmat, cHmatInv |
466 |
> |
integer :: cBoxIsOrthorhombic |
467 |
> |
integer :: smallest, status, i |
468 |
|
|
469 |
< |
function SimUsesDipoles() result(doesit) |
470 |
< |
logical :: doesit |
471 |
< |
doesit = thisSim%SIM_uses_dipoles |
472 |
< |
end function SimUsesDipoles |
469 |
> |
Hmat = cHmat |
470 |
> |
HmatInv = cHmatInv |
471 |
> |
if (cBoxIsOrthorhombic .eq. 0 ) then |
472 |
> |
boxIsOrthorhombic = .false. |
473 |
> |
else |
474 |
> |
boxIsOrthorhombic = .true. |
475 |
> |
endif |
476 |
|
|
477 |
< |
function SimUsesRF() result(doesit) |
478 |
< |
logical :: doesit |
465 |
< |
doesit = thisSim%SIM_uses_RF |
466 |
< |
end function SimUsesRF |
477 |
> |
return |
478 |
> |
end subroutine setBox |
479 |
|
|
480 |
< |
function SimUsesGB() result(doesit) |
481 |
< |
logical :: doesit |
482 |
< |
doesit = thisSim%SIM_uses_GB |
483 |
< |
end function SimUsesGB |
480 |
> |
function getDielect() result(dielect) |
481 |
> |
real( kind = dp ) :: dielect |
482 |
> |
dielect = thisSim%dielect |
483 |
> |
end function getDielect |
484 |
|
|
485 |
< |
function SimUsesEAM() result(doesit) |
486 |
< |
logical :: doesit |
487 |
< |
doesit = thisSim%SIM_uses_EAM |
488 |
< |
end function SimUsesEAM |
485 |
> |
function SimUsesPBC() result(doesit) |
486 |
> |
logical :: doesit |
487 |
> |
doesit = thisSim%SIM_uses_PBC |
488 |
> |
end function SimUsesPBC |
489 |
|
|
490 |
< |
function SimUsesDirectionalAtoms() result(doesit) |
491 |
< |
logical :: doesit |
492 |
< |
doesit = thisSim%SIM_uses_dipoles .or. thisSim%SIM_uses_sticky .or. & |
493 |
< |
thisSim%SIM_uses_GB .or. thisSim%SIM_uses_RF |
494 |
< |
end function SimUsesDirectionalAtoms |
490 |
> |
function SimUsesDirectionalAtoms() result(doesit) |
491 |
> |
logical :: doesit |
492 |
> |
doesit = thisSim%SIM_uses_dipoles .or. thisSim%SIM_uses_Sticky .or. & |
493 |
> |
thisSim%SIM_uses_StickyPower .or. & |
494 |
> |
thisSim%SIM_uses_GayBerne .or. thisSim%SIM_uses_Shapes |
495 |
> |
end function SimUsesDirectionalAtoms |
496 |
|
|
497 |
< |
function SimRequiresPrepairCalc() result(doesit) |
498 |
< |
logical :: doesit |
499 |
< |
doesit = thisSim%SIM_uses_EAM |
500 |
< |
end function SimRequiresPrepairCalc |
497 |
> |
function SimUsesLennardJones() result(doesit) |
498 |
> |
logical :: doesit |
499 |
> |
doesit = thisSim%SIM_uses_LennardJones |
500 |
> |
end function SimUsesLennardJones |
501 |
|
|
502 |
< |
function SimRequiresPostpairCalc() result(doesit) |
503 |
< |
logical :: doesit |
504 |
< |
doesit = thisSim%SIM_uses_RF |
505 |
< |
end function SimRequiresPostpairCalc |
493 |
< |
|
494 |
< |
subroutine InitializeSimGlobals(thisStat) |
495 |
< |
integer, intent(out) :: thisStat |
496 |
< |
integer :: alloc_stat |
497 |
< |
|
498 |
< |
thisStat = 0 |
499 |
< |
|
500 |
< |
call FreeSimGlobals() |
501 |
< |
|
502 |
< |
allocate(excludesLocal(2,nExcludes_Local), stat=alloc_stat) |
503 |
< |
if (alloc_stat /= 0 ) then |
504 |
< |
thisStat = -1 |
505 |
< |
return |
506 |
< |
endif |
507 |
< |
|
508 |
< |
allocate(excludesGlobal(nExcludes_Global), stat=alloc_stat) |
509 |
< |
if (alloc_stat /= 0 ) then |
510 |
< |
thisStat = -1 |
511 |
< |
return |
512 |
< |
endif |
502 |
> |
function SimUsesElectrostatics() result(doesit) |
503 |
> |
logical :: doesit |
504 |
> |
doesit = thisSim%SIM_uses_Electrostatics |
505 |
> |
end function SimUsesElectrostatics |
506 |
|
|
507 |
< |
allocate(molMembershipList(nGlobal), stat=alloc_stat) |
508 |
< |
if (alloc_stat /= 0 ) then |
509 |
< |
thisStat = -1 |
510 |
< |
return |
518 |
< |
endif |
519 |
< |
|
520 |
< |
end subroutine InitializeSimGlobals |
521 |
< |
|
522 |
< |
subroutine FreeSimGlobals() |
523 |
< |
|
524 |
< |
!We free in the opposite order in which we allocate in. |
507 |
> |
function SimUsesCharges() result(doesit) |
508 |
> |
logical :: doesit |
509 |
> |
doesit = thisSim%SIM_uses_Charges |
510 |
> |
end function SimUsesCharges |
511 |
|
|
512 |
< |
if (allocated(skipsForAtom)) deallocate(skipsForAtom) |
513 |
< |
if (allocated(nSkipsForAtom)) deallocate(nSkipsForAtom) |
514 |
< |
if (allocated(mfactLocal)) deallocate(mfactLocal) |
515 |
< |
if (allocated(mfactCol)) deallocate(mfactCol) |
530 |
< |
if (allocated(mfactRow)) deallocate(mfactRow) |
531 |
< |
if (allocated(groupListCol)) deallocate(groupListCol) |
532 |
< |
if (allocated(groupListRow)) deallocate(groupListRow) |
533 |
< |
if (allocated(groupStartCol)) deallocate(groupStartCol) |
534 |
< |
if (allocated(groupStartRow)) deallocate(groupStartRow) |
535 |
< |
if (allocated(molMembershipList)) deallocate(molMembershipList) |
536 |
< |
if (allocated(excludesGlobal)) deallocate(excludesGlobal) |
537 |
< |
if (allocated(excludesLocal)) deallocate(excludesLocal) |
538 |
< |
|
539 |
< |
end subroutine FreeSimGlobals |
540 |
< |
|
541 |
< |
pure function getNlocal() result(n) |
542 |
< |
integer :: n |
543 |
< |
n = nLocal |
544 |
< |
end function getNlocal |
545 |
< |
|
546 |
< |
|
547 |
< |
end module simulation |
512 |
> |
function SimUsesDipoles() result(doesit) |
513 |
> |
logical :: doesit |
514 |
> |
doesit = thisSim%SIM_uses_Dipoles |
515 |
> |
end function SimUsesDipoles |
516 |
|
|
517 |
+ |
function SimUsesSticky() result(doesit) |
518 |
+ |
logical :: doesit |
519 |
+ |
doesit = thisSim%SIM_uses_Sticky |
520 |
+ |
end function SimUsesSticky |
521 |
|
|
522 |
< |
subroutine setFortranSim(setThisSim, CnGlobal, CnLocal, c_idents, & |
523 |
< |
CnLocalExcludes, CexcludesLocal, CnGlobalExcludes, CexcludesGlobal, & |
524 |
< |
CmolMembership, Cmfact, CnGroups, CglobalGroupMembership, & |
525 |
< |
status) |
554 |
< |
use definitions, ONLY : dp |
555 |
< |
use simulation |
556 |
< |
|
557 |
< |
type (simtype) :: setThisSim |
558 |
< |
integer, intent(inout) :: CnGlobal, CnLocal |
559 |
< |
integer, dimension(CnLocal),intent(inout) :: c_idents |
522 |
> |
function SimUsesStickyPower() result(doesit) |
523 |
> |
logical :: doesit |
524 |
> |
doesit = thisSim%SIM_uses_StickyPower |
525 |
> |
end function SimUsesStickyPower |
526 |
|
|
527 |
< |
integer :: CnLocalExcludes |
528 |
< |
integer, dimension(2,CnLocalExcludes), intent(inout) :: CexcludesLocal |
529 |
< |
integer :: CnGlobalExcludes |
530 |
< |
integer, dimension(CnGlobalExcludes), intent(inout) :: CexcludesGlobal |
531 |
< |
integer, dimension(CnGlobal),intent(inout) :: CmolMembership |
532 |
< |
!! Result status, success = 0, status = -1 |
533 |
< |
integer, intent(inout) :: status |
534 |
< |
|
535 |
< |
!! mass factors used for molecular cutoffs |
536 |
< |
real ( kind = dp ), dimension(CnLocal) :: Cmfact |
537 |
< |
integer, intent(in):: CnGroups |
538 |
< |
integer, dimension(CnGlobal), intent(inout):: CglobalGroupMembership |
539 |
< |
|
540 |
< |
call SimulationSetup(setThisSim, CnGlobal, CnLocal, c_idents, & |
541 |
< |
CnLocalExcludes, CexcludesLocal, CnGlobalExcludes, CexcludesGlobal, & |
542 |
< |
CmolMembership, Cmfact, CnGroups, CglobalGroupMembership, & |
543 |
< |
status) |
544 |
< |
end subroutine setFortranSim |
545 |
< |
|
546 |
< |
subroutine setFortranBox(cHmat, cHmatInv, cBoxIsOrthorhombic) |
547 |
< |
use simulation, only : setBox |
548 |
< |
use definitions, ONLY : dp |
549 |
< |
real(kind=dp), dimension(3,3) :: cHmat, cHmatInv |
550 |
< |
integer :: cBoxIsOrthorhombic |
551 |
< |
|
552 |
< |
call setBox(cHmat, cHmatInv, cBoxIsOrthorhombic) |
553 |
< |
|
554 |
< |
end subroutine setFortranBox |
527 |
> |
function SimUsesGayBerne() result(doesit) |
528 |
> |
logical :: doesit |
529 |
> |
doesit = thisSim%SIM_uses_GayBerne |
530 |
> |
end function SimUsesGayBerne |
531 |
> |
|
532 |
> |
function SimUsesEAM() result(doesit) |
533 |
> |
logical :: doesit |
534 |
> |
doesit = thisSim%SIM_uses_EAM |
535 |
> |
end function SimUsesEAM |
536 |
> |
|
537 |
> |
function SimUsesShapes() result(doesit) |
538 |
> |
logical :: doesit |
539 |
> |
doesit = thisSim%SIM_uses_Shapes |
540 |
> |
end function SimUsesShapes |
541 |
> |
|
542 |
> |
function SimUsesFLARB() result(doesit) |
543 |
> |
logical :: doesit |
544 |
> |
doesit = thisSim%SIM_uses_FLARB |
545 |
> |
end function SimUsesFLARB |
546 |
> |
|
547 |
> |
function SimUsesRF() result(doesit) |
548 |
> |
logical :: doesit |
549 |
> |
doesit = thisSim%SIM_uses_RF |
550 |
> |
end function SimUsesRF |
551 |
> |
|
552 |
> |
function SimRequiresPrepairCalc() result(doesit) |
553 |
> |
logical :: doesit |
554 |
> |
doesit = thisSim%SIM_uses_EAM |
555 |
> |
end function SimRequiresPrepairCalc |
556 |
> |
|
557 |
> |
function SimRequiresPostpairCalc() result(doesit) |
558 |
> |
logical :: doesit |
559 |
> |
doesit = thisSim%SIM_uses_RF |
560 |
> |
end function SimRequiresPostpairCalc |
561 |
> |
|
562 |
> |
subroutine InitializeSimGlobals(thisStat) |
563 |
> |
integer, intent(out) :: thisStat |
564 |
> |
integer :: alloc_stat |
565 |
> |
|
566 |
> |
thisStat = 0 |
567 |
> |
|
568 |
> |
call FreeSimGlobals() |
569 |
> |
|
570 |
> |
allocate(excludesLocal(2,nExcludes_Local), stat=alloc_stat) |
571 |
> |
if (alloc_stat /= 0 ) then |
572 |
> |
thisStat = -1 |
573 |
> |
return |
574 |
> |
endif |
575 |
> |
|
576 |
> |
allocate(excludesGlobal(nExcludes_Global), stat=alloc_stat) |
577 |
> |
if (alloc_stat /= 0 ) then |
578 |
> |
thisStat = -1 |
579 |
> |
return |
580 |
> |
endif |
581 |
> |
|
582 |
> |
allocate(molMembershipList(nGlobal), stat=alloc_stat) |
583 |
> |
if (alloc_stat /= 0 ) then |
584 |
> |
thisStat = -1 |
585 |
> |
return |
586 |
> |
endif |
587 |
> |
|
588 |
> |
end subroutine InitializeSimGlobals |
589 |
> |
|
590 |
> |
subroutine FreeSimGlobals() |
591 |
> |
|
592 |
> |
!We free in the opposite order in which we allocate in. |
593 |
> |
|
594 |
> |
if (allocated(skipsForAtom)) deallocate(skipsForAtom) |
595 |
> |
if (allocated(nSkipsForAtom)) deallocate(nSkipsForAtom) |
596 |
> |
if (allocated(mfactLocal)) deallocate(mfactLocal) |
597 |
> |
if (allocated(mfactCol)) deallocate(mfactCol) |
598 |
> |
if (allocated(mfactRow)) deallocate(mfactRow) |
599 |
> |
if (allocated(groupListCol)) deallocate(groupListCol) |
600 |
> |
if (allocated(groupListRow)) deallocate(groupListRow) |
601 |
> |
if (allocated(groupStartCol)) deallocate(groupStartCol) |
602 |
> |
if (allocated(groupStartRow)) deallocate(groupStartRow) |
603 |
> |
if (allocated(molMembershipList)) deallocate(molMembershipList) |
604 |
> |
if (allocated(excludesGlobal)) deallocate(excludesGlobal) |
605 |
> |
if (allocated(excludesLocal)) deallocate(excludesLocal) |
606 |
> |
|
607 |
> |
end subroutine FreeSimGlobals |
608 |
> |
|
609 |
> |
pure function getNlocal() result(n) |
610 |
> |
integer :: n |
611 |
> |
n = nLocal |
612 |
> |
end function getNlocal |
613 |
> |
|
614 |
> |
end module simulation |