ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE_old/src/mdtools/libmdCode/simulation_module.F90
(Generate patch)

Comparing trunk/OOPSE_old/src/mdtools/libmdCode/simulation_module.F90 (file contents):
Revision 328 by gezelter, Wed Mar 12 20:00:58 2003 UTC vs.
Revision 330 by gezelter, Wed Mar 12 23:15:46 2003 UTC

# Line 19 | Line 19 | module simulation
19    logical, save :: simulation_setup_complete = .false.
20  
21    integer :: natoms
22 +  integer, public, save :: nExcludes_Global = 0
23 +  integer, public, save :: nExcludes_Local = 0
24    real(kind=dp), save :: rcut2 = 0.0_DP
25    real(kind=dp), save :: rcut6 = 0.0_DP
26    real(kind=dp), save :: rlist2 = 0.0_DP
27 +  real(kind=dp), public, dimension(3), save :: box
28  
29   #ifdef IS_MPI
30    real( kind = dp ), allocatable, dimension(:,:), public :: q_Row
# Line 40 | Line 43 | module simulation
43    real( kind = dp ), allocatable, dimension(:,:), public :: t_Row
44    real( kind = dp ), allocatable, dimension(:,:), public :: t_Col
45    real( kind = dp ), allocatable, dimension(:,:), public :: t_Temp
46 +  real( kind = dp ), allocatable, dimension(:,:), public :: rf_Row
47 +  real( kind = dp ), allocatable, dimension(:,:), public :: rf_Col
48 +  real( kind = dp ), allocatable, dimension(:,:), public :: rf_Temp
49 +
50    integer, allocatable, dimension(:), public :: atid_Row
51    integer, allocatable, dimension(:), public :: atid_Col
52   #else
53    integer, allocatable, dimension(:), public :: atid
54   #endif
55 +  real( kind = dp ), allocatable, dimension(:,:), public :: rf
56 +  real(kind = dp), dimension(9), public :: tau_Temp = 0.0_dp
57 +  real(kind = dp), public :: virial_Temp = 0.0_dp
58    
59    public :: SimulationSetup
60    public :: getBox
# Line 52 | Line 62 | module simulation
62    public :: getRlist
63    public :: getRrf
64    public :: getRt
65 +  public :: getDielect
66    public :: getNlocal
67    public :: SimUsesPBC
68    public :: SimUsesLJ
# Line 101 | Line 112 | contains
112      rcut2 = thisSim%rcut * thisSim%rcut
113      rcut6 = rcut2 * rcut2 * rcut2
114      rlist2 = thisSim%rlist * thisSim%rlist
115 +    box = thisSim%box
116  
117   #ifdef IS_MPI
118      ! We can only set up forces if mpiSimulation has been setup.
# Line 187 | Line 199 | contains
199    subroutine change_box_size(new_box_size)
200      real(kind=dp), dimension(3) :: new_box_size
201      thisSim%box = new_box_size
202 +    box = thisSim%box
203    end subroutine change_box_size
204  
205    function getBox_3d() result(thisBox)
# Line 245 | Line 258 | contains
258      real( kind = dp ) :: rt
259      rt = thisSim%rt
260    end function getRt
261 +
262 +  function getDielect() result(dielect)
263 +    real( kind = dp ) :: dielect
264 +    dielect = thisSim%dielect
265 +  end function getDielect
266    
267    pure function getNlocal() result(nlocal)
268      integer :: nlocal
# Line 286 | Line 304 | contains
304      doesit = thisSim%SIM_uses_EAM
305    end function SimUsesEAM
306  
307 +  function SimUsesDirectionalAtoms() result(doesit)
308 +    logical :: doesit
309 +    doesit = thisSim%SIM_uses_dipoles .or. thisSim%SIM_uses_sticky .or. &
310 +         thisSim%SIM_uses_GB .or. thisSim%SIM_uses_RF
311 +  end function SimUsesDirectionalAtoms
312 +
313    function SimRequiresPrepairCalc() result(doesit)
314      logical :: doesit
315      doesit = thisSim%SIM_uses_EAM
# Line 413 | Line 437 | contains
437      endif
438  
439      allocate(atid_Col(ncol),stat=alloc_stat)
440 +    if (alloc_stat /= 0 ) then
441 +       thisStat = 0
442 +       return
443 +    endif
444 +
445 +    allocate(rf_Row(ndim,nrow),stat=alloc_stat)
446 +    if (alloc_stat /= 0 ) then
447 +       thisStat = 0
448 +       return
449 +    endif
450 +
451 +    allocate(rf_Col(ndim,ncol),stat=alloc_stat)
452      if (alloc_stat /= 0 ) then
453         thisStat = 0
454         return
455      endif
456  
457 +    allocate(rf_Temp(ndim,nlocal),stat=alloc_stat)
458 +    if (alloc_stat /= 0 ) then
459 +       thisStat = 0
460 +       return
461 +    endif
462 +
463 +
464   #else
465  
466      allocate(atid(nlocal),stat=alloc_stat)
# Line 427 | Line 470 | contains
470      end if
471  
472   #endif
473 +    
474 +    allocate(rf(ndim,nlocal),stat=alloc_stat)
475 +    if (alloc_stat /= 0 ) then
476 +       thisStat = 0
477 +       return
478 +    endif
479  
480    end subroutine setupGlobals
481    
482    subroutine freeGlobals()
483      
484      !We free in the opposite order in which we allocate in.
436 #ifdef IS_MPI
485  
486 +    if (allocated(rf))         deallocate(rf)
487 + #ifdef IS_MPI
488 +    if (allocated(rf_Temp))     deallocate(rf_Temp)
489 +    if (allocated(rf_Col))     deallocate(rf_Col)
490 +    if (allocated(rf_Row))     deallocate(rf_Row)    
491      if (allocated(atid_Col))   deallocate(atid_Col)
492      if (allocated(atid_Row))   deallocate(atid_Row)
493      if (allocated(t_Temp))     deallocate(t_Temp)
# Line 451 | Line 504 | contains
504      if (allocated(u_l_Col))    deallocate(u_l_Col)
505      if (allocated(u_l_Row))    deallocate(u_l_Row)
506      if (allocated(q_Col))      deallocate(q_Col)
507 <    if (allocated(q_Row))      deallocate(q_Row)
508 <    
509 < #else
457 <    
458 <    if (allocated(atid))       deallocate(atid)
459 <    
507 >    if (allocated(q_Row))      deallocate(q_Row)    
508 > #else    
509 >    if (allocated(atid))       deallocate(atid)    
510   #endif
511          
512    end subroutine freeGlobals

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines