ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/nonbonded/SHAPES.cpp
(Generate patch)

Comparing branches/development/src/nonbonded/SHAPES.cpp (file contents):
Revision 1502 by gezelter, Sat Oct 2 19:53:32 2010 UTC vs.
Revision 1874 by gezelter, Wed May 15 15:09:35 2013 UTC

# Line 35 | Line 35
35   *                                                                      
36   * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).            
37   * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).          
38 < * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).          
39 < * [4]  Vardeman & Gezelter, in progress (2009).                        
38 > * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).          
39 > * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 > * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
42  
43   #include <stdio.h>
# Line 49 | Line 50 | namespace OpenMD {
50  
51   using namespace std;
52   namespace OpenMD {
53 <  
53 <
53 >
54    SHAPES::SHAPES() {
55      initialized_ = false;
56      lMax_ = 64;
# Line 71 | Line 71 | namespace OpenMD {
71      for (at = atomTypes->beginType(i); at != NULL;
72           at = atomTypes->nextType(i)) {
73        
74 <      if (at->isShape() || at->isLennardJones())
75 <        addType(at);
74 >      if (at->isShape())
75 >        addShape(dynamic_cast<ShapeAtomType*>(at));
76 >
77 >      if (at->isLennardJones())
78 >        addLJ(at);
79 >      
80      }
81      
82      initialized_ = true;
83    }
84    
85 <  void SHAPES::addType(AtomType* atomType){
85 >  void SHAPES::addShape(ShapeAtomType* atomType){
86      // add it to the map:
87      AtomTypeProperties atp = atomType->getATP();    
88 <    
89 <    pair<map<int,AtomType*>::iterator,bool> ret;    
90 <    ret = ShapesMap.insert( pair<int, AtomType*>(atp.ident, atomType) );
91 <    if (ret.second == false) {
92 <      sprintf( painCave.errMsg,
93 <               "SHAPES already had a previous entry with ident %d\n",
94 <               atp.ident);
95 <      painCave.severity = OPENMD_INFO;
96 <      painCave.isFatal = 0;
97 <      simError();        
98 <    }  
99 <    
96 <    if (atomType->isShape()) {
97 <      ShapeAtomType* sAtomType = dynamic_cast<ShapeAtomType*>(atomType);
98 <      if (sAtomType == NULL) {
99 <        sprintf(painCave.errMsg,
100 <                "SHAPES:: Can't cast to ShapeAtomType");
101 <        painCave.severity = OPENMD_ERROR;
102 <        painCave.isFatal = 1;
103 <        simError();
104 <      }
105 <      ShapesMap.insert( pair<int, ShapeAtomType*>(atp.ident, sAtomType) );
88 >
89 >    if (atomType->isShape() ) {
90 >      pair<map<int,ShapeAtomType*>::iterator, bool> ret;
91 >      ret = ShapesMap.insert( pair<int, ShapeAtomType*>(atp.ident, atomType));
92 >      if (ret.second == false) {
93 >        sprintf( painCave.errMsg,
94 >                 "SHAPES already had a previous entry with ident %d\n",
95 >                 atp.ident);
96 >        painCave.severity = OPENMD_INFO;
97 >        painCave.isFatal = 0;
98 >        simError();        
99 >      }  
100        
101 +      ShapesMap.insert( pair<int, ShapeAtomType*>(atp.ident, static_cast<ShapeAtomType*>(atomType)) );
102 +      
103      } else if (atomType->isLennardJones()) {
104 <      d1 = getLJSigma(atomType) / sqrt(2.0);
105 <      e1 = getLJEpsilon(atomType);
104 >      RealType d1 = getLJSigma(atomType) / sqrt(2.0);
105 >      RealType e1 = getLJEpsilon(atomType);
106      } else {
107        sprintf( painCave.errMsg,
108                 "SHAPES::addType was passed an atomType (%s) that does not\n"
# Line 115 | Line 111 | namespace OpenMD {
111        painCave.severity = OPENMD_ERROR;
112        painCave.isFatal = 1;
113        simError();
114 <    }
119 <    
120 <
121 <    // Now, iterate over all known types and add to the mixing map:
122 <    
123 <    map<int, AtomType*>::iterator it;
124 <    for( it = ShapesMap.begin(); it != SHAPESMap.end(); ++it) {
125 <      
126 <      AtomType* atype2 = (*it).second;
127 <      
128 <      RealType d2, l2, e2, er2, dw2;
129 <      
130 <      if (atype2->isGayBerne()) {
131 <        GayBerneParam gb2 = getGayBerneParam(atype2);
132 <        d2 = gb2.SHAPES_d;
133 <        l2 = gb2.SHAPES_l;
134 <        e2 = gb2.SHAPES_eps;
135 <        er2 = gb2.SHAPES_eps_ratio;
136 <        dw2 = gb2.SHAPES_dw;
137 <      } else if (atype2->isLennardJones()) {
138 <        d2 = getLJSigma(atype2) / sqrt(2.0);
139 <        e2 = getLJEpsilon(atype2);
140 <        l2 = d2;
141 <        er2 = 1.0;
142 <        dw2 = 1.0;
143 <      }
144 <                      
145 <      SHAPESInteractionData mixer;        
146 <      
147 <      //  Cleaver paper uses sqrt of squares to get sigma0 for
148 <      //  mixed interactions.
149 <            
150 <      mixer.sigma0 = sqrt(d1*d1 + d2*d2);
151 <      mixer.xa2 = (l1*l1 - d1*d1)/(l1*l1 + d2*d2);
152 <      mixer.xai2 = (l2*l2 - d2*d2)/(l2*l2 + d1*d1);
153 <      mixer.x2 = (l1*l1 - d1*d1) * (l2*l2 - d2*d2) /
154 <        ((l2*l2 + d1*d1) * (l1*l1 + d2*d2));
155 <
156 <      // assumed LB mixing rules for now:
157 <
158 <      mixer.dw = 0.5 * (dw1 + dw2);
159 <      mixer.eps0 = sqrt(e1 * e2);
160 <      
161 <      RealType er = sqrt(er1 * er2);
162 <      RealType ermu = pow(er,(1.0 / mu_));
163 <      RealType xp = (1.0 - ermu) / (1.0 + ermu);
164 <      RealType ap2 = 1.0 / (1.0 + ermu);
165 <      
166 <      mixer.xp2 = xp * xp;
167 <      mixer.xpap2 = xp * ap2;
168 <      mixer.xpapi2 = xp / ap2;
169 <
170 <      // only add this pairing if at least one of the atoms is a Gay-Berne atom
171 <
172 <      if (atomType->isGayBerne() || atype2->isGayBerne()) {
173 <
174 <        pair<AtomType*, AtomType*> key1, key2;
175 <        key1 = make_pair(atomType, atype2);
176 <        key2 = make_pair(atype2, atomType);
177 <        
178 <        MixingMap[key1] = mixer;
179 <        if (key2 != key1) {
180 <          MixingMap[key2] = mixer;
181 <        }
182 <      }
183 <    }      
114 >    }  
115    }
116    
117  
# Line 336 | Line 267 | namespace OpenMD {
267          RealType proji = sqrt(r * 1.0e-12);
268          Vector3d dcpidx(1.0 / proji,
269                          0.0,
270 +
271 +                        // pickup the ball here!
272                          
273          dcpidx = 1.0_dp / proji
274            dcpidy = 0.0_dp

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines