static public Atom[] findPhosphate(Molecule m) { List <Atom> retVal = new List <Atom>(); Atom[] atoms = m.GetAtoms(); foreach (Atom a1 in atoms) { if (a1.Element == ELEMENTS.P) { if (a1.BondedAtoms.Length == 4) { bool allOxygen = true; foreach (Atom a2 in a1.BondedAtoms) { if (a2.Element != ELEMENTS.O) { allOxygen = false; } } if (allOxygen) { retVal.Add(a1); } } } } return(retVal.ToArray <Atom>()); }
static public Atom[] BranchAtoms(Molecule m) { List <Atom> retVal = new List <Atom>(); foreach (Atom a in m.GetAtoms()) { if (a.BondedAtoms.Length > 2) { retVal.Add(a); } } return(retVal.ToArray()); }
static public Atom[] FindElements(Molecule m, string[] elements) { List <Atom> retVal = new List <Atom>(); Atom[] atoms = m.GetAtoms(); foreach (Atom a in atoms) { if (elements.Contains(a.Element.ToString())) { retVal.Add(a); } } return(retVal.ToArray <Atom>()); }
static public Atom[] FindElement(Molecule m, String element) { List <Atom> retVal = new List <Atom>(); Atom[] atoms = m.GetAtoms(); foreach (Atom a in atoms) { if (a.Element.ToString() == element) { retVal.Add(a); } } return(retVal.ToArray <Atom>()); }
static public String[] Elements(Molecule m) { List <string> retVal = new List <string>(); Atom[] atoms = m.GetAtoms(); foreach (Atom a in atoms) { if (!retVal.Contains(a.Element.ToString())) { retVal.Add(a.Element.ToString()); } } return(retVal.ToArray()); }