Class BondedUtils

java.lang.Object
ffx.potential.bonded.BondedUtils

public class BondedUtils extends Object
Utilities for placing atoms.
Since:
1.0
Author:
Michael Schnieders
  • Constructor Details

    • BondedUtils

      public BondedUtils()
  • Method Details

    • atomAttachedToAtom

      public static boolean atomAttachedToAtom(Atom a1, Atom a2)
      Checks if atom a1 is bonded to atom a2.
      Parameters:
      a1 - An Atom.
      a2 - Another Atom.
      Returns:
      If a1 is bonded to a2.
    • buildBond

      public static Bond buildBond(Atom a1, Atom a2, ForceField forceField, List<Bond> bondList)
      Build a bond between two atoms.
      Parameters:
      a1 - The first atom.
      a2 - The second atom.
      forceField - The force field to use.
      bondList - The list of bonds to add to.
      Returns:
      The new bond.
    • buildHeavy

      public static Atom buildHeavy(MSGroup residue, String atomName, Atom bondedTo, int key, ForceField forceField, List<Bond> bondList) throws BondedUtils.MissingHeavyAtomException, BondedUtils.MissingAtomTypeException
      Build a heavy atom.
      Parameters:
      residue - The residue to add the atom to.
      atomName - The name of the atom.
      bondedTo - The atom the heavy atom is bonded to.
      key - The atom type key.
      forceField - The force field to use.
      bondList - The list of bonds to add to.
      Returns:
      The heavy atom.
      Throws:
      BondedUtils.MissingHeavyAtomException - if any.
      BondedUtils.MissingAtomTypeException
    • buildHeavy

      public static Atom buildHeavy(MSGroup residue, String atomName, Atom ia, double bond, Atom ib, double angle1, Atom ic, double angle2, int chiral, int lookUp, ForceField forceField)
      Build a heavy atom.
      Parameters:
      residue - The residue to add the atom to.
      atomName - The name of the atom.
      ia - The first atom.
      bond - The bond length.
      ib - The second atom.
      angle1 - The angle.
      ic - The third atom.
      angle2 - The second angle (either a bond angle or a dihedral angle).
      chiral - The chiral flag.
      lookUp - The BioType key.
      forceField - The force field to use.
      Returns:
      The new atom.
    • buildHeavy

      public static Atom buildHeavy(MSGroup residue, String atomName, Atom ia, double bond, Atom ib, double angle1, Atom ic, double angle2, int chiral, int lookUp, ForceField forceField, List<Bond> bondList)
      Build a heavy atom.
      Parameters:
      residue - The residue to add the atom to.
      atomName - The name of the atom.
      ia - The first atom.
      bond - The bond length.
      ib - The second atom.
      angle1 - The angle.
      ic - The third atom.
      angle2 - The second angle (either a bond angle or a dihedral angle).
      chiral - The chiral flag.
      lookUp - The BioType key.
      forceField - The force field to use.
      bondList - A list of bonds to add to.
      Returns:
      The new heavy atom.
    • buildHeavy

      public static Atom buildHeavy(MSGroup residue, AminoAcidUtils.SideChainType atomName, Atom ia, double bond, Atom ib, double angle1, Atom ic, double angle2, int chiral, ForceField forceField, List<Bond> bondList)
      Build a heavy atom.
      Parameters:
      residue - The residue to add the atom to.
      atomName - The name of the atom.
      ia - The first atom.
      bond - The bond length.
      ib - The second atom.
      angle1 - The angle.
      ic - The third atom.
      angle2 - The second angle (either a bond angle or a dihedral angle).
      chiral - The chiral flag.
      forceField - The force field to use.
      bondList - A list of bonds to add to.
      Returns:
      The new heavy atom.
    • buildH

      public static Atom buildH(MSGroup residue, String atomName, Atom ia, double bond, Atom ib, double angle1, Atom ic, double angle2, int chiral, int lookUp, ForceField forceField, List<Bond> bondList)
      Build a hydrogen atom.
      Parameters:
      residue - The residue to add the atom to.
      atomName - The name of the atom.
      ia - The first atom.
      bond - The bond length.
      ib - The second atom.
      angle1 - The angle.
      ic - The third atom.
      angle2 - The second angle (either a bond angle or a dihedral angle).
      chiral - The chiral flag.
      lookUp - The BioType key.
      forceField - The force field to use.
      bondList - A list of bonds to add to.
      Returns:
      The new hydrogen atom.
    • buildH

      public static Atom buildH(MSGroup residue, AminoAcidUtils.SideChainType atomName, Atom ia, double bond, Atom ib, double angle1, Atom ic, double angle2, int chiral, ForceField forceField, List<Bond> bondList)
      Build a hydrogen atom.
      Parameters:
      residue - The residue to add the atom to.
      atomName - The name of the atom.
      ia - The first atom.
      bond - The bond length.
      ib - The second atom.
      angle1 - The angle.
      ic - The third atom.
      angle2 - The second angle (either a bond angle or a dihedral angle).
      chiral - The chiral flag.
      forceField - The force field to use.
      bondList - A list of bonds to add to.
      Returns:
      The new hydrogen atom.
    • buildHydrogenAtom

      public static Atom buildHydrogenAtom(MSGroup residue, String atomName, Atom ia, double bond, Atom ib, double angle1, Atom ic, double angle2, int chiral, AtomType atomType, ForceField forceField, List<Bond> bondList)
      Build a hydrogen atom.
      Parameters:
      residue - The residue to add the atom to.
      atomName - The name of the atom.
      ia - The first atom.
      bond - The bond length.
      ib - The second atom.
      angle1 - The angle.
      ic - The third atom.
      angle2 - The second angle (either a bond angle or a dihedral angle).
      chiral - The chiral flag.
      atomType - The atom type.
      forceField - The force field to use.
      bondList - A list of bonds to add to.
      Returns:
      The new hydrogen atom.
    • findAtomType

      public static AtomType findAtomType(int key, ForceField forceField)
      findAtomType.
      Parameters:
      key - The BioType key.
      forceField - a ForceField object.
      Returns:
      a AtomType object.
    • findAtomsOfElement

      public static List<Atom> findAtomsOfElement(Residue residue, int element)
      Finds all Atoms belonging to a Residue of a given atomic number.
      Parameters:
      residue - Residue to search in.
      element - Atomic number to search for.
      Returns:
      A list of matching Atoms.
    • findBondedAtoms

      public static List<Atom> findBondedAtoms(Atom atom, int element)
      Finds Atoms bonded to a given Atom that match a certain atomic number.
      Parameters:
      atom - Atom to search from.
      element - Atomic number to search for.
      Returns:
      Bonded atoms of an element.
    • findBondedAtoms

      public static List<Atom> findBondedAtoms(Atom atom, Atom toExclude, int element)
      Finds Atoms bonded to a given Atom that match a certain atomic number that do not match an excluded atom.
      Parameters:
      atom - Atom to search from.
      toExclude - Atom to exclude from search.
      element - Atomic number to search for.
      Returns:
      Bonded atoms of an element.
    • findNitrogenAtom

      public static Atom findNitrogenAtom(Residue residue)
      Finds the backbone nitrogen of a residue.
      Parameters:
      residue - Amino acid residue to search for.
      Returns:
      backbone nitrogen.
    • findNucleotideO4s

      public static Optional<Atom> findNucleotideO4s(Residue residue)
      Find the O4' of a nucleic acid Residue. This is fairly unique in standard nucleotides, as O4' is the only ether oxygen (bonded to two carbons).
      Parameters:
      residue - Residue to find O4' of.
      Returns:
      O4'.
    • getAlphaCarbon

      public static Atom getAlphaCarbon(Residue residue, Atom N)
      Finds the alpha carbon of a residue, and handles any C-terminal ACE caps while at it.
      Parameters:
      residue - Find the alpha carbon of.
      N - The residue's backbone nitrogen.
      Returns:
      The alpha carbon.
    • hasAttachedAtom

      public static boolean hasAttachedAtom(Atom atom, int element)
      Checks if there is an Atom of a given atomic number bonded to the provided Atom.
      Parameters:
      atom - Atom to search from.
      element - Atomic number to search for.
      Returns:
      If bonded atoms of given element exist.
    • intxyz

      public static void intxyz(Atom atom, Atom ia, double bond, Atom ib, double angle1, Atom ic, double angle2, int chiral)
      This routine was derived from a similar routine in TINKER.
      Parameters:
      atom - The atom to be placed.
      ia - The first atom.
      bond - The bond length.
      ib - The second atom.
      angle1 - The angle.
      ic - The third atom.
      angle2 - The second angle (either a bond angle or a dihedral angle).
      chiral - The chiral flag.
    • numberAtoms

      public static void numberAtoms(MolecularAssembly molecularAssembly)
      Re-number atoms, especially if missing atoms were created.
      Parameters:
      molecularAssembly - The molecular assembly to renumber atoms for.
    • sortAtomsByDistance

      public static Atom[] sortAtomsByDistance(Atom reference, List<Atom> toCompare)
      Sorts toCompare by distance to the reference Atom, returning a sorted array.
      Parameters:
      reference - Atom to compare distances to.
      toCompare - Atoms to sort by distance (not modified).
      Returns:
      Sorted array of atoms in toCompare.
    • sortAtomsByDistance

      public static void sortAtomsByDistance(Atom reference, Atom[] toCompare)
      In-place sorts toCompare by distance to the reference Atom. Modifies toCompare.
      Parameters:
      reference - Atom to compare distances to.
      toCompare - Atoms to sort (in-place) by distance.
    • determineIntxyz

      public static double[] determineIntxyz(double[] ia, double bond, double[] ib, double angle1, double[] ic, double angle2, int chiral)
      This routine was derived from a similar routine in TINKER. It determines at what coordinates an atom would be placed without moving or calling any atoms, relying solely upon coordinates. Passed arrays are copied into local arrays to avoid any over-writing of the passed arrays.

      The chiral argument is 0 if angle2 is a dihedral. Else, if angle2 is the atom-ia-ic angle: -1 indicates left-hand-rule placement. +1 indicates right-hand-rule placement. +3 indicates trigonal planar placement.

      Chiral +3 replaces the angle1 and angle2 constraints with a planarity constraint, and minimized, equipartitioned deviation from angle1 and angle2.

      Parameters:
      ia - a double[] of atomic coordinates.
      bond - The bond length.
      ib - a double[] of atomic coordinates.
      angle1 - The angle.
      ic - a double[] of atomic coordinates.
      angle2 - The second angle (either a bond angle or a dihedral angle).
      chiral - The chiral flag (0, 1, -1, or 3).
      Returns:
      A double[] with XYZ coordinates at which an atom would be placed.