ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/simulation_module.F90
(Generate patch)

Comparing trunk/OOPSE/libmdtools/simulation_module.F90 (file contents):
Revision 569 by mmeineke, Tue Jul 1 21:33:45 2003 UTC vs.
Revision 1144 by tim, Sat May 1 18:52:38 2004 UTC

# Line 16 | Line 16 | module simulation
16   #define __FORTRAN90
17   #include "fSimulation.h"
18  
19 <  type (simtype), public :: thisSim
19 >  type (simtype), public, save :: thisSim
20  
21    logical, save :: simulation_setup_complete = .false.
22  
# Line 27 | Line 27 | module simulation
27    integer, allocatable, dimension(:), public :: excludesGlobal
28    integer, allocatable, dimension(:), public :: molMembershipList
29  
30  real(kind=dp), save :: rcut2 = 0.0_DP
31  real(kind=dp), save :: rcut6 = 0.0_DP
32  real(kind=dp), save :: rlist2 = 0.0_DP
30    real(kind=dp), public, dimension(3,3), save :: Hmat, HmatInv
31 <  logical, save :: boxIsOrthorhombic
31 >  logical, public, save :: boxIsOrthorhombic
32    
33    public :: SimulationSetup
34    public :: getNlocal
35    public :: setBox
39  public :: setRcut
40  public :: getRcut
41  public :: getRlist
42  public :: getRrf
43  public :: getRt
36    public :: getDielect
37    public :: SimUsesPBC
38    public :: SimUsesLJ
39 +  public :: SimUsesCharges
40    public :: SimUsesDipoles
41    public :: SimUsesSticky
42    public :: SimUsesRF
# Line 57 | Line 50 | contains
50    
51    subroutine SimulationSetup(setThisSim, CnGlobal, CnLocal, c_idents, &
52         CnLocalExcludes, CexcludesLocal, CnGlobalExcludes, CexcludesGlobal, &
53 <       CmolMembership, &
53 >       CmolMembership, mfact, ngroup, groupList, groupStart, &
54         status)    
55  
56      type (simtype) :: setThisSim
# Line 72 | Line 65 | contains
65      !!  Result status, success = 0, status = -1
66      integer, intent(out) :: status
67      integer :: i, me, thisStat, alloc_stat, myNode
68 +
69 +    !! mass factors used for molecular cutoffs
70 +    real ( kind = dp ), dimension(3,nLocal) :: mfact
71 +    integer, intent(in):: ngroup
72 +    integer, dimension(nLocal),intent(in) :: groupList
73 +    integer, dimension(ngroup),intent(in) :: groupStart
74 +
75   #ifdef IS_MPI
76      integer, allocatable, dimension(:) :: c_idents_Row
77      integer, allocatable, dimension(:) :: c_idents_Col
# Line 88 | Line 88 | contains
88      nGlobal = CnGlobal
89  
90      thisSim = setThisSim
91    rcut2 = thisSim%rcut * thisSim%rcut
92    rcut6 = rcut2 * rcut2 * rcut2
93    rlist2 = thisSim%rlist * thisSim%rlist
94    box = thisSim%box
91  
92      nExcludes_Global = CnGlobalExcludes
93      nExcludes_Local = CnLocalExcludes
# Line 154 | Line 150 | contains
150         deallocate(c_idents_Row)
151      endif
152      
153 < #else
153 > #endif
154 >
155 > ! We build the local atid's for both mpi and nonmpi
156      do i = 1, nLocal
157        
158         me = getFirstMatchingElement(atypes, "c_ident", c_idents(i))
159         atid(i) = me
160    
161      enddo
164 #endif
162  
163  
164  
165 +
166      do i = 1, nExcludes_Local
167         excludesLocal(1,i) = CexcludesLocal(1,i)
168         excludesLocal(2,i) = CexcludesLocal(2,i)
# Line 183 | Line 181 | contains
181    end subroutine SimulationSetup
182    
183    subroutine setBox(cHmat, cHmatInv, cBoxIsOrthorhombic)
184 <    real(kind=dp), dimension(3,3) :: cHmat, cHamtInv
184 >    real(kind=dp), dimension(3,3) :: cHmat, cHmatInv
185      integer :: cBoxIsOrthorhombic
186      integer :: smallest, status, i
187 <
187 >    
188      Hmat = cHmat
189      HmatInv = cHmatInv
190 <    if(cBoxisOrthorhombic .eq. 0 )then
190 >    if (cBoxIsOrthorhombic .eq. 0 ) then
191         boxIsOrthorhombic = .false.
192 <    else boxIsOrthorhombic = .true.
192 >    else
193 >       boxIsOrthorhombic = .true.
194      endif
195      
197
196      return    
197    end subroutine setBox
198  
201  subroutine setRcut(new_rcut, status)
202    real(kind = dp) :: new_rcut
203    integer :: myStatus, status
204    thisSim%rcut = new_rcut
205    rcut2 = thisSim%rcut * thisSim%rcut
206    rcut6 = rcut2 * rcut2 * rcut2
207    status = 0
208    return
209  end subroutine setRcut
210    
211  subroutine getRcut(thisrcut,rc2,rc6,status)
212    real( kind = dp ), intent(out) :: thisrcut
213    real( kind = dp ), intent(out), optional :: rc2
214    real( kind = dp ), intent(out), optional :: rc6
215    integer, optional :: status
216
217    if (present(status)) status = 0
218    
219    if (.not.simulation_setup_complete ) then
220       if (present(status)) status = -1
221       return
222    end if
223    
224    thisrcut = thisSim%rcut
225    if(present(rc2)) rc2 = rcut2
226    if(present(rc6)) rc6 = rcut6
227  end subroutine getRcut
228  
229  subroutine getRlist(thisrlist,rl2,status)
230    real( kind = dp ), intent(out) :: thisrlist
231    real( kind = dp ), intent(out), optional :: rl2
232
233    integer, optional :: status
234
235    if (present(status)) status = 0
236
237    if (.not.simulation_setup_complete ) then
238       if (present(status)) status = -1
239       return
240    end if
241    
242    thisrlist = thisSim%rlist
243    if(present(rl2)) rl2 = rlist2
244  end subroutine getRlist
245
246  function getRrf() result(rrf)
247    real( kind = dp ) :: rrf
248    rrf = thisSim%rrf
249    write(*,*) 'getRrf = ', rrf, thisSim%rrf
250  end function getRrf
251  
252  function getRt() result(rt)
253    real( kind = dp ) :: rt
254    rt = thisSim%rt
255  end function getRt
256
199    function getDielect() result(dielect)
200      real( kind = dp ) :: dielect
201      dielect = thisSim%dielect
# Line 274 | Line 216 | contains
216      doesit = thisSim%SIM_uses_sticky
217    end function SimUsesSticky
218  
219 +  function SimUsesCharges() result(doesit)
220 +    logical :: doesit
221 +    doesit = thisSim%SIM_uses_charges
222 +  end function SimUsesCharges
223 +
224    function SimUsesDipoles() result(doesit)
225      logical :: doesit
226      doesit = thisSim%SIM_uses_dipoles

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines