Ejemplo n.º 1
0
        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>());
        }
Ejemplo n.º 2
0
        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());
        }
Ejemplo n.º 3
0
        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>());
        }
Ejemplo n.º 4
0
        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>());
        }
Ejemplo n.º 5
0
        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());
        }