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

Comparing:
trunk/src/visitors/RigidBodyVisitor.cpp (file contents), Revision 507 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
branches/development/src/visitors/RigidBodyVisitor.cpp (file contents), Revision 1665 by gezelter, Tue Nov 22 20:38:56 2011 UTC

# Line 6 | Line 6
6   * redistribute this software in source and binary code form, provided
7   * that the following conditions are met:
8   *
9 < * 1. Acknowledgement of the program authors must be made in any
10 < *    publication of scientific results based in part on use of the
11 < *    program.  An acceptable form of acknowledgement is citation of
12 < *    the article in which the program was described (Matthew
13 < *    A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher
14 < *    J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented
15 < *    Parallel Simulation Engine for Molecular Dynamics,"
16 < *    J. Comput. Chem. 26, pp. 252-271 (2005))
17 < *
18 < * 2. Redistributions of source code must retain the above copyright
9 > * 1. Redistributions of source code must retain the above copyright
10   *    notice, this list of conditions and the following disclaimer.
11   *
12 < * 3. Redistributions in binary form must reproduce the above copyright
12 > * 2. Redistributions in binary form must reproduce the above copyright
13   *    notice, this list of conditions and the following disclaimer in the
14   *    documentation and/or other materials provided with the
15   *    distribution.
# Line 37 | Line 28
28   * arising out of the use of or inability to use software, even if the
29   * University of Notre Dame has been advised of the possibility of
30   * such damages.
31 + *
32 + * SUPPORT OPEN SCIENCE!  If you use OpenMD or its source code in your
33 + * research, please cite the appropriate papers when you publish your
34 + * work.  Good starting points are:
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]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 + * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
42  
43   #include "visitors/RigidBodyVisitor.hpp"
43
44   #include "primitives/RigidBody.hpp"
45  
46  
47 < namespace oopse {
47 > namespace OpenMD {
48  
49
50
49    void LipidHeadVisitor::visit(RigidBody* rb){
52
50      Vector3d pos;
54
51      Vector3d u(0, 0, 1);
56
52      Vector3d newVec;
58
53      GenericData* data;
60
54      AtomData* atomData;
62
55      AtomInfo* atomInfo;
64
56      bool haveAtomData;
66
57      RotMat3x3d rotMatrix;
58  
69
70
59      if(!canVisit(rb->getType()))
72
60        return;
61  
75
76
62      pos = rb->getPos();
78
63      rotMatrix = rb->getA();
80
64      //matVecMul3(rotMatrix, u, newVec);
82
65      newVec = rotMatrix * u;
66  
85  
86
67      data = rb->getPropertyByName("ATOMDATA");
68  
69      if(data != NULL){
90
91
92
70        atomData = dynamic_cast<AtomData*>(data);  
71 <
71 >      
72        if(atomData == NULL){
96
73          std::cerr << "can not get Atom Data from " << rb->getType() << std::endl;
74 <
74 >        
75          atomData = new AtomData;
100
76          haveAtomData = false;      
77 <
78 <      }
104 <
105 <      else
106 <
77 >        
78 >      } else
79          haveAtomData = true;
80 <
81 <    }
110 <
111 <    else{
112 <
80 >      
81 >    } else {
82        atomData = new AtomData;
114
83        haveAtomData = false;
84 <
84 >      
85      }
86  
119
120
87      atomInfo = new AtomInfo;
122
88      atomInfo->atomTypeName = "X";
124
89      atomInfo->pos[0] = pos[0];
126
90      atomInfo->pos[1] = pos[1];
128
91      atomInfo->pos[2] = pos[2];
92 +    atomInfo->vec[0] = newVec[0];
93 +    atomInfo->vec[1] = newVec[1];
94 +    atomInfo->vec[2] = newVec[2];
95  
131    atomInfo->dipole[0] = newVec[0];
132
133    atomInfo->dipole[1] = newVec[1];
134
135    atomInfo->dipole[2] = newVec[2];
136
137
138
96      atomData->addAtomInfo(atomInfo);
97  
141
142
98      if(!haveAtomData){
144
99        atomData->setID("ATOMDATA");
146
100        rb->addProperty(atomData);
148
101      }
102  
151    
152
103    }
104  
105  
156
106    void LipidHeadVisitor::addLipidHeadName(const std::string& name){
158
107      lipidHeadName.insert(name);
108  
161
162
109    }
110  
165
166
111    bool LipidHeadVisitor::canVisit(const std::string& name){
168
112      return lipidHeadName.find(name) != lipidHeadName.end() ? true : false;
113  
171
172
114    }
115  
116  
176
117    const  std::string LipidHeadVisitor::toString(){
178
118      char buffer[65535];
180
119      std::string result;
182
120      std::set<std::string>::iterator i;
121  
185  
186
122      sprintf(buffer ,"------------------------------------------------------------------\n");
188
123      result += buffer;
124  
191  
192
125      sprintf(buffer ,"Visitor name: %s\n", visitorName.c_str());
194
126      result += buffer;
127  
197
198
128      //print the ignore type list
200
129      sprintf(buffer , "lipidHeadName list contains below types:\n");
202
130      result += buffer;
131  
205
206
132      for(i = lipidHeadName.begin(); i != lipidHeadName.end(); ++i){
208
133        sprintf(buffer ,"%s\t", i->c_str());
210
134        result += buffer;
212
135      }
136  
215
216
137      sprintf(buffer ,"\n");
218
138      result += buffer;
139  
221
222
140      sprintf(buffer ,"------------------------------------------------------------------\n");
224
141      result += buffer;
142  
227
228
143      return result;
144  
231
232
145    }
146  
147  
236
148    void RBCOMVisitor::visit(RigidBody* rb){
238
149      AtomData* atomData;
240
150      AtomInfo* atomInfo;
242
151      Vector3d pos;
152  
245  
246
153      pos = rb->getPos();
248
154      atomInfo = new AtomInfo;
250
155      atomInfo->atomTypeName = "X";
252
156      atomInfo->pos[0] = pos[0];
254
157      atomInfo->pos[1] = pos[1];
256
158      atomInfo->pos[2] = pos[2];
159 +    atomInfo->vec[0] = 0;
160 +    atomInfo->vec[1] = 0;
161 +    atomInfo->vec[2] = 0;
162  
259    atomInfo->dipole[0] = 0;
260
261    atomInfo->dipole[1] = 0;
262
263    atomInfo->dipole[2] = 0;
264
265
266
163      atomData = new AtomData;
268
164      atomData->setID("ATOMDATA");
270
165      atomData->addAtomInfo(atomInfo);
166  
273
274
167      rb->addProperty(atomData);
168  
169    }
170  
171  
280
172    const  std::string RBCOMVisitor::toString(){
282
173      char buffer[65535];
284
174      std::string result;
175  
287  
288
176      sprintf(buffer ,"------------------------------------------------------------------\n");
290
177      result += buffer;
178  
293  
294
179      sprintf(buffer ,"Visitor name: %s\n", visitorName.c_str());
296
180      result += buffer;
181  
299
300
182      //print the ignore type list
302
183      sprintf(buffer , "Visitor Description: add a pseudo atom at the center of the mass of the rigidbody\n");
304
184      result += buffer;
185  
307
308
186      sprintf(buffer ,"------------------------------------------------------------------\n");
310
187      result += buffer;
188  
313
314
189      return result;
190  
317
318
191    }
192  
193 + }//namespace OpenMD
194  
322
323
324
325 }//namespace oopse
326

Comparing:
trunk/src/visitors/RigidBodyVisitor.cpp (property svn:keywords), Revision 507 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
branches/development/src/visitors/RigidBodyVisitor.cpp (property svn:keywords), Revision 1665 by gezelter, Tue Nov 22 20:38:56 2011 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines