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 427 by mmeineke, Thu Mar 27 20:48:37 2003 UTC vs.
Revision 610 by gezelter, Tue Jul 15 15:50:55 2003 UTC

# Line 2 | Line 2
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 aPos[3];
125 +  int i, j;
126 +
127 +  for(i=0; i<nAtoms; i++) {
128 +    if(myAtoms[i] != NULL ) {
129 +      
130 +      myAtoms[i]->getPos( aPos );
131 +      
132 +      for (j=0; j< 3; j++)
133 +        aPos[j] += delta[j];
134 +
135 +      myAtoms[i]->setPos( aPos );
136 +    }
137 +  }
138 + }
139 +
140 + void Molecule::getCOM( double COM[3] ) {
141 +
142 +  double mass, mtot;
143 +  double aPos[3];
144 +  int i, j;
145 +
146 +  for (j=0; j<3; j++)
147 +    COM[j] = 0.0;
148 +
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 +      
157 +      myAtoms[i]->getPos( aPos );
158 +
159 +      for( j = 0; j < 3; j++)
160 +        COM[j] += aPos[j] * mass;
161 +
162 +    }
163 +  }
164 +
165 +  for (j = 0; j < 3; j++)
166 +    COM[j] /= mtot;
167 + }
168 +
169 + double Molecule::getCOMvel( double COMvel[3] ) {
170 +
171 +  double mass, mtot;
172 +  double aVel[3];
173 +  int i, j;
174 +
175 +
176 +  for (j=0; j<3; j++)
177 +    COMvel[j] = 0.0;
178 +
179 +  mtot   = 0.0;
180 +
181 +  for (i=0; i < nAtoms; i++) {
182 +    if (myAtoms[i] != NULL) {
183 +
184 +      mass = myAtoms[i]->getMass();
185 +      mtot   += mass;
186 +
187 +      myAtoms[i]->getVel(aVel);
188 +
189 +      for (j=0; j<3; j++)
190 +        COMvel[j] += aVel[j]*mass;
191 +
192 +    }
193 +  }
194 +
195 +  for (j=0; j<3; j++)
196 +    COMvel[j] /= mtot;
197 +
198 +  return mtot;
199 +
200 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines