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 2204 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
Revision 2390 by chrisfen, Wed Oct 19 19:24:40 2005 UTC

# Line 58 | Line 58 | module simulation
58   #define __FORTRAN90
59   #include "brains/fSimulation.h"
60   #include "UseTheForce/fSwitchingFunction.h"
61 + #include "UseTheForce/DarkSide/fElectrostaticSummationMethod.h"
62  
63    type (simtype), public, save :: thisSim
64  
# Line 81 | Line 82 | module simulation
82    real(kind=dp), allocatable, dimension(:), public :: mfactRow
83    real(kind=dp), allocatable, dimension(:), public :: mfactCol
84    real(kind=dp), allocatable, dimension(:), public :: mfactLocal
85 +
86 +  logical, allocatable, dimension(:) :: simHasAtypeMap
87 + #ifdef IS_MPI
88 +  logical, allocatable, dimension(:) :: simHasAtypeMapTemp
89 + #endif
90  
91    real(kind=dp), public, dimension(3,3), save :: Hmat, HmatInv
92    logical, public, save :: boxIsOrthorhombic
# Line 97 | Line 103 | module simulation
103    public :: SimUsesCharges
104    public :: SimUsesDipoles
105    public :: SimUsesSticky
106 +  public :: SimUsesStickyPower
107    public :: SimUsesGayBerne
108    public :: SimUsesEAM
109    public :: SimUsesShapes
# Line 104 | Line 111 | module simulation
111    public :: SimUsesRF
112    public :: SimRequiresPrepairCalc
113    public :: SimRequiresPostpairCalc
114 <
114 >  public :: SimHasAtype
115  
116   contains
117  
# Line 456 | Line 463 | contains
463               molMemberShipList(i) = CmolMembership(i)
464            enddo
465  
466 <          if (status == 0) simulation_setup_complete = .true.
466 >         call createSimHasAtype(alloc_stat)
467 >         if (alloc_stat /= 0) then
468 >            status = -1
469 >         end if
470 >        
471 >         if (status == 0) simulation_setup_complete = .true.
472  
473          end subroutine SimulationSetup
474  
# Line 488 | Line 500 | contains
500  
501          function SimUsesDirectionalAtoms() result(doesit)
502            logical :: doesit
503 <          doesit = thisSim%SIM_uses_dipoles .or. thisSim%SIM_uses_sticky .or. &
503 >          doesit = thisSim%SIM_uses_dipoles .or. thisSim%SIM_uses_Sticky .or. &
504 >               thisSim%SIM_uses_StickyPower .or. &
505                 thisSim%SIM_uses_GayBerne .or. thisSim%SIM_uses_Shapes
506          end function SimUsesDirectionalAtoms
507  
# Line 517 | Line 530 | contains
530            doesit = thisSim%SIM_uses_Sticky
531          end function SimUsesSticky
532  
533 +        function SimUsesStickyPower() result(doesit)
534 +          logical :: doesit
535 +          doesit = thisSim%SIM_uses_StickyPower
536 +        end function SimUsesStickyPower
537 +
538          function SimUsesGayBerne() result(doesit)
539            logical :: doesit
540            doesit = thisSim%SIM_uses_GayBerne
# Line 546 | Line 564 | contains
564            logical :: doesit
565            doesit = thisSim%SIM_uses_EAM
566          end function SimRequiresPrepairCalc
567 <
567 >        
568          function SimRequiresPostpairCalc() result(doesit)
569            logical :: doesit
570            doesit = thisSim%SIM_uses_RF
571          end function SimRequiresPostpairCalc
572  
573 <        subroutine InitializeSimGlobals(thisStat)
573 >        ! Function returns true if the simulation has this atype
574 >        function SimHasAtype(thisAtype) result(doesit)
575 >          logical :: doesit
576 >          integer :: thisAtype
577 >          doesit = .false.
578 >          if(.not.allocated(SimHasAtypeMap)) return
579 >
580 >          doesit = SimHasAtypeMap(thisAtype)
581 >            
582 >        end function SimHasAtype
583 >
584 >        subroutine createSimHasAtype(status)
585 >          integer, intent(out) :: status
586 >          integer :: alloc_stat
587 >          integer :: me_i
588 >          integer :: mpiErrors
589 >          integer :: nAtypes
590 >          status = 0
591 >
592 >          nAtypes = getSize(atypes)
593 >          ! Setup logical map for atypes in simulation
594 >          if (.not.allocated(SimHasAtypeMap)) then
595 >             allocate(SimHasAtypeMap(nAtypes),stat=alloc_stat)
596 >             if (alloc_stat /= 0 ) then
597 >                status = -1
598 >                return
599 >             end if
600 >             SimHasAtypeMap = .false.
601 >          end if
602 >          
603 >          ! Loop through the local atoms and grab the atypes present        
604 >          do me_i = 1,nLocal
605 >             SimHasAtypeMap(atid(me_i)) = .true.
606 >          end do
607 >          ! For MPI, we need to know all possible atypes present in
608 >          ! simulation on all processors. Use LOR operation to set map.
609 > #ifdef IS_MPI
610 >          if (.not.allocated(SimHasAtypeMapTemp)) then
611 >             allocate(SimHasAtypeMapTemp(nAtypes),stat=alloc_stat)
612 >             if (alloc_stat /= 0 ) then
613 >                status = -1
614 >                return
615 >             end if
616 >          end if
617 >          call mpi_allreduce(SimHasAtypeMap, SimHasAtypeMaptemp, nAtypes, &
618 >               mpi_logical, MPI_LOR, mpi_comm_world, mpiErrors)
619 >          simHasAtypeMap = simHasAtypeMapTemp
620 >          deallocate(simHasAtypeMapTemp)
621 > #endif          
622 >        end subroutine createSimHasAtype
623 >        
624 >       subroutine InitializeSimGlobals(thisStat)
625            integer, intent(out) :: thisStat
626            integer :: alloc_stat
627  
# Line 604 | Line 673 | contains
673            n = nLocal
674          end function getNlocal
675  
676 +
677 +
678 +
679 +
680        end module simulation

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines