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

Comparing trunk/OOPSE/libmdtools/AtomVisitor.cpp (file contents):
Revision 1119 by tim, Mon Apr 19 17:44:48 2004 UTC vs.
Revision 1252 by gezelter, Mon Jun 7 14:26:33 2004 UTC

# Line 44 | Line 44 | void SSDAtomVisitor::visit(DirectionalAtom* datom){
44    double ox[3] = {0.0, 0.0, -0.0654};
45    double u[3] = {0, 0, 1};
46    double rotMatrix[3][3];
47 +  double rotTrans[3][3];
48    AtomInfo* atomInfo;
49    double pos[3];
49  double vel[3];
50    double newVec[3];
51    double q[4];
52    AtomData* atomData;
# Line 54 | Line 54 | void SSDAtomVisitor::visit(DirectionalAtom* datom){
54    bool haveAtomData;
55    
56    //if atom is not SSD atom, just skip it
57 <  if(!strcmp(datom->getType(), "SSD"))
57 >  if(strcmp(datom->getType(), "SSD"))
58      return;
59  
60    data = datom->getProperty("ATOMDATA");
# Line 78 | Line 78 | void SSDAtomVisitor::visit(DirectionalAtom* datom){
78    datom->getPos(pos);
79    datom->getQ(q);
80    datom->getA(rotMatrix);
81 +
82 +  // We need A^T to convert from body-fixed to space-fixed:
83 +  transposeMat3(rotMatrix, rotTrans);
84    
85    //center of mass of the water molecule
86 <  matVecMul3(rotMatrix, u, newVec);
86 >  matVecMul3(rotTrans, u, newVec);
87    atomInfo = new AtomInfo;
88    atomInfo->AtomType = "X";
89    atomInfo->pos[0] = pos[0];
# Line 93 | Line 96 | void SSDAtomVisitor::visit(DirectionalAtom* datom){
96    atomData->addAtomInfo(atomInfo);
97  
98    //oxygen
99 <  matVecMul3(rotMatrix, ox, newVec);
99 >  matVecMul3(rotTrans, ox, newVec);
100    atomInfo = new AtomInfo;
101    atomInfo->AtomType = "O";
102    atomInfo->pos[0] = pos[0] + newVec[0];
# Line 106 | Line 109 | void SSDAtomVisitor::visit(DirectionalAtom* datom){
109  
110  
111    //hydrogen1
112 <    matVecMul3(rotMatrix, h1, newVec);
112 >    matVecMul3(rotTrans, h1, newVec);
113    atomInfo = new AtomInfo;
114    atomInfo->AtomType = "H";
115    atomInfo->pos[0] = pos[0] + newVec[0];
# Line 118 | Line 121 | void SSDAtomVisitor::visit(DirectionalAtom* datom){
121    atomData->addAtomInfo(atomInfo);
122  
123    //hydrogen2
124 <  matVecMul3(rotMatrix, h2, newVec);
124 >  matVecMul3(rotTrans, h2, newVec);
125    atomInfo = new AtomInfo;
126    atomInfo->AtomType = "H";
127    atomInfo->pos[0] = pos[0] + newVec[0];
# Line 140 | Line 143 | void SSDAtomVisitor::visit(DirectionalAtom* datom){
143  
144   }
145  
146 + const string SSDAtomVisitor::toString(){
147 +  char buffer[65535];
148 +  string result;
149 +  
150 +  sprintf(buffer ,"------------------------------------------------------------------\n");
151 +  result += buffer;
152 +
153 +  sprintf(buffer ,"Visitor name: %s\n", visitorName.c_str());
154 +  result += buffer;
155 +
156 +  sprintf(buffer , "Visitor Description: Convert SSD into 4 different atoms\n");
157 +  result += buffer;
158 +
159 +  sprintf(buffer ,"------------------------------------------------------------------\n");
160 +  result += buffer;
161 +
162 +  return result;
163 + }
164 +
165 + //----------------------------------------------------------------------------//
166 +
167   void DefaultAtomVisitor::visit(Atom* atom){
168    AtomData* atomData;
169    AtomInfo* atomInfo;
# Line 199 | Line 223 | void DefaultAtomVisitor::visit(DirectionalAtom* datom)
223  
224    setVisited(datom);
225   }
226 <    
226 >
227 >
228 > const string DefaultAtomVisitor::toString(){
229 >  char buffer[65535];
230 >  string result;
231 >  
232 >  sprintf(buffer ,"------------------------------------------------------------------\n");
233 >  result += buffer;
234 >
235 >  sprintf(buffer ,"Visitor name: %s\n", visitorName.c_str());
236 >  result += buffer;
237 >
238 >  sprintf(buffer , "Visitor Description: copy atom infomation into atom data\n");
239 >  result += buffer;
240 >
241 >  sprintf(buffer ,"------------------------------------------------------------------\n");
242 >  result += buffer;
243 >
244 >  return result;
245 > }    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines