82 |
|
real(kind=dp), allocatable, dimension(:), public :: mfactCol |
83 |
|
real(kind=dp), allocatable, dimension(:), public :: mfactLocal |
84 |
|
|
85 |
+ |
logical, allocatable, dimension(:) :: simHasAtypeMap |
86 |
|
real(kind=dp), public, dimension(3,3), save :: Hmat, HmatInv |
87 |
|
logical, public, save :: boxIsOrthorhombic |
88 |
< |
|
88 |
> |
|
89 |
|
public :: SimulationSetup |
90 |
|
public :: getNlocal |
91 |
|
public :: setBox |
98 |
|
public :: SimUsesCharges |
99 |
|
public :: SimUsesDipoles |
100 |
|
public :: SimUsesSticky |
101 |
+ |
public :: SimUsesStickyPower |
102 |
|
public :: SimUsesGayBerne |
103 |
|
public :: SimUsesEAM |
104 |
|
public :: SimUsesShapes |
106 |
|
public :: SimUsesRF |
107 |
|
public :: SimRequiresPrepairCalc |
108 |
|
public :: SimRequiresPostpairCalc |
109 |
+ |
public :: SimHasAtype |
110 |
|
|
108 |
– |
|
111 |
|
contains |
112 |
< |
|
112 |
> |
|
113 |
|
subroutine SimulationSetup(setThisSim, CnGlobal, CnLocal, c_idents, & |
114 |
|
CnLocalExcludes, CexcludesLocal, CnGlobalExcludes, CexcludesGlobal, & |
115 |
|
CmolMembership, Cmfact, CnGroups, CglobalGroupMembership, & |
182 |
|
nGroupsInRow = getNgroupsInRow(plan_group_row) |
183 |
|
nGroupsInCol = getNgroupsInCol(plan_group_col) |
184 |
|
mynode = getMyNode() |
185 |
< |
|
185 |
> |
|
186 |
|
allocate(c_idents_Row(nAtomsInRow),stat=alloc_stat) |
187 |
|
if (alloc_stat /= 0 ) then |
188 |
|
status = -1 |
215 |
|
if (allocated(c_idents_Row)) then |
216 |
|
deallocate(c_idents_Row) |
217 |
|
endif |
218 |
< |
|
218 |
> |
|
219 |
|
#endif |
220 |
|
|
221 |
|
#ifdef IS_MPI |
254 |
|
status = -1 |
255 |
|
return |
256 |
|
endif |
257 |
< |
|
257 |
> |
|
258 |
|
glPointer = 1 |
259 |
|
|
260 |
|
do i = 1, nGroupsInRow |
293 |
|
|
294 |
|
call gather(mfactLocal, mfactRow, plan_atom_row) |
295 |
|
call gather(mfactLocal, mfactCol, plan_atom_col) |
296 |
< |
|
296 |
> |
|
297 |
|
if (allocated(mfactLocal)) then |
298 |
|
deallocate(mfactLocal) |
299 |
|
end if |
353 |
|
mfactRow(i) = Cmfact(i) |
354 |
|
mfactCol(i) = Cmfact(i) |
355 |
|
end do |
356 |
< |
|
356 |
> |
|
357 |
|
#endif |
358 |
|
|
359 |
|
|
360 |
< |
! We build the local atid's for both mpi and nonmpi |
360 |
> |
! We build the local atid's for both mpi and nonmpi |
361 |
|
do i = 1, nLocal |
362 |
< |
|
362 |
> |
|
363 |
|
me = getFirstMatchingElement(atypes, "c_ident", c_idents(i)) |
364 |
|
atid(i) = me |
365 |
< |
|
365 |
> |
|
366 |
|
enddo |
367 |
|
|
368 |
|
do i = 1, nExcludes_Local |
385 |
|
#ifdef IS_MPI |
386 |
|
do j = 1, nAtomsInRow |
387 |
|
#else |
388 |
< |
do j = 1, nLocal |
388 |
> |
do j = 1, nLocal |
389 |
|
#endif |
390 |
< |
nSkipsForAtom(j) = 0 |
390 |
> |
nSkipsForAtom(j) = 0 |
391 |
|
#ifdef IS_MPI |
392 |
< |
id1 = AtomRowToGlobal(j) |
392 |
> |
id1 = AtomRowToGlobal(j) |
393 |
|
#else |
394 |
< |
id1 = j |
394 |
> |
id1 = j |
395 |
|
#endif |
396 |
< |
do i = 1, nExcludes_Local |
397 |
< |
if (excludesLocal(1,i) .eq. id1 ) then |
398 |
< |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
396 |
> |
do i = 1, nExcludes_Local |
397 |
> |
if (excludesLocal(1,i) .eq. id1 ) then |
398 |
> |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
399 |
|
|
400 |
< |
if (nSkipsForAtom(j) .gt. maxSkipsForAtom) then |
401 |
< |
maxSkipsForAtom = nSkipsForAtom(j) |
400 |
> |
if (nSkipsForAtom(j) .gt. maxSkipsForAtom) then |
401 |
> |
maxSkipsForAtom = nSkipsForAtom(j) |
402 |
> |
endif |
403 |
|
endif |
404 |
< |
endif |
405 |
< |
if (excludesLocal(2,i) .eq. id1 ) then |
403 |
< |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
404 |
> |
if (excludesLocal(2,i) .eq. id1 ) then |
405 |
> |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
406 |
|
|
407 |
< |
if (nSkipsForAtom(j) .gt. maxSkipsForAtom) then |
408 |
< |
maxSkipsForAtom = nSkipsForAtom(j) |
407 |
> |
if (nSkipsForAtom(j) .gt. maxSkipsForAtom) then |
408 |
> |
maxSkipsForAtom = nSkipsForAtom(j) |
409 |
> |
endif |
410 |
|
endif |
411 |
< |
endif |
412 |
< |
end do |
410 |
< |
enddo |
411 |
> |
end do |
412 |
> |
enddo |
413 |
|
|
414 |
|
#ifdef IS_MPI |
415 |
< |
allocate(skipsForAtom(nAtomsInRow, maxSkipsForAtom), stat=alloc_stat) |
415 |
> |
allocate(skipsForAtom(nAtomsInRow, maxSkipsForAtom), stat=alloc_stat) |
416 |
|
#else |
417 |
< |
allocate(skipsForAtom(nLocal, maxSkipsForAtom), stat=alloc_stat) |
417 |
> |
allocate(skipsForAtom(nLocal, maxSkipsForAtom), stat=alloc_stat) |
418 |
|
#endif |
419 |
< |
if (alloc_stat /= 0 ) then |
420 |
< |
write(*,*) 'Could not allocate skipsForAtom array' |
421 |
< |
return |
422 |
< |
endif |
419 |
> |
if (alloc_stat /= 0 ) then |
420 |
> |
write(*,*) 'Could not allocate skipsForAtom array' |
421 |
> |
return |
422 |
> |
endif |
423 |
|
|
424 |
|
#ifdef IS_MPI |
425 |
< |
do j = 1, nAtomsInRow |
425 |
> |
do j = 1, nAtomsInRow |
426 |
|
#else |
427 |
< |
do j = 1, nLocal |
427 |
> |
do j = 1, nLocal |
428 |
|
#endif |
429 |
< |
nSkipsForAtom(j) = 0 |
429 |
> |
nSkipsForAtom(j) = 0 |
430 |
|
#ifdef IS_MPI |
431 |
< |
id1 = AtomRowToGlobal(j) |
431 |
> |
id1 = AtomRowToGlobal(j) |
432 |
|
#else |
433 |
< |
id1 = j |
433 |
> |
id1 = j |
434 |
|
#endif |
435 |
< |
do i = 1, nExcludes_Local |
436 |
< |
if (excludesLocal(1,i) .eq. id1 ) then |
437 |
< |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
438 |
< |
! exclude lists have global ID's so this line is |
439 |
< |
! the same in MPI and non-MPI |
440 |
< |
id2 = excludesLocal(2,i) |
441 |
< |
skipsForAtom(j, nSkipsForAtom(j)) = id2 |
442 |
< |
endif |
443 |
< |
if (excludesLocal(2, i) .eq. id1 ) then |
444 |
< |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
445 |
< |
! exclude lists have global ID's so this line is |
446 |
< |
! the same in MPI and non-MPI |
447 |
< |
id2 = excludesLocal(1,i) |
448 |
< |
skipsForAtom(j, nSkipsForAtom(j)) = id2 |
449 |
< |
endif |
450 |
< |
end do |
451 |
< |
enddo |
450 |
< |
|
451 |
< |
do i = 1, nExcludes_Global |
452 |
< |
excludesGlobal(i) = CexcludesGlobal(i) |
453 |
< |
enddo |
454 |
< |
|
455 |
< |
do i = 1, nGlobal |
456 |
< |
molMemberShipList(i) = CmolMembership(i) |
457 |
< |
enddo |
458 |
< |
|
459 |
< |
if (status == 0) simulation_setup_complete = .true. |
460 |
< |
|
461 |
< |
end subroutine SimulationSetup |
462 |
< |
|
463 |
< |
subroutine setBox(cHmat, cHmatInv, cBoxIsOrthorhombic) |
464 |
< |
real(kind=dp), dimension(3,3) :: cHmat, cHmatInv |
465 |
< |
integer :: cBoxIsOrthorhombic |
466 |
< |
integer :: smallest, status, i |
467 |
< |
|
468 |
< |
Hmat = cHmat |
469 |
< |
HmatInv = cHmatInv |
470 |
< |
if (cBoxIsOrthorhombic .eq. 0 ) then |
471 |
< |
boxIsOrthorhombic = .false. |
472 |
< |
else |
473 |
< |
boxIsOrthorhombic = .true. |
474 |
< |
endif |
475 |
< |
|
476 |
< |
return |
477 |
< |
end subroutine setBox |
435 |
> |
do i = 1, nExcludes_Local |
436 |
> |
if (excludesLocal(1,i) .eq. id1 ) then |
437 |
> |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
438 |
> |
! exclude lists have global ID's so this line is |
439 |
> |
! the same in MPI and non-MPI |
440 |
> |
id2 = excludesLocal(2,i) |
441 |
> |
skipsForAtom(j, nSkipsForAtom(j)) = id2 |
442 |
> |
endif |
443 |
> |
if (excludesLocal(2, i) .eq. id1 ) then |
444 |
> |
nSkipsForAtom(j) = nSkipsForAtom(j) + 1 |
445 |
> |
! exclude lists have global ID's so this line is |
446 |
> |
! the same in MPI and non-MPI |
447 |
> |
id2 = excludesLocal(1,i) |
448 |
> |
skipsForAtom(j, nSkipsForAtom(j)) = id2 |
449 |
> |
endif |
450 |
> |
end do |
451 |
> |
enddo |
452 |
|
|
453 |
< |
function getDielect() result(dielect) |
454 |
< |
real( kind = dp ) :: dielect |
455 |
< |
dielect = thisSim%dielect |
482 |
< |
end function getDielect |
483 |
< |
|
484 |
< |
function SimUsesPBC() result(doesit) |
485 |
< |
logical :: doesit |
486 |
< |
doesit = thisSim%SIM_uses_PBC |
487 |
< |
end function SimUsesPBC |
453 |
> |
do i = 1, nExcludes_Global |
454 |
> |
excludesGlobal(i) = CexcludesGlobal(i) |
455 |
> |
enddo |
456 |
|
|
457 |
< |
function SimUsesDirectionalAtoms() result(doesit) |
458 |
< |
logical :: doesit |
459 |
< |
doesit = thisSim%SIM_uses_dipoles .or. thisSim%SIM_uses_sticky .or. & |
492 |
< |
thisSim%SIM_uses_GayBerne .or. thisSim%SIM_uses_Shapes |
493 |
< |
end function SimUsesDirectionalAtoms |
457 |
> |
do i = 1, nGlobal |
458 |
> |
molMemberShipList(i) = CmolMembership(i) |
459 |
> |
enddo |
460 |
|
|
461 |
< |
function SimUsesLennardJones() result(doesit) |
462 |
< |
logical :: doesit |
463 |
< |
doesit = thisSim%SIM_uses_LennardJones |
464 |
< |
end function SimUsesLennardJones |
461 |
> |
call createSimHasAtype(alloc_stat) |
462 |
> |
if (alloc_stat /= 0) then |
463 |
> |
status = -1 |
464 |
> |
end if |
465 |
> |
|
466 |
> |
if (status == 0) simulation_setup_complete = .true. |
467 |
|
|
468 |
< |
function SimUsesElectrostatics() result(doesit) |
501 |
< |
logical :: doesit |
502 |
< |
doesit = thisSim%SIM_uses_Electrostatics |
503 |
< |
end function SimUsesElectrostatics |
468 |
> |
end subroutine SimulationSetup |
469 |
|
|
470 |
< |
function SimUsesCharges() result(doesit) |
471 |
< |
logical :: doesit |
472 |
< |
doesit = thisSim%SIM_uses_Charges |
473 |
< |
end function SimUsesCharges |
470 |
> |
subroutine setBox(cHmat, cHmatInv, cBoxIsOrthorhombic) |
471 |
> |
real(kind=dp), dimension(3,3) :: cHmat, cHmatInv |
472 |
> |
integer :: cBoxIsOrthorhombic |
473 |
> |
integer :: smallest, status, i |
474 |
|
|
475 |
< |
function SimUsesDipoles() result(doesit) |
476 |
< |
logical :: doesit |
477 |
< |
doesit = thisSim%SIM_uses_Dipoles |
478 |
< |
end function SimUsesDipoles |
475 |
> |
Hmat = cHmat |
476 |
> |
HmatInv = cHmatInv |
477 |
> |
if (cBoxIsOrthorhombic .eq. 0 ) then |
478 |
> |
boxIsOrthorhombic = .false. |
479 |
> |
else |
480 |
> |
boxIsOrthorhombic = .true. |
481 |
> |
endif |
482 |
|
|
483 |
< |
function SimUsesSticky() result(doesit) |
484 |
< |
logical :: doesit |
517 |
< |
doesit = thisSim%SIM_uses_Sticky |
518 |
< |
end function SimUsesSticky |
483 |
> |
return |
484 |
> |
end subroutine setBox |
485 |
|
|
486 |
< |
function SimUsesGayBerne() result(doesit) |
487 |
< |
logical :: doesit |
488 |
< |
doesit = thisSim%SIM_uses_GayBerne |
489 |
< |
end function SimUsesGayBerne |
524 |
< |
|
525 |
< |
function SimUsesEAM() result(doesit) |
526 |
< |
logical :: doesit |
527 |
< |
doesit = thisSim%SIM_uses_EAM |
528 |
< |
end function SimUsesEAM |
486 |
> |
function getDielect() result(dielect) |
487 |
> |
real( kind = dp ) :: dielect |
488 |
> |
dielect = thisSim%dielect |
489 |
> |
end function getDielect |
490 |
|
|
491 |
< |
function SimUsesShapes() result(doesit) |
492 |
< |
logical :: doesit |
493 |
< |
doesit = thisSim%SIM_uses_Shapes |
494 |
< |
end function SimUsesShapes |
491 |
> |
function SimUsesPBC() result(doesit) |
492 |
> |
logical :: doesit |
493 |
> |
doesit = thisSim%SIM_uses_PBC |
494 |
> |
end function SimUsesPBC |
495 |
|
|
496 |
< |
function SimUsesFLARB() result(doesit) |
497 |
< |
logical :: doesit |
498 |
< |
doesit = thisSim%SIM_uses_FLARB |
499 |
< |
end function SimUsesFLARB |
496 |
> |
function SimUsesDirectionalAtoms() result(doesit) |
497 |
> |
logical :: doesit |
498 |
> |
doesit = thisSim%SIM_uses_dipoles .or. thisSim%SIM_uses_Sticky .or. & |
499 |
> |
thisSim%SIM_uses_StickyPower .or. & |
500 |
> |
thisSim%SIM_uses_GayBerne .or. thisSim%SIM_uses_Shapes |
501 |
> |
end function SimUsesDirectionalAtoms |
502 |
> |
|
503 |
> |
function SimUsesLennardJones() result(doesit) |
504 |
> |
logical :: doesit |
505 |
> |
doesit = thisSim%SIM_uses_LennardJones |
506 |
> |
end function SimUsesLennardJones |
507 |
|
|
508 |
< |
function SimUsesRF() result(doesit) |
509 |
< |
logical :: doesit |
510 |
< |
doesit = thisSim%SIM_uses_RF |
511 |
< |
end function SimUsesRF |
508 |
> |
function SimUsesElectrostatics() result(doesit) |
509 |
> |
logical :: doesit |
510 |
> |
doesit = thisSim%SIM_uses_Electrostatics |
511 |
> |
end function SimUsesElectrostatics |
512 |
|
|
513 |
< |
function SimRequiresPrepairCalc() result(doesit) |
514 |
< |
logical :: doesit |
515 |
< |
doesit = thisSim%SIM_uses_EAM |
516 |
< |
end function SimRequiresPrepairCalc |
513 |
> |
function SimUsesCharges() result(doesit) |
514 |
> |
logical :: doesit |
515 |
> |
doesit = thisSim%SIM_uses_Charges |
516 |
> |
end function SimUsesCharges |
517 |
|
|
518 |
< |
function SimRequiresPostpairCalc() result(doesit) |
519 |
< |
logical :: doesit |
520 |
< |
doesit = thisSim%SIM_uses_RF |
521 |
< |
end function SimRequiresPostpairCalc |
554 |
< |
|
555 |
< |
subroutine InitializeSimGlobals(thisStat) |
556 |
< |
integer, intent(out) :: thisStat |
557 |
< |
integer :: alloc_stat |
558 |
< |
|
559 |
< |
thisStat = 0 |
560 |
< |
|
561 |
< |
call FreeSimGlobals() |
562 |
< |
|
563 |
< |
allocate(excludesLocal(2,nExcludes_Local), stat=alloc_stat) |
564 |
< |
if (alloc_stat /= 0 ) then |
565 |
< |
thisStat = -1 |
566 |
< |
return |
567 |
< |
endif |
568 |
< |
|
569 |
< |
allocate(excludesGlobal(nExcludes_Global), stat=alloc_stat) |
570 |
< |
if (alloc_stat /= 0 ) then |
571 |
< |
thisStat = -1 |
572 |
< |
return |
573 |
< |
endif |
518 |
> |
function SimUsesDipoles() result(doesit) |
519 |
> |
logical :: doesit |
520 |
> |
doesit = thisSim%SIM_uses_Dipoles |
521 |
> |
end function SimUsesDipoles |
522 |
|
|
523 |
< |
allocate(molMembershipList(nGlobal), stat=alloc_stat) |
524 |
< |
if (alloc_stat /= 0 ) then |
525 |
< |
thisStat = -1 |
526 |
< |
return |
579 |
< |
endif |
580 |
< |
|
581 |
< |
end subroutine InitializeSimGlobals |
582 |
< |
|
583 |
< |
subroutine FreeSimGlobals() |
584 |
< |
|
585 |
< |
!We free in the opposite order in which we allocate in. |
523 |
> |
function SimUsesSticky() result(doesit) |
524 |
> |
logical :: doesit |
525 |
> |
doesit = thisSim%SIM_uses_Sticky |
526 |
> |
end function SimUsesSticky |
527 |
|
|
528 |
< |
if (allocated(skipsForAtom)) deallocate(skipsForAtom) |
529 |
< |
if (allocated(nSkipsForAtom)) deallocate(nSkipsForAtom) |
530 |
< |
if (allocated(mfactLocal)) deallocate(mfactLocal) |
531 |
< |
if (allocated(mfactCol)) deallocate(mfactCol) |
532 |
< |
if (allocated(mfactRow)) deallocate(mfactRow) |
533 |
< |
if (allocated(groupListCol)) deallocate(groupListCol) |
534 |
< |
if (allocated(groupListRow)) deallocate(groupListRow) |
535 |
< |
if (allocated(groupStartCol)) deallocate(groupStartCol) |
536 |
< |
if (allocated(groupStartRow)) deallocate(groupStartRow) |
537 |
< |
if (allocated(molMembershipList)) deallocate(molMembershipList) |
538 |
< |
if (allocated(excludesGlobal)) deallocate(excludesGlobal) |
539 |
< |
if (allocated(excludesLocal)) deallocate(excludesLocal) |
540 |
< |
|
541 |
< |
end subroutine FreeSimGlobals |
542 |
< |
|
543 |
< |
pure function getNlocal() result(n) |
544 |
< |
integer :: n |
545 |
< |
n = nLocal |
546 |
< |
end function getNlocal |
547 |
< |
|
548 |
< |
end module simulation |
528 |
> |
function SimUsesStickyPower() result(doesit) |
529 |
> |
logical :: doesit |
530 |
> |
doesit = thisSim%SIM_uses_StickyPower |
531 |
> |
end function SimUsesStickyPower |
532 |
> |
|
533 |
> |
function SimUsesGayBerne() result(doesit) |
534 |
> |
logical :: doesit |
535 |
> |
doesit = thisSim%SIM_uses_GayBerne |
536 |
> |
end function SimUsesGayBerne |
537 |
> |
|
538 |
> |
function SimUsesEAM() result(doesit) |
539 |
> |
logical :: doesit |
540 |
> |
doesit = thisSim%SIM_uses_EAM |
541 |
> |
end function SimUsesEAM |
542 |
> |
|
543 |
> |
function SimUsesShapes() result(doesit) |
544 |
> |
logical :: doesit |
545 |
> |
doesit = thisSim%SIM_uses_Shapes |
546 |
> |
end function SimUsesShapes |
547 |
> |
|
548 |
> |
function SimUsesFLARB() result(doesit) |
549 |
> |
logical :: doesit |
550 |
> |
doesit = thisSim%SIM_uses_FLARB |
551 |
> |
end function SimUsesFLARB |
552 |
> |
|
553 |
> |
function SimUsesRF() result(doesit) |
554 |
> |
logical :: doesit |
555 |
> |
doesit = thisSim%SIM_uses_RF |
556 |
> |
end function SimUsesRF |
557 |
> |
|
558 |
> |
function SimRequiresPrepairCalc() result(doesit) |
559 |
> |
logical :: doesit |
560 |
> |
doesit = thisSim%SIM_uses_EAM |
561 |
> |
end function SimRequiresPrepairCalc |
562 |
> |
|
563 |
> |
function SimRequiresPostpairCalc() result(doesit) |
564 |
> |
logical :: doesit |
565 |
> |
doesit = thisSim%SIM_uses_RF |
566 |
> |
end function SimRequiresPostpairCalc |
567 |
> |
|
568 |
> |
! Function returns true if the simulation has this atype |
569 |
> |
function SimHasAtype(thisAtype) result(doesit) |
570 |
> |
logical :: doesit |
571 |
> |
integer :: thisAtype |
572 |
> |
doesit = .false. |
573 |
> |
if(.not.allocated(SimHasAtypeMap)) return |
574 |
> |
|
575 |
> |
doesit = SimHasAtypeMap(thisAtype) |
576 |
> |
|
577 |
> |
end function SimHasAtype |
578 |
> |
|
579 |
> |
subroutine createSimHasAtype(status) |
580 |
> |
integer, intent(out) :: status |
581 |
> |
integer :: alloc_stat |
582 |
> |
integer :: me_i |
583 |
> |
integer :: mpiErrors |
584 |
> |
integer :: nAtypes |
585 |
> |
status = 0 |
586 |
> |
|
587 |
> |
nAtypes = getSize(atypes) |
588 |
> |
! Setup logical map for atypes in simulation |
589 |
> |
if (.not.allocated(SimHasAtypeMap)) then |
590 |
> |
allocate(SimHasAtypeMap(nAtypes),stat=alloc_stat) |
591 |
> |
if (alloc_stat /= 0 ) then |
592 |
> |
status = -1 |
593 |
> |
return |
594 |
> |
end if |
595 |
> |
SimHasAtypeMap = .false. |
596 |
> |
end if |
597 |
> |
! Loop through the local atoms and grab the atypes present |
598 |
> |
do me_i = 1,nLocal |
599 |
> |
SimHasAtypeMap(atid(me_i)) = .true. |
600 |
> |
end do |
601 |
> |
! For MPI, we need to know all possible atypes present in simulation on all |
602 |
> |
! processors. Use LOR operation to set map. |
603 |
> |
#ifdef IS_MPI |
604 |
> |
call mpi_allreduce(SimHasAtypeMap, SimHasAtypeMap, nAtypes, mpi_logical, & |
605 |
> |
MPI_LOR, mpi_comm_world, mpiErrors) |
606 |
> |
#endif |
607 |
> |
|
608 |
> |
end subroutine createSimHasAtype |
609 |
> |
|
610 |
> |
subroutine InitializeSimGlobals(thisStat) |
611 |
> |
integer, intent(out) :: thisStat |
612 |
> |
integer :: alloc_stat |
613 |
> |
|
614 |
> |
thisStat = 0 |
615 |
> |
|
616 |
> |
call FreeSimGlobals() |
617 |
> |
|
618 |
> |
allocate(excludesLocal(2,nExcludes_Local), stat=alloc_stat) |
619 |
> |
if (alloc_stat /= 0 ) then |
620 |
> |
thisStat = -1 |
621 |
> |
return |
622 |
> |
endif |
623 |
> |
|
624 |
> |
allocate(excludesGlobal(nExcludes_Global), stat=alloc_stat) |
625 |
> |
if (alloc_stat /= 0 ) then |
626 |
> |
thisStat = -1 |
627 |
> |
return |
628 |
> |
endif |
629 |
> |
|
630 |
> |
allocate(molMembershipList(nGlobal), stat=alloc_stat) |
631 |
> |
if (alloc_stat /= 0 ) then |
632 |
> |
thisStat = -1 |
633 |
> |
return |
634 |
> |
endif |
635 |
> |
|
636 |
> |
end subroutine InitializeSimGlobals |
637 |
> |
|
638 |
> |
subroutine FreeSimGlobals() |
639 |
> |
|
640 |
> |
!We free in the opposite order in which we allocate in. |
641 |
> |
|
642 |
> |
if (allocated(skipsForAtom)) deallocate(skipsForAtom) |
643 |
> |
if (allocated(nSkipsForAtom)) deallocate(nSkipsForAtom) |
644 |
> |
if (allocated(mfactLocal)) deallocate(mfactLocal) |
645 |
> |
if (allocated(mfactCol)) deallocate(mfactCol) |
646 |
> |
if (allocated(mfactRow)) deallocate(mfactRow) |
647 |
> |
if (allocated(groupListCol)) deallocate(groupListCol) |
648 |
> |
if (allocated(groupListRow)) deallocate(groupListRow) |
649 |
> |
if (allocated(groupStartCol)) deallocate(groupStartCol) |
650 |
> |
if (allocated(groupStartRow)) deallocate(groupStartRow) |
651 |
> |
if (allocated(molMembershipList)) deallocate(molMembershipList) |
652 |
> |
if (allocated(excludesGlobal)) deallocate(excludesGlobal) |
653 |
> |
if (allocated(excludesLocal)) deallocate(excludesLocal) |
654 |
> |
|
655 |
> |
end subroutine FreeSimGlobals |
656 |
> |
|
657 |
> |
pure function getNlocal() result(n) |
658 |
> |
integer :: n |
659 |
> |
n = nLocal |
660 |
> |
end function getNlocal |
661 |
> |
|
662 |
> |
|
663 |
> |
|
664 |
> |
|
665 |
> |
|
666 |
> |
end module simulation |