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 1465 by chuckv, Fri Jul 9 23:08:25 2010 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]  Vardeman & Gezelter, in progress (2009).                        
40   */
41  
42   #include "visitors/RigidBodyVisitor.hpp"
43
43   #include "primitives/RigidBody.hpp"
44  
45  
46 < namespace oopse {
46 > namespace OpenMD {
47  
49
50
48    void LipidHeadVisitor::visit(RigidBody* rb){
52
49      Vector3d pos;
54
50      Vector3d u(0, 0, 1);
56
51      Vector3d newVec;
58
52      GenericData* data;
60
53      AtomData* atomData;
62
54      AtomInfo* atomInfo;
64
55      bool haveAtomData;
66
56      RotMat3x3d rotMatrix;
57  
69
70
58      if(!canVisit(rb->getType()))
72
59        return;
60  
75
76
61      pos = rb->getPos();
78
62      rotMatrix = rb->getA();
80
63      //matVecMul3(rotMatrix, u, newVec);
82
64      newVec = rotMatrix * u;
65  
85  
86
66      data = rb->getPropertyByName("ATOMDATA");
67  
68      if(data != NULL){
90
91
92
69        atomData = dynamic_cast<AtomData*>(data);  
70 <
70 >      
71        if(atomData == NULL){
96
72          std::cerr << "can not get Atom Data from " << rb->getType() << std::endl;
73 <
73 >        
74          atomData = new AtomData;
100
75          haveAtomData = false;      
76 <
77 <      }
104 <
105 <      else
106 <
76 >        
77 >      } else
78          haveAtomData = true;
79 <
80 <    }
110 <
111 <    else{
112 <
79 >      
80 >    } else {
81        atomData = new AtomData;
114
82        haveAtomData = false;
83 <
83 >      
84      }
85  
119
120
86      atomInfo = new AtomInfo;
122
87      atomInfo->atomTypeName = "X";
124
88      atomInfo->pos[0] = pos[0];
126
89      atomInfo->pos[1] = pos[1];
128
90      atomInfo->pos[2] = pos[2];
91 +    atomInfo->vec[0] = newVec[0];
92 +    atomInfo->vec[1] = newVec[1];
93 +    atomInfo->vec[2] = newVec[2];
94  
131    atomInfo->dipole[0] = newVec[0];
132
133    atomInfo->dipole[1] = newVec[1];
134
135    atomInfo->dipole[2] = newVec[2];
136
137
138
95      atomData->addAtomInfo(atomInfo);
96  
141
142
97      if(!haveAtomData){
144
98        atomData->setID("ATOMDATA");
146
99        rb->addProperty(atomData);
148
100      }
101  
151    
152
102    }
103  
104  
156
105    void LipidHeadVisitor::addLipidHeadName(const std::string& name){
158
106      lipidHeadName.insert(name);
107  
161
162
108    }
109  
165
166
110    bool LipidHeadVisitor::canVisit(const std::string& name){
168
111      return lipidHeadName.find(name) != lipidHeadName.end() ? true : false;
112  
171
172
113    }
114  
115  
176
116    const  std::string LipidHeadVisitor::toString(){
178
117      char buffer[65535];
180
118      std::string result;
182
119      std::set<std::string>::iterator i;
120  
185  
186
121      sprintf(buffer ,"------------------------------------------------------------------\n");
188
122      result += buffer;
123  
191  
192
124      sprintf(buffer ,"Visitor name: %s\n", visitorName.c_str());
194
125      result += buffer;
126  
197
198
127      //print the ignore type list
200
128      sprintf(buffer , "lipidHeadName list contains below types:\n");
202
129      result += buffer;
130  
205
206
131      for(i = lipidHeadName.begin(); i != lipidHeadName.end(); ++i){
208
132        sprintf(buffer ,"%s\t", i->c_str());
210
133        result += buffer;
212
134      }
135  
215
216
136      sprintf(buffer ,"\n");
218
137      result += buffer;
138  
221
222
139      sprintf(buffer ,"------------------------------------------------------------------\n");
224
140      result += buffer;
141  
227
228
142      return result;
143  
231
232
144    }
145  
146  
236
147    void RBCOMVisitor::visit(RigidBody* rb){
238
148      AtomData* atomData;
240
149      AtomInfo* atomInfo;
242
150      Vector3d pos;
151  
245  
246
152      pos = rb->getPos();
248
153      atomInfo = new AtomInfo;
250
154      atomInfo->atomTypeName = "X";
252
155      atomInfo->pos[0] = pos[0];
254
156      atomInfo->pos[1] = pos[1];
256
157      atomInfo->pos[2] = pos[2];
158 +    atomInfo->vec[0] = 0;
159 +    atomInfo->vec[1] = 0;
160 +    atomInfo->vec[2] = 0;
161  
259    atomInfo->dipole[0] = 0;
260
261    atomInfo->dipole[1] = 0;
262
263    atomInfo->dipole[2] = 0;
264
265
266
162      atomData = new AtomData;
268
163      atomData->setID("ATOMDATA");
270
164      atomData->addAtomInfo(atomInfo);
165  
273
274
166      rb->addProperty(atomData);
167  
168    }
169  
170  
280
171    const  std::string RBCOMVisitor::toString(){
282
172      char buffer[65535];
284
173      std::string result;
174  
287  
288
175      sprintf(buffer ,"------------------------------------------------------------------\n");
290
176      result += buffer;
177  
293  
294
178      sprintf(buffer ,"Visitor name: %s\n", visitorName.c_str());
296
179      result += buffer;
180  
299
300
181      //print the ignore type list
302
182      sprintf(buffer , "Visitor Description: add a pseudo atom at the center of the mass of the rigidbody\n");
304
183      result += buffer;
184  
307
308
185      sprintf(buffer ,"------------------------------------------------------------------\n");
310
186      result += buffer;
187  
313
314
188      return result;
189  
317
318
190    }
191  
192 + }//namespace OpenMD
193  
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 1465 by chuckv, Fri Jul 9 23:08:25 2010 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines