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 |
|
|
106 |
|
public :: SimUsesRF |
107 |
|
public :: SimRequiresPrepairCalc |
108 |
|
public :: SimRequiresPostpairCalc |
109 |
< |
|
109 |
> |
public :: SimHasAtype |
110 |
|
|
111 |
|
contains |
112 |
|
|
458 |
|
molMemberShipList(i) = CmolMembership(i) |
459 |
|
enddo |
460 |
|
|
461 |
< |
if (status == 0) simulation_setup_complete = .true. |
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 |
|
end subroutine SimulationSetup |
469 |
|
|
565 |
|
doesit = thisSim%SIM_uses_RF |
566 |
|
end function SimRequiresPostpairCalc |
567 |
|
|
568 |
< |
subroutine InitializeSimGlobals(thisStat) |
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 |
602 |
> |
! simulation on all processors. Use LOR operation to set map. |
603 |
> |
#ifdef IS_MPI |
604 |
> |
call mpi_allreduce(SimHasAtypeMap, SimHasAtypeMap, nAtypes, & |
605 |
> |
mpi_logical, MPI_LOR, mpi_comm_world, mpiErrors) |
606 |
> |
#endif |
607 |
> |
end subroutine createSimHasAtype |
608 |
> |
|
609 |
> |
subroutine InitializeSimGlobals(thisStat) |
610 |
|
integer, intent(out) :: thisStat |
611 |
|
integer :: alloc_stat |
612 |
|
|
658 |
|
n = nLocal |
659 |
|
end function getNlocal |
660 |
|
|
661 |
+ |
|
662 |
+ |
|
663 |
+ |
|
664 |
+ |
|
665 |
|
end module simulation |