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

Comparing trunk/OOPSE/utils/sysbuilder/MoLocator.cpp (file contents):
Revision 700 by chuckv, Mon Aug 18 20:59:47 2003 UTC vs.
Revision 1099 by gezelter, Mon Apr 12 20:33:12 2004 UTC

# Line 27 | Line 27 | void MoLocator::placeMol( double pos[3], double A[3][3
27                            int atomIndex, SimState* myConfig ){
28  
29    int i,j,k;
30 <  double r[3];
30 >  double r[3], ji[3];
31 >  double phi, theta, psi;
32 >  double sux, suy, suz;
33 >  double Axx, Axy, Axz, Ayx, Ayy, Ayz, Azx, Azy, Azz;
34    double ux, uy, uz, u, uSqr;
35    
36    AtomStamp* currAtom;
# Line 45 | Line 48 | void MoLocator::placeMol( double pos[3], double A[3][3
48        dAtom = new DirectionalAtom( j, myConfig);
49        atomArray[j] = dAtom;
50        atomArray[j]->setCoords();
51 <          
52 <      ux = currAtom->getOrntX();
53 <      uy = currAtom->getOrntY();
51 <      uz = currAtom->getOrntZ();
51 >
52 >      // Directional Atoms have standard unit vectors which are oriented
53 >      // in space using the three Euler angles.
54        
55 <      uSqr = (ux * ux) + (uy * uy) + (uz * uz);
56 <      
57 <      u = sqrt( uSqr );
58 <      ux = ux / u;
59 <      uy = uy / u;
58 <      uz = uz / u;
59 <      
60 <      dAtom->setSUx( ux );
61 <      dAtom->setSUy( uy );
62 <      dAtom->setSUz( uz );
63 <      
55 >      phi = currAtom->getEulerPhi() * M_PI / 180.0;
56 >      theta = currAtom->getEulerTheta() * M_PI / 180.0;
57 >      psi = currAtom->getEulerPsi()* M_PI / 180.0;
58 >
59 >      dAtom->setUnitFrameFromEuler(phi, theta, psi);      
60        dAtom->setA( A );
61 +
62 +      ji[0] = 0.0;
63 +      ji[1] = 0.0;
64 +      ji[2] = 0.0;
65 +      dAtom->setJ( ji );
66        
66      dAtom->setJx( 0.0 );
67      dAtom->setJy( 0.0 );
68      dAtom->setJz( 0.0 );
69      
67      }
68      else{
69 <      atomArray[j] = new GeneralAtom( j, myConfig);
69 >      atomArray[j] = new Atom( j, myConfig);
70        atomArray[j]->setCoords();
71      }
72      
# Line 183 | Line 180 | void MoLocator::rotMe( double r[3], double A[3][3] ){
180      }
181    }
182   }
183 +
184 + void getRandomRot( double rot[3][3] ){
185 +
186 +  double theta, phi, psi;
187 +  double cosTheta;
188 +
189 +  // select random phi, psi, and cosTheta
190 +
191 +  phi = 2.0 * M_PI * drand48();
192 +  psi = 2.0 * M_PI * drand48();
193 +  cosTheta = (2.0 * drand48()) - 1.0; // sample cos -1 to 1
194 +
195 +  theta = acos( cosTheta );
196 +
197 +  getEulerRot( theta, phi, psi, rot );
198 + }
199 +
200 +
201 + void getEulerRot( double theta, double phi, double psi, double rot[3][3] ){
202 +
203 +  rot[0][0] = (cos(phi) * cos(psi)) - (sin(phi) * cos(theta) * sin(psi));
204 +  rot[0][1] = (sin(phi) * cos(psi)) + (cos(phi) * cos(theta) * sin(psi));
205 +  rot[0][2] = sin(theta) * sin(psi);
206 +  
207 +  rot[1][0] = -(cos(phi) * sin(psi)) - (sin(phi) * cos(theta) * cos(psi));
208 +  rot[1][1] = -(sin(phi) * sin(psi)) + (cos(phi) * cos(theta) * cos(psi));
209 +  rot[1][2] = sin(theta) * cos(psi);
210 +
211 +  rot[2][0] = sin(phi) * sin(theta);
212 +  rot[2][1] = -cos(phi) * sin(theta);
213 +  rot[2][2] = cos(theta);  
214 + }
215 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines