/// <summary> /// Checks these 6 atoms to see if they form a trigonal-bipyramidal shape. /// </summary> /// <param name="atomA">one of the axial atoms</param> /// <param name="atomB">the central atom</param> /// <param name="atomC">one of the equatorial atoms</param> /// <param name="atomD">one of the equatorial atoms</param> /// <param name="atomE">one of the equatorial atoms</param> /// <param name="atomF">the other axial atom</param> /// <returns>true if the geometry is trigonal-bipyramidal</returns> public static bool IsTrigonalBipyramidal(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD, IAtom atomE, IAtom atomF) { Vector3 pointA = atomA.Point3D.Value; Vector3 pointB = atomB.Point3D.Value; Vector3 pointC = atomC.Point3D.Value; Vector3 pointD = atomD.Point3D.Value; Vector3 pointE = atomE.Point3D.Value; Vector3 pointF = atomF.Point3D.Value; bool isColinearABF = StereoTool.IsColinear(pointA, pointB, pointF); if (isColinearABF) { // the normal to the equatorial plane Vector3 normal = StereoTool.GetNormal(pointC, pointD, pointE); // get the side of the plane that axis point A is TetrahedralSign handednessCDEA = StereoTool.GetHandedness(normal, pointC, pointF); // get the side of the plane that axis point F is TetrahedralSign handednessCDEF = StereoTool.GetHandedness(normal, pointC, pointA); // in other words, the two axial points (A,F) are on opposite sides // of the equatorial plane CDE return(handednessCDEA != handednessCDEF); } else { return(false); } }
public void TetrahedralPlusAtomsAboveXYClockwiseTest() { // above the XY plane IAtom baseA = new Atom("C", new Vector3(0, 0, 1)); IAtom baseB = new Atom("C", new Vector3(1, 0, 1)); IAtom baseC = new Atom("C", new Vector3(1, 1, 1)); IAtom positiveApex = new Atom("C", new Vector3(0.5, 0.5, 2)); TetrahedralSign tetSign = StereoTool.GetHandedness(baseC, baseB, baseA, positiveApex); Assert.AreEqual(TetrahedralSign.Minus, tetSign); }
public void TetrahedralMinusAtomsBelowXYTest() { // below the XY plane IAtom baseA = new Atom("C", new Vector3(0, 0, -1)); IAtom baseB = new Atom("C", new Vector3(1, 0, -1)); IAtom baseC = new Atom("C", new Vector3(1, 1, -1)); IAtom negativeApex = new Atom("C", new Vector3(0.5, 0.5, -2)); TetrahedralSign tetSign = StereoTool.GetHandedness(baseA, baseB, baseC, negativeApex); Assert.AreEqual(TetrahedralSign.Minus, tetSign); }
/// <summary> /// Take four atoms, and return <see cref="TetrahedralStereo.Clockwise"/> or <see cref="TetrahedralStereo.AntiClockwise"/>. /// The first atom is the one pointing towards the observer. /// </summary> /// <param name="atom1">the atom pointing towards the observer</param> /// <param name="atom2">the second atom (points away)</param> /// <param name="atom3">the third atom (points away)</param> /// <param name="atom4">the fourth atom (points away)</param> /// <returns>clockwise or anticlockwise</returns> public static TetrahedralStereo GetStereo(IAtom atom1, IAtom atom2, IAtom atom3, IAtom atom4) { // a normal is calculated for the base atoms (2, 3, 4) and compared to // the first atom. PLUS indicates ACW. TetrahedralSign sign = StereoTool.GetHandedness(atom2, atom3, atom4, atom1); if (sign == TetrahedralSign.Plus) { return(TetrahedralStereo.AntiClockwise); } else { return(TetrahedralStereo.Clockwise); } }