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

Comparing trunk/OOPSE/libmdtools/Molecule.cpp (file contents):
Revision 426 by mmeineke, Thu Mar 27 20:40:01 2003 UTC vs.
Revision 483 by gezelter, Wed Apr 9 04:06:43 2003 UTC

# Line 1 | Line 1
1 < #include <cstlib>
1 > #include <cstdlib>
2  
3  
4   #include "Molecule.hpp"
5 + #include "simError.h"
6  
7  
8  
# Line 60 | Line 61 | void Molecule::initialize( molInit &theInit ){
61    myBonds = theInit.myBonds;
62    myBends = theInit.myBends;
63    myTorsions = theInit.myTorsions;
64 <  myExcludes = theInit.myExcludses;
64 >  myExcludes = theInit.myExcludes;
65      
66   }
67  
# Line 82 | Line 83 | void Molecule::getPotential( void ){
83   }
84  
85  
86 < void Molecule::getPotential( void ){
86 > double Molecule::getPotential( void ){
87    
88    int i;
89    double myPot = 0.0;
# Line 101 | Line 102 | void Molecule::getPotential( void ){
102  
103    return myPot;
104   }
105 +
106 + void Molecule::printMe( void ){
107 +  
108 +  int i;
109 +
110 +  for(i=0; i<nBonds; i++){
111 +    myBonds[i]->printMe();
112 +  }
113 +
114 +  for(i=0; i<nBends; i++){
115 +    myBends[i]->printMe();
116 +  }
117 +
118 +  for(i=0; i<nTorsions; i++){
119 +    myTorsions[i]->printMe();
120 +  }
121 + }
122 +
123 + void Molecule::moveCOM(double delta[3]){
124 +  double x, y, z;
125 +  int i;
126 +
127 +  for(i=0; i<nAtoms; i++) {
128 +    if(myAtoms[i] != NULL ) {
129 +
130 +      x = myAtoms[i]->getX() + delta[0];
131 +      y = myAtoms[i]->getY() + delta[1];
132 +      z = myAtoms[i]->getZ() + delta[2];
133 +
134 +      myAtoms[i]->setX(x);
135 +      myAtoms[i]->setY(y);
136 +      myAtoms[i]->setZ(z);
137 +    }
138 +  }
139 + }
140 +
141 + void Molecule::getCOM( double COM[3] ) {
142 +
143 +  double mass, mtot;
144 +  int i;
145 +
146 +  COM[0] = 0.0;
147 +  COM[1] = 0.0;
148 +  COM[2] = 0.0;
149 +  mtot   = 0.0;
150 +
151 +  for (i=0; i < nAtoms; i++) {
152 +    if (myAtoms[i] != NULL) {
153 +
154 +      mass = myAtoms[i]->getMass();
155 +      mtot   += mass;
156 +      COM[0] += myAtoms[i]->getX() * mass;
157 +      COM[1] += myAtoms[i]->getY() * mass;
158 +      COM[2] += myAtoms[i]->getZ() * mass;
159 +
160 +    }
161 +  }
162 +
163 +  COM[0] /= mtot;
164 +  COM[1] /= mtot;
165 +  COM[2] /= mtot;
166 +
167 + }
168 +
169 + double Molecule::getCOMvel( double COMvel[3] ) {
170 +
171 +  double mass, mtot;
172 +  int i;
173 +
174 +  COMvel[0] = 0.0;
175 +  COMvel[1] = 0.0;
176 +  COMvel[2] = 0.0;
177 +  mtot   = 0.0;
178 +
179 +  for (i=0; i < nAtoms; i++) {
180 +    if (myAtoms[i] != NULL) {
181 +      
182 +      mass = myAtoms[i]->getMass();
183 +      mtot   += mass;
184 +      COMvel[0] += myAtoms[i]->get_vx() * mass;
185 +      COMvel[1] += myAtoms[i]->get_vy() * mass;
186 +      COMvel[2] += myAtoms[i]->get_vz() * mass;
187 +
188 +    }
189 +  }
190 +
191 +  COMvel[0] /= mtot;
192 +  COMvel[1] /= mtot;
193 +  COMvel[2] /= mtot;
194 +
195 +  return mtot;
196 +
197 + }
198 +
199 + void Molecule::atomicRollCall(int* molMembership) {
200 +  int i, which;
201 +
202 +  for (i=0; i < nAtoms; i++) {
203 +    if (myAtoms[i] != NULL) {
204 +      which = myAtoms[i]->getIndex();
205 +      molMembership[which] = myIndex;
206 +    }
207 +  }
208 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines