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

Comparing trunk/mdtools/md_code/simulation_module.F90 (file contents):
Revision 230 by chuckv, Thu Jan 9 19:40:38 2003 UTC vs.
Revision 247 by chuckv, Mon Jan 27 18:28:11 2003 UTC

# Line 11 | Line 11 | module simulation
11  
12    type, public :: simtype
13       PRIVATE
14 <     SEQUENCE
14 > !     SEQUENCE
15   !! Number of particles on this processor
16       integer :: nLRparticles
17   !! Periodic Box    
# Line 38 | Line 38 | module simulation
38    integer, allocatable, dimension(:) :: tag_column
39   #endif
40  
41 <
41 > !! WARNING: use_pbc hardcoded, fixme
42 >  logical :: use_pbc = .true.
43    logical :: setSim = .false.
43  
44  real( kind = dp ), allocatable(:,:),save :: q0
44  
45 + !! array for saving previous positions for neighbor lists.  
46 +  real( kind = dp ), allocatable,dimension(:,:),save :: q0
47 +
48 +
49    public :: check
50    public :: save_nlist
51    public :: wrap
52    public :: getBox
53    public :: getRcut
54 <  public :: setRcut
54 >  public :: getRlist
55 >  public :: getNlocal
56 > !  public :: setRcut
57  
58    interface wrap
59       module procedure wrap_1d
# Line 73 | Line 78 | contains
78  
79    subroutine setSimulation(nLRParticles,box,rlist,rcut)
80      integer, intent(in) :: nLRParticles
81 <    real(kind = dp ), intent(in) :: box
81 >    real(kind = dp ), intent(in), dimension(3) :: box
82      real(kind = dp ), intent(in) :: rlist
83      real(kind = dp ), intent(in) :: rcut
84  
# Line 85 | Line 90 | contains
90      thisSim%rlist        = rlist
91      thisSim%rcut         = rcut
92      thisSim%rcutsq       = rcut * rcut
93 <    thisSim%rcut6        = rcutsq * rcutsq * rcutsq
93 >    thisSim%rcut6        = thisSim%rcutsq * thisSim%rcutsq * thisSim%rcutsq
94  
95    end subroutine setSimulation
96  
# Line 103 | Line 108 | contains
108    end subroutine change_box_size
109  
110  
111 <  elemental function getBox_3d() result(thisBox)
111 >  function getBox_3d() result(thisBox)
112      real( kind = dp ), dimension(3) :: thisBox
113      thisBox = thisSim%box
114    end function getBox_3d
# Line 115 | Line 120 | contains
120      thisBox = thisSim%box(dim)
121    end function getBox_dim
122      
123 <  subroutine check(update_nlist)
124 <  
123 >  subroutine check(q,update_nlist)
124 >    real( kind = dp ), dimension(:,:)  :: q
125      integer :: i
126      real( kind = DP ) :: dispmx
127      logical, intent(out) :: update_nlist
128      real( kind = DP ) :: dispmx_tmp
129 <    
129 >    real( kind = dp ) :: skin_thickness
130 >    integer :: natoms
131 >
132 >    natoms = thisSim%nLRparticles
133 >    skin_thickness = thisSim%rlist
134      dispmx = 0.0E0_DP
126    
135      !! calculate the largest displacement of any atom in any direction
136      
137   #ifdef MPI
# Line 159 | Line 167 | contains
167  
168      if (.not. allocated(q0)) then
169         allocate(q0(3,list_size))
170 <    else if( list_size > size(q0))
170 >    else if( list_size > size(q0)) then
171         deallocate(q0)
172         allocate(q0(3,list_size))
173      endif
# Line 186 | Line 194 | contains
194      return
195    end function wrap_1d
196  
197 <  elemental function wrap_3d(r) result(this_wrap)
197 >  function wrap_3d(r) result(this_wrap)
198      real( kind = dp ), dimension(3), intent(in) :: r
199      real( kind = dp ), dimension(3) :: this_wrap
200  
201      
202      if (use_pbc) then
203         !     this_wrap = r - box(dim)*dsign(1.0E0_DP,r)*int(abs(r/box(dim)) + 0.5E0_DP)
204 <       this_wrap(1:3) = r(1:3) - box(1:3)*nint(r(1:3)/box(1:3))
204 >       this_wrap = r - thisSim%box*nint(r/thisSim%box)
205      else
206         this_wrap = r
207      endif
208    end function wrap_3d
209  
210 <
211 <
210 >  
211 >
212    subroutine getRcut(thisrcut,rcut2,rcut6,status)
213      real( kind = dp ), intent(out) :: thisrcut
214      real( kind = dp ), intent(out), optional :: rcut2
215 <    real( kind = dp ), intent(out), optional :: thisrcut6
215 >    real( kind = dp ), intent(out), optional :: rcut6
216      integer, optional :: status
217  
218      if (present(status)) status = 0
# Line 214 | Line 222 | contains
222         return
223      end if
224      
225 <    thisrcut = rcut
226 <    if(present(rcut2)) rcut2 = rcutsq
227 <    if(present(rcut2)) rcut6 = rcut_6
225 >    thisrcut = thisSim%rcut
226 >    if(present(rcut2)) rcut2 = thisSim%rcutsq
227 >    if(present(rcut2)) rcut6 = thisSim%rcut6
228  
221
229    end subroutine getRcut
230    
231 +  
232 +  
233 +
234 +  subroutine getRlist(thisrlist,rlist2,status)
235 +    real( kind = dp ), intent(out) :: thisrlist
236 +    real( kind = dp ), intent(out), optional :: rlist2
237 +
238 +    integer, optional :: status
239 +
240 +    if (present(status)) status = 0
241 +
242 +    if (.not.setSim ) then
243 +       if (present(status)) status = -1
244 +       return
245 +    end if
246 +    
247 +    thisrlist = thisSim%rlist
248 +    if(present(rlist2)) rlist2 = thisSim%rlistsq
249 +
250 +  end subroutine getRlist
251 +  
252 +  
253 +
254 + pure function getNlocal() result(nlocal)
255 +    integer :: nlocal
256 +    nlocal = thisSim%nLRparticles
257 +  end function getNlocal
258 +
259 +
260 +
261   end module simulation

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines