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 2274 by gezelter, Wed Aug 17 15:26:42 2005 UTC vs.
Revision 2592 by gezelter, Thu Feb 16 21:40:20 2006 UTC

# Line 43 | Line 43 | module simulation
43  
44   module simulation
45    use definitions
46 +  use status
47 +  use linearAlgebra
48    use neighborLists
49    use force_globals
50    use vector_class
# Line 58 | Line 60 | module simulation
60   #define __FORTRAN90
61   #include "brains/fSimulation.h"
62   #include "UseTheForce/fSwitchingFunction.h"
63 + #include "UseTheForce/DarkSide/fElectrostaticSummationMethod.h"
64  
65    type (simtype), public, save :: thisSim
66  
# Line 83 | Line 86 | module simulation
86    real(kind=dp), allocatable, dimension(:), public :: mfactLocal
87  
88    logical, allocatable, dimension(:) :: simHasAtypeMap
89 + #ifdef IS_MPI
90 +  logical, allocatable, dimension(:) :: simHasAtypeMapTemp
91 + #endif
92 +
93    real(kind=dp), public, dimension(3,3), save :: Hmat, HmatInv
94 +  real(kind=dp), save :: DangerRcut
95    logical, public, save :: boxIsOrthorhombic
96  
97    public :: SimulationSetup
98    public :: getNlocal
99    public :: setBox
100 +  public :: checkBox
101    public :: getDielect
102    public :: SimUsesPBC
103  
# Line 104 | Line 113 | module simulation
113    public :: SimUsesShapes
114    public :: SimUsesFLARB
115    public :: SimUsesRF
116 +  public :: SimUsesSF
117    public :: SimRequiresPrepairCalc
118    public :: SimRequiresPostpairCalc
119    public :: SimHasAtype
120 +  public :: SimUsesSC
121 +  public :: SimUsesMEAM
122 +  public :: setHmatDangerousRcutValue
123  
124   contains
125  
# Line 470 | Line 483 | contains
483          subroutine setBox(cHmat, cHmatInv, cBoxIsOrthorhombic)
484            real(kind=dp), dimension(3,3) :: cHmat, cHmatInv
485            integer :: cBoxIsOrthorhombic
486 <          integer :: smallest, status, i
486 >          integer :: smallest, status
487  
488            Hmat = cHmat
489            HmatInv = cHmatInv
# Line 480 | Line 493 | contains
493               boxIsOrthorhombic = .true.
494            endif
495  
496 <          return    
496 >          call checkBox()
497 >          return
498          end subroutine setBox
499  
500 +        subroutine checkBox()
501 +
502 +          integer :: i
503 +          real(kind=dp), dimension(3) :: hx, hy, hz, ax, ay, az, piped
504 +          character(len = statusMsgSize) :: errMsg
505 +
506 +          hx = Hmat(1,:)
507 +          hy = Hmat(2,:)
508 +          hz = Hmat(3,:)
509 +
510 +          ax = cross_product(hy, hz)
511 +          ay = cross_product(hx, hz)
512 +          az = cross_product(hx, hy)
513 +
514 +          ax = ax / length(ax)
515 +          ay = ay / length(ay)
516 +          az = az / length(az)
517 +
518 +          piped(1) = abs(dot_product(ax, hx))
519 +          piped(2) = abs(dot_product(ay, hy))
520 +          piped(3) = abs(dot_product(az, hz))
521 +          
522 +          do i = 1, 3
523 +             if ((0.5_dp * piped(i)).lt.DangerRcut) then                
524 +                write(errMsg, '(a94,f9.4,a1)') 'One of the dimensions of the Periodic ' &
525 +                     // 'Box is smaller than ' // newline // tab // &
526 +                     'the largest cutoff radius' // &
527 +                     ' (rCut = ', DangerRcut, ')'
528 +                call handleError("checkBox", errMsg)
529 +             end if
530 +          enddo        
531 +          return    
532 +        end subroutine checkBox
533 +
534          function getDielect() result(dielect)
535            real( kind = dp ) :: dielect
536            dielect = thisSim%dielect
# Line 540 | Line 588 | contains
588            doesit = thisSim%SIM_uses_EAM
589          end function SimUsesEAM
590  
591 +
592 +        function SimUsesSC() result(doesit)
593 +          logical :: doesit
594 +          doesit = thisSim%SIM_uses_SC
595 +        end function SimUsesSC
596 +
597 +        function SimUsesMEAM() result(doesit)
598 +          logical :: doesit
599 +          doesit = thisSim%SIM_uses_MEAM
600 +        end function SimUsesMEAM
601 +
602 +
603          function SimUsesShapes() result(doesit)
604            logical :: doesit
605            doesit = thisSim%SIM_uses_Shapes
# Line 555 | Line 615 | contains
615            doesit = thisSim%SIM_uses_RF
616          end function SimUsesRF
617  
618 +        function SimUsesSF() result(doesit)
619 +          logical :: doesit
620 +          doesit = thisSim%SIM_uses_SF
621 +        end function SimUsesSF
622 +
623          function SimRequiresPrepairCalc() result(doesit)
624            logical :: doesit
625 <          doesit = thisSim%SIM_uses_EAM
625 >          doesit = thisSim%SIM_uses_EAM .or. thisSim%SIM_uses_SC &
626 >               .or. thisSim%SIM_uses_MEAM
627          end function SimRequiresPrepairCalc
628 <
628 >        
629          function SimRequiresPostpairCalc() result(doesit)
630            logical :: doesit
631 <          doesit = thisSim%SIM_uses_RF
631 >          doesit = thisSim%SIM_uses_RF .or. thisSim%SIM_uses_SF
632          end function SimRequiresPostpairCalc
633  
634          ! Function returns true if the simulation has this atype
# Line 594 | Line 660 | contains
660               end if
661               SimHasAtypeMap = .false.
662            end if
663 +          
664            ! Loop through the local atoms and grab the atypes present        
665            do me_i = 1,nLocal
666               SimHasAtypeMap(atid(me_i)) = .true.
# Line 601 | Line 668 | contains
668            ! For MPI, we need to know all possible atypes present in
669            ! simulation on all processors. Use LOR operation to set map.
670   #ifdef IS_MPI
671 <          call mpi_allreduce(SimHasAtypeMap, SimHasAtypeMap, nAtypes, &
671 >          if (.not.allocated(SimHasAtypeMapTemp)) then
672 >             allocate(SimHasAtypeMapTemp(nAtypes),stat=alloc_stat)
673 >             if (alloc_stat /= 0 ) then
674 >                status = -1
675 >                return
676 >             end if
677 >          end if
678 >          call mpi_allreduce(SimHasAtypeMap, SimHasAtypeMaptemp, nAtypes, &
679                 mpi_logical, MPI_LOR, mpi_comm_world, mpiErrors)
680 +          simHasAtypeMap = simHasAtypeMapTemp
681 +          deallocate(simHasAtypeMapTemp)
682   #endif          
683          end subroutine createSimHasAtype
684          
# Line 658 | Line 734 | contains
734            n = nLocal
735          end function getNlocal
736  
737 +        subroutine setHmatDangerousRcutValue(dangerWillRobinson)
738 +          real(kind=dp), intent(in) :: dangerWillRobinson
739 +          DangerRcut = dangerWillRobinson
740  
741 +          call checkBox()
742  
743 +          return
744 +        end subroutine setHmatDangerousRcutValue
745  
746  
747 +
748        end module simulation

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines