ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/UseTheForce/DarkSide/simulation.F90
(Generate patch)

Comparing trunk/OOPSE-4/src/UseTheForce/DarkSide/simulation.F90 (file contents):
Revision 2220 by chrisfen, Thu May 5 14:47:35 2005 UTC vs.
Revision 2262 by chuckv, Sun Jul 3 20:53:43 2005 UTC

# Line 82 | Line 82 | module simulation
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  
# Line 105 | Line 106 | module simulation
106    public :: SimUsesRF
107    public :: SimRequiresPrepairCalc
108    public :: SimRequiresPostpairCalc
109 <
109 >  public :: SimHasAtype
110  
111   contains
112  
# Line 457 | Line 458 | contains
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  
# Line 559 | Line 565 | contains
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 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  
# Line 611 | Line 659 | contains
659            n = nLocal
660          end function getNlocal
661  
662 +
663 +
664 +
665 +
666        end module simulation

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines