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

Comparing:
trunk/src/visitors/ReplacementVisitor.cpp (file contents), Revision 1455 by gezelter, Thu Jun 24 20:44:18 2010 UTC vs.
branches/development/src/visitors/ReplacementVisitor.cpp (file contents), Revision 1665 by gezelter, Tue Nov 22 20:38:56 2011 UTC

# Line 36 | Line 36
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).                        
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 <cstring>
# Line 74 | Line 75 | namespace OpenMD {
75      AtomInfo* atomInfo = new AtomInfo();
76      atomInfo->atomTypeName = name;
77      atomInfo->pos = refPos;
78 <    atomInfo->dipole = refVec;
78 >    atomInfo->vec = refVec;
79      atomInfo->hasVector = true;
80      sites_->addAtomInfo(atomInfo);
81    }
# Line 82 | Line 83 | namespace OpenMD {
83    void ReplacementVisitor::visit(DirectionalAtom *datom) {
84      std::vector<AtomInfo*>atoms;
85      
86 <    RotMat3x3d   rotMatrix;
87 <    RotMat3x3d   rotTrans;
88 <    AtomInfo *   atomInfo;
86 >    RotMat3x3d   A;
87 >    RotMat3x3d   Atrans;
88 >    Mat3x3d      I;
89      Vector3d     pos;
90 +    Vector3d     vel;
91 +    Vector3d     frc;
92 +    Vector3d     trq;
93 +    Vector3d     j;
94 +    Mat3x3d      skewMat;
95 +
96      Vector3d     newVec;
97 <    Quat4d       q;
97 >    AtomInfo *   atomInfo;
98      AtomData *   atomData;
99      GenericData *data;
100      bool         haveAtomData;
# Line 111 | Line 118 | namespace OpenMD {
118        atomData = new AtomData;
119        haveAtomData = false;
120      }
121 <    
115 <    
121 >        
122      pos = datom->getPos();
123 <    q = datom->getQ();
124 <    rotMatrix = datom->getA();
123 >    vel = datom->getVel();
124 >
125 >    j   = datom->getJ();
126 >    I   = datom->getI();
127 >    A   = datom->getA();
128 >
129 >    skewMat(0, 0) =  0;
130 >    skewMat(0, 1) =  j[2] / I(2, 2);
131 >    skewMat(0, 2) = -j[1] / I(1, 1);    
132 >    skewMat(1, 0) = -j[2] / I(2, 2);
133 >    skewMat(1, 1) =  0;
134 >    skewMat(1, 2) =  j[0] / I(0, 0);    
135 >    skewMat(2, 0) =  j[1] / I(1, 1);
136 >    skewMat(2, 1) = -j[0] / I(0, 0);
137 >    skewMat(2, 2) =  0;
138 >    Mat3x3d mat = (A * skewMat).transpose();
139      
140      // We need A^T to convert from body-fixed to space-fixed:
141 <    rotTrans = rotMatrix.transpose();
141 >    Atrans = A.transpose();
142      
143      AtomInfo* siteInfo;
144      std::vector<AtomInfo*>::iterator iter;
# Line 126 | Line 146 | namespace OpenMD {
146      for( siteInfo = sites_->beginAtomInfo(iter); siteInfo;
147           siteInfo = sites_->nextAtomInfo(iter) ) {
148  
149 <      newVec = rotTrans * siteInfo->pos;    
149 >      newVec = Atrans * siteInfo->pos;    
150        
151        atomInfo = new AtomInfo;
152        atomInfo->atomTypeName = siteInfo->atomTypeName;
153        atomInfo->pos = pos + newVec;
154        
155        if (siteInfo->hasVector) {
156 <        newVec = rotTrans * siteInfo->dipole;
157 <        atomInfo->dipole = newVec;
156 >        newVec = Atrans * siteInfo->vec;
157 >        atomInfo->vec = newVec;
158        } else {
159 <        atomInfo->dipole = V3Zero;
159 >        atomInfo->vec = V3Zero;
160        }
161 <      
161 >
162 >      atomInfo->vel = vel + mat * siteInfo->pos;
163 >      atomInfo->hasVelocity = true;
164 >            
165        atomData->addAtomInfo(atomInfo);
166      }
167      if (!haveAtomData) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines