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

Comparing trunk/OOPSE/libmdtools/calc_LJ_FF.F90 (file contents):
Revision 611 by gezelter, Tue Jul 15 17:10:50 2003 UTC vs.
Revision 999 by chrisfen, Fri Jan 30 15:01:09 2004 UTC

# Line 2 | Line 2
2   !! Corresponds to the force field defined in lj_FF.cpp
3   !! @author Charles F. Vardeman II
4   !! @author Matthew Meineke
5 < !! @version $Id: calc_LJ_FF.F90,v 1.7 2003-07-15 17:10:50 gezelter Exp $, $Date: 2003-07-15 17:10:50 $, $Name: not supported by cvs2svn $, $Revision: 1.7 $
5 > !! @version $Id: calc_LJ_FF.F90,v 1.16 2004-01-30 15:01:09 chrisfen Exp $, $Date: 2004-01-30 15:01:09 $, $Name: not supported by cvs2svn $, $Revision: 1.16 $
6  
7   module lj
8    use definitions
# Line 21 | Line 21 | module lj
21   #include "fForceField.h"
22  
23    integer, save :: LJ_Mixing_Policy
24 <  integer, save :: LJ_rcut
24 >  real(kind=DP), save :: LJ_rcut
25 >  logical, save :: havePolicy = .false., haveCut = .false.
26 >
27    
28    !! Logical has lj force field module been initialized?
29    
# Line 29 | Line 31 | module lj
31    
32    !! Public methods and data
33    public :: init_LJ_FF
34 <  public :: LJ_new_rcut
34 >  public :: setCutoffLJ
35    public :: do_lj_pair
36    
37    type :: lj_mixed_params
# Line 45 | Line 47 | module lj
47  
48       real ( kind = dp )  :: delta  = 0.0_dp
49  
50 +
51    end type lj_mixed_params
52    
53    type (lj_mixed_params), dimension(:,:), pointer :: ljMixed
54    
55   contains
56  
57 <  subroutine init_LJ_FF(mix_Policy, rcut, status)
57 >  subroutine init_LJ_FF(mix_Policy, status)
58      integer, intent(in) :: mix_Policy
59      integer, intent(out) :: status
60      integer :: myStatus
58    real(kind=dp) :: rcut
61      
62      if (mix_Policy == LB_MIXING_RULE) then
63         LJ_Mixing_Policy = LB_MIXING_RULE
# Line 68 | Line 70 | contains
70            return
71         endif
72      endif
71    
72    LJ_rcut = rcut
73  
74 <    status = 0
75 <    call createMixingList(myStatus)
76 <    if (myStatus /= 0) then
77 <       status = -1
78 <       return
74 >    havePolicy = .true.
75 >
76 >    if (haveCut) then
77 >       status = 0
78 >       call createMixingList(myStatus)
79 >       if (myStatus /= 0) then
80 >          status = -1
81 >          return
82 >       end if
83 >      
84 >       LJ_FF_initialized = .true.
85      end if
86 <    
81 <    LJ_FF_initialized = .true.
82 <    
86 >  
87    end subroutine init_LJ_FF
88    
89 <  subroutine LJ_new_rcut(rcut, status)
89 >  subroutine setCutoffLJ(rcut, status)
90      integer :: status, myStatus
91      real(kind=dp) :: rcut
92 <
89 <    LJ_rcut = rcut
92 >    
93      status = 0
91    call createMixingList(myStatus)
92    if (myStatus /= 0) then
93       status = -1
94       return
95    end if
94  
95 + !    LJ_rcut = rcut
96 +    ! ATTENTION! This is a hardwiring of rcut!
97 +    LJ_rcut = 9.0d0
98 +    haveCut = .true.
99 +
100 +    if (havePolicy) then
101 +       status = 0
102 +       call createMixingList(myStatus)
103 +       if (myStatus /= 0) then
104 +          status = -1
105 +          return
106 +       end if
107 +      
108 +       LJ_FF_initialized = .true.
109 +    end if    
110 +    
111      return
112 <  end subroutine LJ_new_rcut
112 >  end subroutine setCutoffLJ
113    
114    subroutine createMixingList(status)
115      integer :: nAtypes
# Line 115 | Line 129 | contains
129          
130      if (.not. associated(ljMixed)) then
131         allocate(ljMixed(nAtypes, nAtypes))
132 <    else
119 <       status = -1
120 <       return
121 <    end if
132 >    endif
133  
134      rcut6 = LJ_rcut**6
135  
136 + ! This loops through all atypes, even those that don't support LJ forces.
137      do i = 1, nAtypes
138  
139         call getElementProperty(atypes, i, "lj_epsilon", myEpsilon_i)
# Line 129 | Line 141 | contains
141         ! do self mixing rule
142         ljMixed(i,i)%sigma   = mySigma_i
143        
144 <       ljMixed(i,i)%sigma6  = (ljMixed(i,i)%sigma) ** 6                                                                                                  
133 <       ljMixed(i,i)%tp6     = ljMixed(i,i)%sigma6/rcut6
144 >       ljMixed(i,i)%sigma6  = (ljMixed(i,i)%sigma) ** 6
145  
146 +       ljMixed(i,i)%tp6     = (ljMixed(i,i)%sigma6)/rcut6
147 +
148         ljMixed(i,i)%tp12    = (ljMixed(i,i)%tp6) ** 2
149  
150 +
151         ljMixed(i,i)%epsilon = myEpsilon_i
152  
153         ljMixed(i,i)%delta = -4.0_DP * ljMixed(i,i)%epsilon * &
# Line 181 | Line 195 | contains
195      integer, intent(in) ::  atom1, atom2
196      real( kind = dp ), intent(in) :: rij, r2
197      real( kind = dp ) :: pot
198 <    real( kind = dp ), dimension(3,getNlocal()) :: f    
198 >    real( kind = dp ), dimension(3,nLocal) :: f    
199      real( kind = dp ), intent(in), dimension(3) :: d
200      logical, intent(in) :: do_pot, do_stress
201  
# Line 197 | Line 211 | contains
211      real( kind = dp ) :: delta
212      integer :: id1, id2
213  
200
214      if (rij.lt.LJ_rcut)  then
215  
216         ! Look up the correct parameters in the mixing matrix
# Line 306 | Line 319 | contains
319      
320      if (present(status)) status = 0
321      select case (LJ_Mixing_Policy)
322 <    case (LB_MIXING_RULE)
322 >    case (1)
323         select case (thisParam)
324         case ("sigma")
325            myMixParam = 0.5_dp * (param1 + param2)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines