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 986 by gezelter, Mon Jan 26 22:01:23 2004 UTC

# Line 28 | Line 28 | void MoLocator::placeMol( double pos[3], double A[3][3
28  
29    int i,j,k;
30    double r[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();
54 <      uz = currAtom->getOrntZ();
51 >
52 >      // Directional Atoms have standard unit vectors which are oriented
53 >      // in space using the three Euler angles.  We assume the standard
54 >      // unit vector was originally along the z axis below.
55        
56 +      phi = currAtom->getEulerPhi() * M_PI / 180.0;
57 +      theta = currAtom->getEulerTheta() * M_PI / 180.0;
58 +      psi = currAtom->getEulerPsi()* M_PI / 180.0;
59 +      
60 +      Axx = (cos(phi) * cos(psi)) - (sin(phi) * cos(theta) * sin(psi));
61 +      Axy = (sin(phi) * cos(psi)) + (cos(phi) * cos(theta) * sin(psi));
62 +      Axz = sin(theta) * sin(psi);
63 +      
64 +      Ayx = -(cos(phi) * sin(psi)) - (sin(phi) * cos(theta) * cos(psi));
65 +      Ayy = -(sin(phi) * sin(psi)) + (cos(phi) * cos(theta) * cos(psi));
66 +      Ayz = sin(theta) * cos(psi);
67 +      
68 +      Azx = sin(phi) * sin(theta);
69 +      Azy = -cos(phi) * sin(theta);
70 +      Azz = cos(theta);
71 +      
72 +      sux = 0.0;
73 +      suy = 0.0;
74 +      suz = 1.0;
75 +      
76 +      ux = (Axx * sux) + (Ayx * suy) + (Azx * suz);
77 +      uy = (Axy * sux) + (Ayy * suy) + (Azy * suz);
78 +      uz = (Axz * sux) + (Ayz * suy) + (Azz * suz);
79 +          
80        uSqr = (ux * ux) + (uy * uy) + (uz * uz);
81        
82        u = sqrt( uSqr );
# Line 183 | Line 210 | void MoLocator::rotMe( double r[3], double A[3][3] ){
210      }
211    }
212   }
213 +
214 + void getRandomRot( double rot[3][3] ){
215 +
216 +  double theta, phi, psi;
217 +  double cosTheta;
218 +
219 +  // select random phi, psi, and cosTheta
220 +
221 +  phi = 2.0 * M_PI * drand48();
222 +  psi = 2.0 * M_PI * drand48();
223 +  cosTheta = (2.0 * drand48()) - 1.0; // sample cos -1 to 1
224 +
225 +  theta = acos( cosTheta );
226 +
227 +  getEulerRot( theta, phi, psi, rot );
228 + }
229 +
230 +
231 + void getEulerRot( double theta, double phi, double psi, double rot[3][3] ){
232 +
233 +  rot[0][0] = (cos(phi) * cos(psi)) - (sin(phi) * cos(theta) * sin(psi));
234 +  rot[0][1] = (sin(phi) * cos(psi)) + (cos(phi) * cos(theta) * sin(psi));
235 +  rot[0][2] = sin(theta) * sin(psi);
236 +  
237 +  rot[1][0] = -(cos(phi) * sin(psi)) - (sin(phi) * cos(theta) * cos(psi));
238 +  rot[1][1] = -(sin(phi) * sin(psi)) + (cos(phi) * cos(theta) * cos(psi));
239 +  rot[1][2] = sin(theta) * cos(psi);
240 +
241 +  rot[2][0] = sin(phi) * sin(theta);
242 +  rot[2][1] = -cos(phi) * sin(theta);
243 +  rot[2][2] = cos(theta);  
244 + }
245 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines