Class Molecule3DFunctions


  • public class Molecule3DFunctions
    extends java.lang.Object
    • Constructor Detail

      • Molecule3DFunctions

        public Molecule3DFunctions()
    • Method Detail

      • getAdjacencyMatrix

        public static double[][] getAdjacencyMatrix​(Molecule3D mol)
      • getAcidicProtons

        public static java.util.List<java.lang.Integer> getAcidicProtons​(Molecule3D mol)
        Protons attached to an O.
        Parameters:
        mol -
        Returns:
      • getDeprotonableAtoms

        public static java.util.List<java.lang.Integer> getDeprotonableAtoms​(Molecule3D mol)
        Donor atoms. Oxygen with a connected hydrogen.
        Parameters:
        mol -
        Returns:
      • getProtonableAtoms

        public static java.util.List<java.lang.Integer> getProtonableAtoms​(Molecule3D mol)
      • isProtonableNitrogen

        public static boolean isProtonableNitrogen​(Molecule3D mol,
                                                   int indexAtom)
      • has2DCoordinates

        public static boolean has2DCoordinates​(Molecule3D mol)
      • has3DCoordinates

        public static boolean has3DCoordinates​(Molecule3D mol)
      • hasChargedAtom

        public static boolean hasChargedAtom​(Molecule3D ff)
      • getStericHindrance

        public static double getStericHindrance​(Molecule3D molecule3D,
                                                java.util.List<java.lang.Integer> liIndexAtoms)
        Calculates a value for the steric hindrance of the atoms from liIndexAtoms to all other atoms.
        Parameters:
        molecule3D -
        liIndexAtoms -
        Returns:
      • isPyramedal

        public static boolean isPyramedal​(Molecule3D molecule3D)
      • isTripleBond

        public static boolean isTripleBond​(Molecule3D molecule3D)
      • addMissingHydrogens

        public static void addMissingHydrogens​(Molecule3D molecule3D)
      • writeCharge2Label

        public static void writeCharge2Label​(Molecule3D molecule3D)
      • flagSubstructure

        public static void flagSubstructure​(Molecule3D molecule3D,
                                            java.lang.String idCodeQ1,
                                            int[] arrIndexAts2Flag)
        Parameters:
        molecule3D - Molecule
        idCodeQ1 - The idcode for the substructure (ode fragment)
        arrIndexAts2Flag - the index for atoms in the idCode1q. The corresponding atoms in the molecule will be deleted.
      • getNeutralized

        public static Molecule3D getNeutralized​(Molecule3D molecule3D,
                                                int indexAtomReactiveCenter)
        Protonates or deprotonates the specified atom, if necessary and possible, to neutralize a charge.
        Parameters:
        molecule3D -
        Returns:
      • distortCoordinates

        public static Molecule3D distortCoordinates​(Molecule3D molecule3D,
                                                    double maxLengthDistortion)
        Changes the coordinates with a random value. Gaussian distribution.
        Parameters:
        molecule3D -
        maxLengthDistortion - if 0 just a copy of ff will be returned.
        Returns:
      • addRNDCoordinates

        public static void addRNDCoordinates​(Molecule3D mol,
                                             double maxNoise)
      • calculateCoordinatesIterative

        public static void calculateCoordinatesIterative​(Molecule3D mol,
                                                         double[][] arrDist)
      • getDistanceFromCoord

        public static double getDistanceFromCoord​(Molecule3D mol,
                                                  int atom1,
                                                  int atom2)
      • getDistanceArray

        public static double[][] getDistanceArray​(Molecule3D mol)
      • isParametrized

        public static boolean isParametrized​(Molecule3D mol)
      • isConnectedAtoms

        public static boolean isConnectedAtoms​(Molecule3D ff,
                                               java.util.List<java.lang.Integer> liIndexAtoms,
                                               int atm2)
      • isAliphaticAtom

        public static boolean isAliphaticAtom​(Molecule3D mol,
                                              int atm)
        Parameters:
        mol -
        atm - index of atom
        Returns:
        false if atom is not C or if one of the neighbours is N, O, F, S, P or Cl.
      • removeElectronPairs

        public static void removeElectronPairs​(Molecule3D mol)
      • removeHydrogensAndElectronPairs

        public static void removeHydrogensAndElectronPairs​(Molecule3D mol)
      • removeElement

        public static void removeElement​(Molecule3D mol,
                                         int atomicNo)
      • removeNonAromaticC

        public static void removeNonAromaticC​(Molecule3D mol)
      • removeCarbon

        public static void removeCarbon​(Molecule3D mol)
        Removes all Carbon atoms, except the FLAG_CENTER_ATOM is set.
        Parameters:
        mol - Molecule
      • flagCarbon

        public static void flagCarbon​(Molecule3D mol)
      • flagUnflaggedWithFlagCenter

        public static void flagUnflaggedWithFlagCenter​(Molecule3D mol)
      • getConnectionTable

        public static int[][] getConnectionTable​(Molecule3D mol)
      • removeAtomsIfCarbon

        public static final void removeAtomsIfCarbon​(Molecule3D mol,
                                                     java.util.List<java.lang.Integer> liIndices2Delete)
        Parameters:
        mol - the atoms in this molecule will be deleteted.
        liIndices2Delete - list with Integer as indices for the atoms we will delete.
      • removeAllAtomsWithoutNeighbours

        public static final Molecule3D removeAllAtomsWithoutNeighbours​(Molecule3D ffMol)
      • removeAtoms

        public static final void removeAtoms​(Molecule3D mol,
                                             java.util.List<java.lang.Integer> liIndices2Delete)
      • removeFlaggedAtoms

        public static final void removeFlaggedAtoms​(Molecule3D mol)
      • replaceAtoms

        public static final void replaceAtoms​(Molecule3D ffMol,
                                              java.lang.String idcode2Replace,
                                              java.lang.String idcodeNewSubstructure,
                                              int[][] arrMapAtoms)
        09.03.2020 For what is that good?
        Parameters:
        ffMol -
        idcode2Replace -
        idcodeNewSubstructure -
        arrMapAtoms -
      • formatAtomDescriptionsForViewer

        public static final void formatAtomDescriptionsForViewer​(Molecule3D mol,
                                                                 boolean showIndex)
      • formatAtomDescriptionsForViewer

        public static final void formatAtomDescriptionsForViewer​(Molecule3D mol)
      • calcTerminalAlkylGroupsCenter

        public static final int calcTerminalAlkylGroupsCenter​(Molecule3D mol)
        Generates a center atom for each atom of a terminal alkyl group -CC, -C(C)C and -C(C)(C)C. The interaction type is the core atom of the substituents. All center atoms have identical coordinates. The original index of each considered atom is written to Molecule3D.INFO_ATOMGROUP.
        Parameters:
        mol - Molecule, the atoms used for calculating the center are flagged with FLAG1
        Returns:
        number of terminal alkyl groups (Ethyl, Propyl, Butyl).
      • findTerminalMethylAtCarb

        public static final int[] findTerminalMethylAtCarb​(Molecule3D mol)
        Parameters:
        mol -
        Returns:
        indices for all terminal methyl CH3 groups which are connected to a carbon.
      • getCenterGravity

        public static final Coordinates getCenterGravity​(Molecule3D mol,
                                                         int[] indices)
      • getCentered

        public static final Molecule3D getCentered​(Molecule3D molecule3D,
                                                   java.util.List<java.lang.Integer> liAtomIndexCenter)
      • getTopologicalCenter

        public static final java.util.List<java.lang.Integer> getTopologicalCenter​(int[][] arrTopoDist)
        Topological centaer atoms are the atoms with the lowest squared sum of topological distances to all atoms.
        Returns:
      • getTopologicalCenter

        public static final java.util.List<java.lang.Integer> getTopologicalCenter​(int[][] arrTopoDist,
                                                                                   ListWithIntVec ilIndexAtoms)
      • getPheriphericPoints

        public static final java.util.List<java.lang.Integer> getPheriphericPoints​(int[][] arrTopoDist)
        Gets the points with the maximum sum of squared topological distances to all atoms.
        Parameters:
        arrTopoDist -
        Returns:
      • getTopologicalDistanceMatrix

        public static final int[][] getTopologicalDistanceMatrix​(Molecule3D mol)
      • getLongestChain

        public static final java.util.List<java.lang.Integer> getLongestChain​(Molecule3D ff)
      • getTreeFromBroadFirstSearch

        public static final javax.swing.tree.DefaultMutableTreeNode getTreeFromBroadFirstSearch​(Molecule3D molecule3D,
                                                                                                int indexAtomStart)
        User object in DefaultMutableTreeNode is the index of the atom. Root contains indexAtomStart.
        Parameters:
        molecule3D -
        indexAtomStart -
        Returns:
      • getTreeFromComplete

        public static final javax.swing.tree.DefaultMutableTreeNode getTreeFromComplete​(Molecule3D molecule3D,
                                                                                        int indexAtomStart)
        Get all possible paths. Only crossing is not allowed.
        Parameters:
        molecule3D -
        indexAtomStart -
        Returns:
      • getPath

        public static final int[] getPath​(Molecule3D ff,
                                          int indexAt1,
                                          int indexAt2)
      • getLayersFromBroadFirstSearch

        public static final java.util.List<java.util.List<java.lang.Integer>> getLayersFromBroadFirstSearch​(Molecule3D molecule3D,
                                                                                                            int indexAtomStart)
        Returns the atom indices as layers of the start atom. First layer is indexAtomStart.
        Parameters:
        molecule3D -
        indexAtomStart -
        Returns:
      • getLongestChain

        public static final java.util.List<java.lang.Integer> getLongestChain​(Molecule3D molecule3D,
                                                                              int indexAtomStart)
      • toString

        public static final java.lang.String toString​(Molecule3D mol)
      • getDeprotonated

        public static Molecule3D getDeprotonated​(Molecule3D molecule3D,
                                                 int indexAtomReactiveCenter)
        Deprotonates and decreases charge by 1.
        Parameters:
        molecule3D -
        indexAtomReactiveCenter -
        Returns:
        null if no hydrogen is attached to indexAtomReactiveCenter.
      • getProtonated

        public static Molecule3D getProtonated​(Molecule3D molecule3D,
                                               int indexAtomReactiveCenter)
        Protonates and increases charge by 1.
        Parameters:
        molecule3D -
        Returns: