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 483 by gezelter, Wed Apr 9 04:06:43 2003 UTC vs.
Revision 620 by mmeineke, Tue Jul 15 22:29:50 2003 UTC

# Line 20 | Line 20 | module simulation
20  
21    logical, save :: simulation_setup_complete = .false.
22  
23 <  integer, public, save :: natoms
23 >  integer, public, save :: nLocal, nGlobal
24    integer, public, save :: nExcludes_Global = 0
25    integer, public, save :: nExcludes_Local = 0
26    integer, allocatable, dimension(:,:), public :: excludesLocal
# Line 30 | Line 30 | module simulation
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
33 <  real(kind=dp), public, dimension(3), save :: box
34 <
33 >  real(kind=dp), public, dimension(3,3), save :: Hmat, HmatInv
34 >  logical, public, save :: boxIsOrthorhombic
35    
36    public :: SimulationSetup
37    public :: getNlocal
38    public :: setBox
39  public :: setBox_3d
40  public :: getBox
39    public :: setRcut
40    public :: getRcut
41    public :: getRlist
# Line 54 | Line 52 | module simulation
52    public :: SimRequiresPrepairCalc
53    public :: SimRequiresPostpairCalc
54    public :: SimUsesDirectionalAtoms
57
58  interface getBox
59     module procedure getBox_3d
60     module procedure getBox_1d
61  end interface
55    
63  interface setBox
64     module procedure setBox_3d
65     module procedure setBox_1d
66  end interface
67  
56   contains
57    
58 <  subroutine SimulationSetup(setThisSim, nComponents, c_idents, &
58 >  subroutine SimulationSetup(setThisSim, CnGlobal, CnLocal, c_idents, &
59         CnLocalExcludes, CexcludesLocal, CnGlobalExcludes, CexcludesGlobal, &
60         CmolMembership, &
61         status)    
62  
63      type (simtype) :: setThisSim
64 <    integer, intent(inout) :: nComponents
65 <    integer, dimension(nComponents),intent(inout) :: c_idents
64 >    integer, intent(inout) :: CnGlobal, CnLocal
65 >    integer, dimension(CnLocal),intent(inout) :: c_idents
66  
67      integer :: CnLocalExcludes
68      integer, dimension(2,CnLocalExcludes), intent(in) :: CexcludesLocal
69      integer :: CnGlobalExcludes
70      integer, dimension(CnGlobalExcludes), intent(in) :: CexcludesGlobal
71 <    integer, dimension(nComponents),intent(in) :: CmolMembership
71 >    integer, dimension(CnGlobal),intent(in) :: CmolMembership
72      !!  Result status, success = 0, status = -1
73      integer, intent(out) :: status
74      integer :: i, me, thisStat, alloc_stat, myNode
# Line 95 | Line 83 | contains
83      status = 0
84  
85      ! copy C struct into fortran type
86 +
87 +    nLocal = CnLocal
88 +    nGlobal = CnGlobal
89 +
90      thisSim = setThisSim
91 <    natoms = nComponents
91 >
92      rcut2 = thisSim%rcut * thisSim%rcut
93      rcut6 = rcut2 * rcut2 * rcut2
94      rlist2 = thisSim%rlist * thisSim%rlist
103    box = thisSim%box
95  
96      nExcludes_Global = CnGlobalExcludes
97      nExcludes_Local = CnLocalExcludes
98  
99 <    call InitializeForceGlobals(natoms, thisStat)
99 >    call InitializeForceGlobals(nLocal, thisStat)
100      if (thisStat /= 0) then
101         write(default_error,*) "SimSetup: InitializeForceGlobals error"
102         status = -1
# Line 164 | Line 155 | contains
155      endif
156      
157   #else
158 <    do i = 1, nComponents
158 >    do i = 1, nLocal
159        
160         me = getFirstMatchingElement(atypes, "c_ident", c_idents(i))
161         atid(i) = me
# Line 183 | Line 174 | contains
174         excludesGlobal(i) = CexcludesGlobal(i)
175      enddo
176  
177 <    do i = 1, nComponents
177 >    do i = 1, nGlobal
178         molMemberShipList(i) = CmolMembership(i)
179 <       ! write(0,*) 'molMembershipList(',i,') = ', molMemberShipList(i)
189 <    enddo
179 >     enddo
180  
181      if (status == 0) simulation_setup_complete = .true.
182      
183    end subroutine SimulationSetup
184    
185 <  subroutine setBox_3d(new_box_size)
186 <    real(kind=dp), dimension(3) :: new_box_size
185 >  subroutine setBox(cHmat, cHmatInv, cBoxIsOrthorhombic)
186 >    real(kind=dp), dimension(3,3) :: cHmat, cHmatInv
187 >    integer :: cBoxIsOrthorhombic
188      integer :: smallest, status, i
189 <
190 <    thisSim%box = new_box_size
191 <    box = thisSim%box
192 <
189 >    
190 >    Hmat = cHmat
191 >    HmatInv = cHmatInv
192 >    if (cBoxIsOrthorhombic .eq. 0 ) then
193 >       boxIsOrthorhombic = .false.
194 >    else
195 >       boxIsOrthorhombic = .true.
196 >    endif
197 >    
198      return    
199 <  end subroutine setBox_3d
199 >  end subroutine setBox
200  
205  subroutine setBox_1d(dim, new_box_size)
206    integer :: dim, status
207    real(kind=dp) :: new_box_size
208    thisSim%box(dim) = new_box_size
209    box(dim) = thisSim%box(dim)
210  end subroutine setBox_1d
211
201    subroutine setRcut(new_rcut, status)
202      real(kind = dp) :: new_rcut
203      integer :: myStatus, status
# Line 218 | Line 207 | contains
207      status = 0
208      return
209    end subroutine setRcut
221
222  function getBox_3d() result(thisBox)
223    real( kind = dp ), dimension(3) :: thisBox
224    thisBox = thisSim%box
225  end function getBox_3d
226  
227  function getBox_1d(dim) result(thisBox)
228    integer, intent(in) :: dim
229    real( kind = dp ) :: thisBox
230    
231    thisBox = thisSim%box(dim)
232  end function getBox_1d
210      
211    subroutine getRcut(thisrcut,rc2,rc6,status)
212      real( kind = dp ), intent(out) :: thisrcut
# Line 269 | Line 246 | contains
246    function getRrf() result(rrf)
247      real( kind = dp ) :: rrf
248      rrf = thisSim%rrf
249 <    write(*,*) 'getRrf = ', rrf, thisSim%rrf
273 <  end function getRrf
249 >   end function getRrf
250    
251    function getRt() result(rt)
252      real( kind = dp ) :: rt
253      rt = thisSim%rt
254 <  end function getRt
254 >   end function getRt
255  
256    function getDielect() result(dielect)
257      real( kind = dp ) :: dielect
# Line 353 | Line 329 | contains
329         return
330      endif
331  
332 <    allocate(molMembershipList(getNlocal()), stat=alloc_stat)
332 >    allocate(molMembershipList(nGlobal), stat=alloc_stat)
333      if (alloc_stat /= 0 ) then
334         thisStat = -1
335         return
# Line 371 | Line 347 | contains
347  
348    end subroutine FreeSimGlobals
349  
350 <  pure function getNlocal() result(nlocal)
351 <    integer :: nlocal
352 <    nlocal = natoms
350 >  pure function getNlocal() result(n)
351 >    integer :: n
352 >    n = nLocal
353    end function getNlocal
354  
355    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines