| 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; |
| 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 ); |
| 243 |
|
rot[2][2] = cos(theta); |
| 244 |
|
} |
| 245 |
|
|
| 219 |
– |
|
| 220 |
– |
void getUnitRot( double u[3], double rot[3][3] ){ |
| 221 |
– |
|
| 222 |
– |
double theta, phi, psi; |
| 223 |
– |
|
| 224 |
– |
theta = acos(u[2]); |
| 225 |
– |
phi = atan(u[1] / u[0]); |
| 226 |
– |
psi = 0.0; |
| 227 |
– |
|
| 228 |
– |
getEulerRot( theta, phi, psi, rot ); |
| 229 |
– |
} |
| 230 |
– |
|
| 231 |
– |
|