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

Comparing:
trunk/src/visitors/AtomVisitor.cpp (file contents), Revision 1455 by gezelter, Thu Jun 24 20:44:18 2010 UTC vs.
branches/development/src/visitors/AtomVisitor.cpp (file contents), Revision 1872 by gezelter, Fri May 10 15:10:41 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 <cstring>
44   #include "visitors/AtomVisitor.hpp"
45   #include "primitives/DirectionalAtom.hpp"
46   #include "primitives/RigidBody.hpp"
47 + #include "types/FixedChargeAdapter.hpp"
48 + #include "types/FluctuatingChargeAdapter.hpp"
49 + #include "types/MultipoleAdapter.hpp"
50 + #include "types/GayBerneAdapter.hpp"
51  
52   namespace OpenMD {
53    void BaseAtomVisitor::visit(RigidBody *rb) {
# Line 78 | Line 83 | namespace OpenMD {
83    void DefaultAtomVisitor::visit(Atom *atom) {
84      AtomData *atomData;
85      AtomInfo *atomInfo;
86 <    Vector3d  pos;
87 <    
86 >    AtomType* atype = atom->getAtomType();
87 >              
88      if (isVisited(atom))
89        return;
90      
91      atomInfo = new AtomInfo;
87    
88    atomData = new AtomData;
89    atomData->setID("ATOMDATA");
90    
91    pos = atom->getPos();
92      atomInfo->atomTypeName = atom->getType();
93 <    atomInfo->pos[0] = pos[0];
94 <    atomInfo->pos[1] = pos[1];
95 <    atomInfo->pos[2] = pos[2];
96 <    atomInfo->dipole[0] = 0.0;
97 <    atomInfo->dipole[1] = 0.0;
98 <    atomInfo->dipole[2] = 0.0;
99 <    
93 >    atomInfo->pos = atom->getPos();
94 >    atomInfo->vel = atom->getVel();
95 >    atomInfo->frc = atom->getFrc();
96 >    atomInfo->vec = V3Zero;
97 >    atomInfo->hasVelocity = true;
98 >    atomInfo->hasForce = true;
99 >        
100 >    FixedChargeAdapter fca = FixedChargeAdapter(atype);
101 >    if ( fca.isFixedCharge() ) {
102 >      atomInfo->hasCharge = true;
103 >      atomInfo->charge = fca.getCharge();
104 >    }
105 >          
106 >    FluctuatingChargeAdapter fqa = FluctuatingChargeAdapter(atype);
107 >    if ( fqa.isFluctuatingCharge() ) {
108 >      atomInfo->hasCharge = true;
109 >      atomInfo->charge += atom->getFlucQPos();
110 >    }
111 >
112 >    if (atype->isElectrostatic()) {
113 >      atomInfo->hasElectricField = true;
114 >      atomInfo->eField = atom->getElectricField();
115 >    }
116 >
117 >    atomData = new AtomData;
118 >    atomData->setID("ATOMDATA");  
119      atomData->addAtomInfo(atomInfo);
120      
121      atom->addProperty(atomData);
# Line 107 | Line 126 | namespace OpenMD {
126    void DefaultAtomVisitor::visit(DirectionalAtom *datom) {
127      AtomData *atomData;
128      AtomInfo *atomInfo;
129 <    Vector3d  pos;
111 <    Vector3d  u;
129 >    AtomType* atype = datom->getAtomType();
130  
131      if (isVisited(datom))
132        return;
133 +    
134 +    atomInfo = new AtomInfo;
135 +    atomInfo->atomTypeName = datom->getType();
136 +    atomInfo->pos = datom->getPos();
137 +    atomInfo->vel = datom->getVel();
138 +    atomInfo->frc = datom->getFrc();
139 +    atomInfo->hasVelocity = true;
140 +    atomInfo->hasForce = true;
141  
142 <    pos = datom->getPos();
143 <    if (datom->getAtomType()->isGayBerne()) {
144 <        u = datom->getA().transpose()*V3Z;        
145 <    } else if (datom->getAtomType()->isMultipole()) {
120 <        u = datom->getElectroFrame().getColumn(2);
142 >    FixedChargeAdapter fca = FixedChargeAdapter(atype);
143 >    if ( fca.isFixedCharge() ) {
144 >      atomInfo->hasCharge = true;
145 >      atomInfo->charge = fca.getCharge();
146      }
147 <    atomData = new AtomData;
148 <    atomData->setID("ATOMDATA");
149 <    atomInfo = new AtomInfo;
147 >          
148 >    FluctuatingChargeAdapter fqa = FluctuatingChargeAdapter(atype);
149 >    if ( fqa.isFluctuatingCharge() ) {
150 >      atomInfo->hasCharge = true;
151 >      atomInfo->charge += datom->getFlucQPos();
152 >    }
153  
154 <    atomInfo->atomTypeName = datom->getType();
155 <    atomInfo->pos[0] = pos[0];
156 <    atomInfo->pos[1] = pos[1];
157 <    atomInfo->pos[2] = pos[2];
130 <    atomInfo->dipole[0] = u[0];
131 <    atomInfo->dipole[1] = u[1];
132 <    atomInfo->dipole[2] = u[2];
154 >    if (atype->isElectrostatic()) {
155 >      atomInfo->hasElectricField = true;
156 >      atomInfo->eField = datom->getElectricField();
157 >    }
158  
159 +    GayBerneAdapter gba = GayBerneAdapter(atype);
160 +    MultipoleAdapter ma = MultipoleAdapter(atype);
161 +    
162 +    if (gba.isGayBerne()) {
163 +      atomInfo->hasVector = true;
164 +      atomInfo->vec = datom->getA().transpose()*V3Z;
165 +    } else if (ma.isDipole()) {
166 +      atomInfo->hasVector = true;
167 +      atomInfo->vec = datom->getDipole();
168 +    } else if (ma.isQuadrupole()) {
169 +      atomInfo->hasVector = true;
170 +      atomInfo->vec = datom->getA().transpose()*V3Z;
171 +    }
172 +
173 +    atomData = new AtomData;
174 +    atomData->setID("ATOMDATA");  
175      atomData->addAtomInfo(atomInfo);
176  
177      datom->addProperty(atomData);
# Line 143 | Line 184 | namespace OpenMD {
184      std::string result;
185  
186      sprintf(buffer,
187 <            "------------------------------------------------------------------\n");
187 >            "--------------------------------------------------------------\n");
188      result += buffer;
189  
190      sprintf(buffer, "Visitor name: %s\n", visitorName.c_str());
# Line 154 | Line 195 | namespace OpenMD {
195      result += buffer;
196  
197      sprintf(buffer,
198 <            "------------------------------------------------------------------\n");
198 >            "--------------------------------------------------------------\n");
199      result += buffer;
200  
201      return result;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines