void TrialMol::SetBasis(const uint p1, const uint p2) { using namespace geom; //W is unit vec of p1->p2 XYZ wVec = axes->MinImage(tCoords.Difference(p2, p1), box); wVec.Normalize(); XYZ uVec; //check to make sure our W isn't in line with the standard X Axis if (wVec.x < 0.8) { //V will be W x the standard X unit vec uVec = XYZ(1.0, 0.0, 0.0); } else { //V will be W x the standard Y unit vec uVec = XYZ(0.0, 1.0, 0.0); } XYZ vVec = Cross(wVec, uVec); vVec.Normalize(); //U is unit vec perpendicular to both V and W uVec = Cross(vVec, wVec); growthToWorld.BasisRotation(uVec, vVec, wVec); worldToGrowth = growthToWorld.Inverse(); basisPoint = tCoords.Get(p1); }
void TrialMol::SetBasis(const uint p1, const uint p2, const uint p3) { using namespace geom; //W is unit vec of p1->p2 XYZ wVec = axes->MinImage(tCoords.Difference(p2, p1), box); wVec.Normalize(); //U will be unit projection of p2->p3 onto plane normal to W XYZ uVec = axes->MinImage(tCoords.Difference(p3, p2), box); //V is unit vec perpendicular to both W and U XYZ vVec = Cross(wVec, uVec); vVec.Normalize(); //Finish X' uVec = Cross(vVec, wVec); growthToWorld.BasisRotation(uVec, vVec, wVec); worldToGrowth = growthToWorld.Inverse(); basisPoint = tCoords.Get(p1); }