| 34 |
|
|
| 35 |
|
int buildRandomBilayer( void ); |
| 36 |
|
|
| 37 |
– |
void getRandomRot( double rot[3][3] ); |
| 38 |
– |
|
| 37 |
|
int buildBilayer( int isRandom ){ |
| 38 |
|
|
| 39 |
|
if( isRandom ){ |
| 40 |
|
return buildRandomBilayer(); |
| 41 |
|
} |
| 42 |
|
else{ |
| 43 |
< |
sprintf( painCave.errMsg, |
| 44 |
< |
"Cannot currently create a non-random bilayer.\n" ); |
| 47 |
< |
painCave.isFatal = 1; |
| 48 |
< |
simError(); |
| 43 |
> |
|
| 44 |
> |
std::cerr << "unsupported feature\n"; |
| 45 |
|
return 0; |
| 46 |
|
} |
| 47 |
|
} |
| 569 |
|
// if( writer != NULL ) delete writer; |
| 570 |
|
|
| 571 |
|
return 1; |
| 576 |
– |
} |
| 577 |
– |
|
| 578 |
– |
void getRandomRot( double rot[3][3] ){ |
| 579 |
– |
|
| 580 |
– |
double theta, phi, psi; |
| 581 |
– |
double cosTheta; |
| 582 |
– |
|
| 583 |
– |
// select random phi, psi, and cosTheta |
| 584 |
– |
|
| 585 |
– |
phi = 2.0 * M_PI * drand48(); |
| 586 |
– |
psi = 2.0 * M_PI * drand48(); |
| 587 |
– |
cosTheta = (2.0 * drand48()) - 1.0; // sample cos -1 to 1 |
| 588 |
– |
|
| 589 |
– |
theta = acos( cosTheta ); |
| 590 |
– |
|
| 591 |
– |
rot[0][0] = (cos(phi) * cos(psi)) - (sin(phi) * cos(theta) * sin(psi)); |
| 592 |
– |
rot[0][1] = (sin(phi) * cos(psi)) + (cos(phi) * cos(theta) * sin(psi)); |
| 593 |
– |
rot[0][2] = sin(theta) * sin(psi); |
| 594 |
– |
|
| 595 |
– |
rot[1][0] = -(cos(phi) * sin(psi)) - (sin(phi) * cos(theta) * cos(psi)); |
| 596 |
– |
rot[1][1] = -(sin(phi) * sin(psi)) + (cos(phi) * cos(theta) * cos(psi)); |
| 597 |
– |
rot[1][2] = sin(theta) * cos(psi); |
| 598 |
– |
|
| 599 |
– |
rot[2][0] = sin(phi) * sin(theta); |
| 600 |
– |
rot[2][1] = -cos(phi) * sin(theta); |
| 601 |
– |
rot[2][2] = cos(theta); |
| 572 |
|
} |
| 603 |
– |
|
| 573 |
|
|
| 605 |
– |
|
| 574 |
|
void buildMap( double &x, double &y, double &z, |
| 575 |
|
double boxX, double boxY, double boxZ ){ |
| 576 |
|
|