Class Molecule

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    ExtendedMolecule

    public class Molecule
    extends java.lang.Object
    implements java.io.Serializable
    See Also:
    Serialized Form
    • Constructor Detail

      • Molecule

        public Molecule()
      • Molecule

        public Molecule​(int maxAtoms,
                        int maxBonds)
    • Method Detail

      • getAtomicNoFromLabel

        public static int getAtomicNoFromLabel​(java.lang.String atomLabel)
      • getAllowedValences

        public static byte[] getAllowedValences​(int atomicNo)
        For any known atomicNo this returns all allowed atom valences. For amino acid pseudo atoms it returns {2} and for all other atomicNos this returns {cDefaultAtomValence}.
        Parameters:
        atomicNo -
        Returns:
        array of allowed valences with a guaranteed minimum size of 1
      • getAngle

        public static double getAngle​(double x1,
                                      double y1,
                                      double x2,
                                      double y2)
      • getAngleDif

        public static double getAngleDif​(double angle1,
                                         double angle2)
      • addAtom

        public int addAtom​(double x,
                           double y)
        High level function for constructing a molecule.
        Parameters:
        x -
        y -
        Returns:
      • addAtom

        public int addAtom​(double x,
                           double y,
                           double z)
        High level function for constructing a molecule.
        Parameters:
        x -
        y -
        z -
        Returns:
      • addAtom

        public int addAtom​(java.lang.String atomLabel)
        High level function for constructing a molecule.
        Parameters:
        atomLabel -
        Returns:
      • addAtom

        public int addAtom​(int atomicNo)
        High level function for constructing a molecule.
        Parameters:
        atomicNo -
        Returns:
      • suggestBondType

        public int suggestBondType​(int atom1,
                                   int atom2)
        Suggests either cBondTypeSingle or cBondTypeMetalLigand whatever seems more appropriate for a new bond between the two atoms.
        Parameters:
        atom1 -
        atom2 -
        Returns:
        preferred bond type
      • addBond

        public int addBond​(int atom1,
                           int atom2)
        High level function for constructing a molecule. Adds a single or metal bond between the two atoms depending on whether one of them is a metal atom.
        Parameters:
        atom1 -
        atom2 -
        Returns:
        new bond index
      • addBond

        public int addBond​(int atom1,
                           int atom2,
                           int type)
        High level function for constructing a molecule.
        Parameters:
        atom1 -
        atom2 -
        type -
        Returns:
        new bond index
      • addOrChangeAtom

        public boolean addOrChangeAtom​(double x,
                                       double y,
                                       int atomicNo,
                                       int mass,
                                       int abnormalValence,
                                       int radical,
                                       java.lang.String customLabel)
        High level function for constructing a molecule.
        Parameters:
        x -
        y -
        atomicNo -
        mass -
        abnormalValence -
        radical -
        Returns:
      • addOrChangeBond

        public int addOrChangeBond​(int atm1,
                                   int atm2,
                                   int type)
        High level function for constructing a molecule.
        Parameters:
        atm1 -
        atm2 -
        type -
        Returns:
      • addRing

        public boolean addRing​(double x,
                               double y,
                               int ringSize,
                               boolean aromatic)
        High level function for constructing a molecule.
        Parameters:
        x -
        y -
        ringSize -
        aromatic -
        Returns:
      • addRingToAtom

        public boolean addRingToAtom​(int atom,
                                     int ringSize,
                                     boolean aromatic)
        High level function for constructing a molecule.
        Parameters:
        atom -
        ringSize -
        aromatic -
        Returns:
      • addRingToBond

        public boolean addRingToBond​(int bond,
                                     int ringSize,
                                     boolean aromatic)
        High level function for constructing a molecule.
        Parameters:
        bond -
        ringSize -
        aromatic -
        Returns:
      • changeAtom

        public boolean changeAtom​(int atom,
                                  int atomicNo,
                                  int mass,
                                  int abnormalValence,
                                  int radical)
        High level function for constructing a molecule.
        Parameters:
        atom -
        atomicNo -
        mass -
        abnormalValence -
        radical -
        Returns:
      • changeAtomCharge

        public boolean changeAtomCharge​(double x,
                                        double y,
                                        boolean positive)
        High level function for constructing a molecule.
        Parameters:
        x -
        y -
        positive -
        Returns:
      • changeAtomCharge

        public boolean changeAtomCharge​(int atom,
                                        boolean positive)
        High level function for constructing a molecule.
        Parameters:
        atom -
        positive -
        Returns:
      • changeBond

        public boolean changeBond​(int bnd,
                                  int type)
        High level function for constructing a molecule.
        Parameters:
        bnd -
        type -
        Returns:
      • addMolecule

        public int[] addMolecule​(Molecule mol)
        Copies all atoms and bonds of mol to the end of this Molecule's atom and bond tables. If mol is a fragment then this Molecule's fragment flag is set to true and all query features of mol are also copied. High level function for constructing a molecule.
        Parameters:
        mol -
        Returns:
        atom mapping from original mol to this molecule after incorporation of mol
      • addMolecule

        public int[] addMolecule​(Molecule mol,
                                 int atoms,
                                 int bonds)
        Copies first atoms and first bonds of mol to the end of this Molecule's atom and bond tables. If mol is a fragment then this Molecule's fragment flag is set to true and all query features of mol are also copied. Typically, this is used to add a molecule without explicit hydrogen atoms. If parities of copied molecules are valid, then you may call setParitiesValid() on this molecule after adding molecules. High level function for constructing a molecule.
        Parameters:
        mol -
        atoms - count of atoms to be copied
        bonds - count of bonds to be copied
        Returns:
        atom mapping from original mol to this molecule after incorporation of mol
      • addSubstituent

        public int[] addSubstituent​(Molecule substituent,
                                    int connectionAtom)
        Adds and connects the substituent molecule to the connectionAtom of this molecule. Substituent atoms with atomicNo=0 are not copied and considered to represent the connectionAtom. Bonds leading to them, however, are copied and connected to the connectionAtom. High level function for constructing a molecule.
        Parameters:
        substituent -
        connectionAtom -
        Returns:
        atom mapping from substituent to this molecule after addition of substituent
      • addSubstituent

        public int[] addSubstituent​(Molecule substituent,
                                    int connectionAtom,
                                    boolean encodeRingClosuresInMapNo)
        Adds and connects the substituent molecule to the connectionAtom of this molecule. Substituent atoms with atomicNo=0 are not copied and considered to represent the connectionAtom. Bonds leading to them, however, are copied and connected to the connectionAtom. If encodeRingClosuresInMapNo==true, then connections (ring closures) to atoms other than connectionAtom are allowed and encoded in the substituents atomMapNo as closureAtomIndex = atomicNo-1. High level function for constructing a molecule.
        Parameters:
        substituent -
        connectionAtom -
        encodeRingClosuresInMapNo - for ring closures set atomicNo to 0 and atomMapNo to thsi Molecule's atom index+1
        Returns:
        atom mapping from substituent to this molecule after addition of substituent
      • copyMolecule

        public void copyMolecule​(Molecule destMol)
        Copies this molecule including parity settings, if valid. The original content of destMol is replaced. Helper arrays are not copied and need to be recalculated if needed.
        Parameters:
        destMol -
      • copyAtom

        public int copyAtom​(Molecule destMol,
                            int sourceAtom,
                            int esrGroupOffsetAND,
                            int esrGroupOffsetOR)
        Creates a new atom in destMol and copies all source atom properties including atom list, custom label, flags, and mapNo to it.
        Parameters:
        destMol -
        sourceAtom -
        esrGroupOffsetAND - -1 to create new ESR group or destMol ESR group count from esrGroupCountAND()
        esrGroupOffsetOR - -1 to create new ESR group or destMol ESR group count from esrGroupCountOR()
        Returns:
        index of new atom in destMol
      • copyBond

        public int copyBond​(Molecule destMol,
                            int sourceBond,
                            int esrGroupOffsetAND,
                            int esrGroupOffsetOR,
                            int[] atomMap,
                            boolean useBondTypeDelocalized)
        Parameters:
        destMol -
        sourceBond -
        esrGroupOffsetAND - -1 to create new ESR group or destMol ESR group count from esrGroupCountAND()
        esrGroupOffsetOR - -1 to create new ESR group or destMol ESR group count from esrGroupCountOR()
        atomMap -
        useBondTypeDelocalized -
        Returns:
      • copyBond

        public int copyBond​(Molecule destMol,
                            int sourceBond,
                            int esrGroupOffsetAND,
                            int esrGroupOffsetOR,
                            int destAtom1,
                            int destAtom2,
                            boolean useBondTypeDelocalized)
        Parameters:
        destMol -
        sourceBond -
        esrGroupOffsetAND - -1 to create new ESR group or destMol ESR group count from esrGroupCountAND()
        esrGroupOffsetOR - -1 to create new ESR group or destMol ESR group count from esrGroupCountOR()
        destAtom1 - first bond atom index in destination molecule
        destAtom2 - second bond atom index in destination molecule
        useBondTypeDelocalized -
        Returns:
      • copyMoleculeProperties

        public void copyMoleculeProperties​(Molecule destMol)
        Copies name,isFragment,chirality and validity of parity & CIP flags. When copying molecules parts only or when changing the atom order during copy, then atom parities or CIP parities may not be valid anymore and invalidateHelperArrays([affected bits]) should be called in these cases.
        Parameters:
        destMol -
      • invalidateHelperArrays

        public void invalidateHelperArrays​(int helperBits)
        Clears helperBits from mValidHelperArrays.
        Parameters:
        helperBits -
      • renumberESRGroups

        public int renumberESRGroups​(int type)
        For the given ESR type (AND or OR) renumbers all group indexes starting from 0. Use this, if stereo center deletion or other operations caused an inconsisten ESR number state. Molecule and derived methods do this automatically.
        Parameters:
        type - cESRTypeAnd or cESRTypeOr
        Returns:
        number of ESR groups
      • swapAtoms

        public void swapAtoms​(int atom1,
                              int atom2)
        Swaps two atoms' indexes/locations in the atom table. This is used to move hydrogen atoms to the end of the table and for some testing purposes.
        Parameters:
        atom1 -
        atom2 -
      • swapBonds

        public void swapBonds​(int bond1,
                              int bond2)
        Swaps two bonds' indexes/locations in the atom table. This is used to move hydrogen atoms to the end of the table and for some testing purposes.
        Parameters:
        bond1 -
        bond2 -
      • deleteAtom

        public void deleteAtom​(int atom)
        High level function for constructing a molecule. After the deletion the original order of atom and bond indexes is retained.
        Parameters:
        atom -
      • deleteAtomOrBond

        public boolean deleteAtomOrBond​(double x,
                                        double y)
        High level function for constructing a molecule.
        Parameters:
        x -
        y -
        Returns:
      • deleteBond

        public void deleteBond​(int bond)
        High level function for constructing a molecule. After the deletion the original order of atom and bond indexes is retained.
        Parameters:
        bond -
      • deleteBondAndSurrounding

        public void deleteBondAndSurrounding​(int bond)
        High level function for constructing a molecule. After the deletion the original order of atom and bond indexes is retained.
        Parameters:
        bond -
      • deleteAtoms

        public int[] deleteAtoms​(boolean[] deleteAtom)
        High level function for constructing a molecule. This method deletes atoms flagged in deleteAtom and all bonds leading to them. After the deletion the original order of atom and bond indexes is retained.
        Parameters:
        deleteAtom -
        Returns:
      • deleteAtoms

        public int[] deleteAtoms​(int[] atomList)
        High level function for constructing a molecule. After the deletion the original order of atom and bond indexes is retained.
        Parameters:
        atomList -
        Returns:
      • getDeleteAtomsBondMap

        public int[] getDeleteAtomsBondMap​(boolean[] deleteAtom)
        Parameters:
        deleteAtom -
        Returns:
        mapping array from old to new bond indexes resulting from a deletion of flagged atoms
      • getDeleteAtomsBondMap

        public int[] getDeleteAtomsBondMap​(int[] atomList)
        Parameters:
        atomList -
        Returns:
        mapping array from old to new bond indexes resulting from a deletion of flagged atoms
      • deleteSelectedAtoms

        public boolean deleteSelectedAtoms()
        High level function for constructing a molecule. Delete all selected atoms and all bonds attached to them. After the deletion the original order of atom and bond indexes is retained.
        Returns:
      • markAtomForDeletion

        public void markAtomForDeletion​(int atom)
        Marks this atom to be deleted in a later call to deleteMarkedAtomsAndBonds().
        Parameters:
        atom -
      • markBondForDeletion

        public void markBondForDeletion​(int bond)
        Marks this bond to be deleted in a later call to deleteMarkedAtomsAndBonds().
        Parameters:
        bond -
      • isAtomMarkedForDeletion

        public boolean isAtomMarkedForDeletion​(int atom)
        Checks whether this atom was marked to be deleted and not deleted yet.
        Parameters:
        atom -
        Returns:
      • isBondMarkedForDeletion

        public boolean isBondMarkedForDeletion​(int bond)
        Checks whether this bond was marked to be deleted and not deleted yet.
        Parameters:
        bond -
        Returns:
      • deleteMarkedAtomsAndBonds

        public int[] deleteMarkedAtomsAndBonds()
        High level function for constructing a molecule. Deletes all atoms and bonds from the molecule, which were marked before for deletion by calling markAtomForDeletion() or markBondForDeletion(). Bonds connecting atoms of which at least one is marked for deletion, are deleted automatically and don't require to be explicitly marked.
        When multiple atoms and/or bonds need to be deleted, marking them and calling this method is more efficient than deleting them individually with deleteAtom() and deleteBond(). Bonds, whose atoms carry opposite charges are treated in the following manner: If only one of the two bond atoms is kept, then its absolute charge will be reduced by 1. After the deletion the original order of atom and bond indexes is retained.
        Returns:
        mapping from old to new atom indices; null if no atoms nor bonds were deleted
      • deleteMolecule

        @Deprecated
        public void deleteMolecule()
        Deprecated.
        Use clear() instead of this method
      • clear

        public void clear()
        Empties the molecule to serve as container for constructing a new molecule, e.g. by multiply calling addAtom(...), addBond(...) and other high level methods.
      • removeAtomSelection

        public void removeAtomSelection()
      • removeAtomColors

        public void removeAtomColors()
      • removeAtomCustomLabels

        public void removeAtomCustomLabels()
        This removes all custom labels from the atoms.
      • removeAtomMarkers

        public void removeAtomMarkers()
      • removeBondHiliting

        public void removeBondHiliting()
      • findAtom

        public int findAtom​(double pickx,
                            double picky)
        Parameters:
        pickx -
        picky -
        Returns:
        index of closest of nearby atoms or -1, if no atom is close
      • findBond

        public int findBond​(double pickx,
                            double picky)
        Parameters:
        pickx -
        picky -
        Returns:
        index of closest of nearby bonds or -1, if no bond is close
      • getAllAtoms

        public int getAllAtoms()
        Returns:
        the number of all atoms, which includes hydrogen atoms.
      • getAllBonds

        public int getAllBonds()
        Returns:
        the number of all bonds, which includes those connecting hydrogen atoms.
      • getAtomAbnormalValence

        public int getAtomAbnormalValence​(int atom)
        Get an atom's defined maximum valance if different from the default one.
        Parameters:
        atom -
        Returns:
        valence 0-14: new maximum valence; -1: use default
      • getAtomCharge

        public int getAtomCharge​(int atom)
        Parameters:
        atom -
        Returns:
        the formal atom charge
      • getAtomCIPParity

        public int getAtomCIPParity​(int atom)
        The atom Cahn-Ingold-Prelog parity is a calculated property available above/equal helper level cHelperCIP. It encodes the stereo configuration of an atom with its neighbors using up/down-bonds or 3D-atom-coordinates, whatever is available. It depends on the atom indices of the neighbor atoms and their orientation is space. This method is called by the Canonizer and usually should not be called otherwise.
        Parameters:
        atom -
        Returns:
        one of cAtomCIPParityNone,cAtomCIPParityRorM,cAtomCIPParitySorP,cAtomCIPParityProblem
      • getAtomColor

        public int getAtomColor​(int atom)
      • getAtomCoordinates

        public Coordinates[] getAtomCoordinates()
        Returns:
        the entire atom coordinate array
      • getAtomESRGroup

        public int getAtomESRGroup​(int atom)
        This is MDL's enhanced stereo representation (ESR). Stereo atoms and bonds with the same ESR type (AND or OR) and the same ESR group number are in the same group, i.e. within this group they have the defined (relative) stereo configuration.
        Parameters:
        atom -
        Returns:
        group index starting with 0
      • getAtomESRType

        public int getAtomESRType​(int atom)
        This is MDL's enhanced stereo representation (ESR). Stereo atoms and bonds with the same ESR type (AND or OR) and the same ESR group number are in the same group, i.e. within this group they have the defined (relative) stereo configuration.
        Parameters:
        atom -
        Returns:
        one of cESRTypeAbs,cESRTypeAnd,cESRTypeOr
      • getAtomicNo

        public int getAtomicNo​(int atom)
        In addition to the natural atomic numbers, we support additional pseudo atomic numbers. Most of these are for compatibility with the MDL atom table, e.g. for amino acids and R-groups. D and T are accepted for setting, but are on-the-fly translated to H with the proper atom mass.
        Parameters:
        atom -
        Returns:
      • getAtomCustomLabel

        public java.lang.String getAtomCustomLabel​(int atom)
        If a custom atom label is set, a molecule depiction displays the custom label instead of the original one.
        Parameters:
        atom -
        Returns:
        null or previously defined atom custom label
      • getAtomCustomLabelBytes

        public byte[] getAtomCustomLabelBytes​(int atom)
        This method is more efficient than getAtomCustomLabel(), because internally atom custom labels are stored as a byte[]. Use this if you can work with bytes and don't need a String.
        Parameters:
        atom -
        Returns:
        null or previously defined atom custom label as byte[]
      • getAtomLabel

        public java.lang.String getAtomLabel​(int atom)
        Parameters:
        atom -
        Returns:
        standard atom label of the atom: C,Li,Sc,...
      • getAtomList

        public int[] getAtomList​(int atom)
        The list of atoms that are allowed at this position during sub-structure search. (or refused atoms, if atom query feature cAtomQFAny is set).
        Parameters:
        atom -
        Returns:
        null or sorted list of unique atomic numbers, if defined
      • getAtomListString

        public java.lang.String getAtomListString​(int atom)
      • getAtomMapNo

        public int getAtomMapNo​(int atom)
        Returns an atom mapping number within the context of a reaction. Atoms that share the same mapping number on the reactant and product side are considered to be the same atom.
        Parameters:
        atom -
        Returns:
      • getAtomMass

        public int getAtomMass​(int atom)
        Parameters:
        atom -
        Returns:
        atom mass, if is specific isotop, otherwise 0 for natural abundance
      • getAtomParity

        public int getAtomParity​(int atom)
        The atom parity is a calculated property available above/equal helper level cHelperParities. It describes the stereo configuration of a chiral atom and is calculated either from 2D-atom-coordinates and up/down-bonds or from 3D-atom-coordinates, whatever is available. It depends on the atom indexes of the neighbor atoms and their orientation in space.
        The parity is defined as follows: Look at the chiral atom such that its neighbor atom with the highest atom index (or the hydrogen atom if it is implicit) is oriented to the back. If the remaining three neighbors are in clockwise order (considering ascending atom indexes) than the parity is 1. If they are in anti-clockwise order, then the parity is 2.
        For linear chirality (allenes): Look along the straight line of double bonds such that the rear neighbor with the lower atom index points to the top. If the front neighbor with the lower atom index points to the right than the parity is 1.
        Parameters:
        atom -
        Returns:
        one of cAtomParity1,cAtomParity2,cAtomParityNone,cAtomParityUnknown
      • getAtomQueryFeatures

        public int getAtomQueryFeatures​(int atom)
        Returns all set query features for this atom. In order to get all features related to a certain subject use something like this: getAtomQueryFeatures() & cAtomQFHydrogen
        Parameters:
        atom -
        Returns:
      • getAtomRadical

        public int getAtomRadical​(int atom)
        Gets an atom's radical state as singulet,dublet,triplet or none
        Parameters:
        atom -
        Returns:
        one of cAtomRadicalStateNone,cAtomRadicalStateS,cAtomRadicalStateD,cAtomRadicalStateT
      • getCoordinates

        public Coordinates getCoordinates​(int atom)
      • getAtomX

        public double getAtomX​(int atom)
      • getAtomY

        public double getAtomY​(int atom)
      • getAtomZ

        public double getAtomZ​(int atom)
      • getBounds

        public java.awt.geom.Rectangle2D.Double getBounds​(java.awt.geom.Rectangle2D.Double r)
      • getDefaultAverageBondLength

        public static double getDefaultAverageBondLength()
      • setDefaultAverageBondLength

        public static void setDefaultAverageBondLength​(double defaultAVBL)
        When the molecule adds a new bond to a new atom or a new ring, then atoms are positioned such that the lengths of the new bonds are equal to the average length of existing bonds. If there are no existing bonds, then this default is used. If the default is not set by this function, then it is 24.
        Parameters:
        defaultAVBL -
      • getAverageBondLength

        public double getAverageBondLength()
        Calculates and returns the mean bond length. If the molecule has no bonds, then the smallest distance between unconnected atoms is returned. If is has less than 2 atoms, cDefaultAverageBondLength is returned.
        Returns:
      • getAverageBondLength

        public double getAverageBondLength​(int atoms,
                                           int bonds)
        Calculates and returns the mean bond length of all bonds 0...bonds. If there are no bonds, then the smallest distance between unconnected atoms is returned. If we have less than 2 atoms, cDefaultAverageBondLength is returned.
        Parameters:
        atoms - atom indexes >= this are not considered
        bonds - bond indexes >= this are not considered
        Returns:
      • getAverageBondLength

        public double getAverageBondLength​(int atoms,
                                           int bonds,
                                           double defaultBondLength)
        Calculates and returns the mean bond length of all bonds 0...bonds. If there are no bonds, then the smallest distance between unconnected atoms is determined and a reasonable potential bond length derived from that is returned. If we have less than 2 atoms, defaultBondLength is returned.
        Parameters:
        atoms - atom indexes >= this are not considered
        bonds - bond indexes >= this are not considered
        defaultBondLength -
        Returns:
      • getAverageBondLength

        public double getAverageBondLength​(int atoms,
                                           int bonds,
                                           double defaultBondLength,
                                           Coordinates[] coords)
        Calculates and returns the mean bond length of all bonds 0...bonds. If there are no bonds, then the smallest distance between unconnected atoms is determined and a reasonable potential bond length derived from that is returned. If we have less than 2 atoms, defaultBondLength is returned.
        Parameters:
        atoms - atom indexes >= this are not considered
        bonds - bond indexes >= this are not considered
        defaultBondLength -
        coords - may be a second set of the molecule's coordinates, e.g. from a Conformer
        Returns:
      • getBondAngle

        public double getBondAngle​(int atom1,
                                   int atom2)
      • calculateTorsion

        public double calculateTorsion​(int[] atom)
        Calculates a signed torsion as an exterior spherical angle from a valid 4-atom strand. Looking along the central bond, the torsion angle is 0.0, if the projection of front and rear bonds point in the same direction. If the front bond is rotated in the clockwise direction, the angle increases, i.e. has a positive value. http://en.wikipedia.org/wiki/Dihedral_angle
        Parameters:
        atom - 4 valid atom indices defining a connected atom sequence
        Returns:
        torsion in the range: -pi <= torsion <= pi
      • center

        public void center()
        Translate this molecule's 3D-coordinates such that its center of gravity is moved to P(0,0,0) assuming all atoms have the same mass.
      • translate

        public void translate​(double dx,
                              double dy,
                              double dz)
        Translate this molecule's 3D-coordinates by adding the dx,dy,dz shifts to all atom coordinates.
      • getBondAtom

        public int getBondAtom​(int no,
                               int bond)
        Parameters:
        no - 0 or 1
        bond -
        Returns:
        atom index
      • getBondCIPParity

        public int getBondCIPParity​(int bond)
        The bond Cahn-Ingold-Prelog parity is a calculated property available above/equal helper level cHelperCIP. It encodes the stereo configuration of a bond with its neighbors using 2D-coordinates and up/down-bonds or 3D-atom-coordinates, whatever is available. It depends on the atom indices of the neighbor atoms and their orientation is space. This method is called by the Canonizer and usually should not be called otherwise. Considered are E/Z-double bonds and M/P-BINAP type single bonds.
        Parameters:
        bond -
        Returns:
        one of cBondCIPParityNone,cBondCIPParityEorP,cBondCIPParityZorM,cBondCIPParityProblem
      • getBondESRGroup

        public int getBondESRGroup​(int bond)
        This is MDL's enhanced stereo representation (ESR). Stereo atoms and bonds with the same ESR type (AND or OR) and the same ESR group number are in the same group, i.e. within this group they have the defined (relative) stereo configuration.
        Parameters:
        bond -
        Returns:
        group index starting with 0
      • getBondESRType

        public int getBondESRType​(int bond)
        This is MDL's enhanced stereo representation (ESR). Stereo atoms and bonds with the same ESR type (AND or OR) and the same ESR group number are in the same group, i.e. within this group they have the defined (relative) stereo configuration.
        Parameters:
        bond -
        Returns:
        one of cESRTypeAbs,cESRTypeAnd,cESRTypeOr
      • getBondLength

        public double getBondLength​(int bond)
        Parameters:
        bond -
        Returns:
        bond length calculated from atom 2D-coordinates.
      • getBondOrder

        public int getBondOrder​(int bond)
        Returns the formal bond order. Delocalized rings have alternating single and double bonds, which are returned as such. Bonds that are explicitly marked as being delocalized are returned as 1. Dative bonds are returned as 0.
        Parameters:
        bond -
        Returns:
        formal bond order 0 (dative bonds), 1, 2, or 3
      • getBondParity

        public int getBondParity​(int bnd)
        Returns the pre-calculated bond parity, e.g. cBondParityEor1. To distinguish double bond parities (E/Z) from parities of axial chirality, e.g. BINAP type (1/2) simply check with getBondOrder(bond): If the order is 2, then the parity describes E/Z, otherwise an axial parity.
        Parameters:
        bnd -
        Returns:
        one of cBondParity???
      • getBondQueryFeatures

        public int getBondQueryFeatures​(int bnd)
      • isBondBridge

        public boolean isBondBridge​(int bond)
      • getBondBridgeMinSize

        public int getBondBridgeMinSize​(int bond)
      • getBondBridgeMaxSize

        public int getBondBridgeMaxSize​(int bond)
      • getBondType

        public int getBondType​(int bond)
        Returns bond type combining bond order and stereo orientation.
        Parameters:
        bond -
        Returns:
        one of cBondTypeSingle,cBondTypeDouble,cBondTypeUp,cBondTypeCross,...
      • getBondTypeSimple

        public int getBondTypeSimple​(int bond)
        This is the bond type without stereo information.
        Parameters:
        bond -
        Returns:
        cBondTypeSingle,cBondTypeDouble,cBondTypeTriple,(cBondTypeDelocalized if used)
      • getChirality

        public int getChirality()
        Gets the overall chirality of the molecule, which is a calculated information considering: Recognition of stereo centers and stereo bonds, defined ESR features, meso detection. The chirality combines the knowledge about how many stereo isomers are represented, whether all of these are meso, whether we have one defined stereo isomer, a mixture of racemates, epimers, or other diastereomers. The information is used during depiction.
      • getMaxAtoms

        public int getMaxAtoms()
        The currently defined maximum of atoms, which increases automatically when using high level construction methods and new atoms exceed the current maximum.
        Returns:
      • setMaxAtoms

        public void setMaxAtoms​(int v)
        Usually called automatically and hardly needed to be called.
        Parameters:
        v -
      • getMaxBonds

        public int getMaxBonds()
        The currently defined maximum of bonds, which increases automatically when using high level construction methods and new bonds exceed the current maximum.
        Returns:
      • setMaxBonds

        public void setMaxBonds​(int v)
        Usually called automatically and hardly needed to be called.
        Parameters:
        v -
      • getMoleculeColor

        public int getMoleculeColor()
        cMoleculeColorDefault: atom coloring depends on atomic number. Carbon and hydrogen are drawn in neutral color
        cMoleculeColorNeutral: all atoms and bonds and CIP letters are drawn in neutral color
        Returns:
        cMoleculeColorNeutral or cMoleculeColorDefault. In future may also return ARGB values.
      • setMoleculeColor

        public void setMoleculeColor​(int color)
        Currently, this method only allows to switch the default atomic number dependent atom coloring off by passing cMoleculeColorNeutral. In future updates it may also accept ARGB values.
        Parameters:
        color - currently supported values: cMoleculeColorDefault, cMoleculeColorNeutral
      • getName

        public java.lang.String getName()
        Allows to set a molecule name or identifier, that is, for instance, written to or read from molfiles.
        Returns:
      • getStereoProblem

        public boolean getStereoProblem​(int atom)
        The stereo problem flag is set by the stereo recognition (available equal/above helper level cHelperParities) if an atom has over- or under-specified stereo bonds attached, i.e. a stereo center with less or more than one up/down-bond, an non-stereo-center atom carrying (a) stereo bond(s), or a stereo center with neighbors coordinates such that the stereo configuration cannot be deduced. This flag is used by the depiction and causes affected atoms to be drawn in margenta.
        Parameters:
        atom -
        Returns:
      • isAtomConfigurationUnknown

        public boolean isAtomConfigurationUnknown​(int atom)
        Parameters:
        atom -
        Returns:
        whether the atom's stereo configuration was explicitly declared unknown
      • isAtomParityPseudo

        public boolean isAtomParityPseudo​(int atom)
        Pseudo paries are parities that indicate a relative configuration. It always needs at least 2 pseudo parities (atom or bond) within a part of a molecule to be meaningful. This information is calculated by ensureHelperArrays(Molecule.cHelperCIP). Molecules extracted from IDCode don't know about pseudo parities.
        Parameters:
        atom -
        Returns:
        wether this atom's parity is a relative configuration
      • isAtomStereoCenter

        public boolean isAtomStereoCenter​(int atom)
        Atoms with pseudo parities are not considered stereo centers. While parities are canonized and always refer to the full set of molecules (in case ESR groups are defined), this method returns true if this atom is a stereo center in any(!) of the individual molecules described by the ESR settings.
        Parameters:
        atom -
        Returns:
        true if atom is stereo center in at least one molecule after ESR resolution
      • isBondParityPseudo

        public boolean isBondParityPseudo​(int bond)
      • isBondParityUnknownOrNone

        public boolean isBondParityUnknownOrNone​(int bond)
        This hint/flag is set by CoordinateInventor for double bonds without given EZ-parity, because the new coordinates may imply a not intended EZ-parity. If parities are calculated later by the Canonizer is can correctly assign cBondParityUnknown if the bond is a stereo bond. The setBondParity() method clears this flag. This method usually should not be called for other purposes.
        Returns:
        whether the bond parity was unknown when 2D- atom coordinates were created
      • isFragment

        public boolean isFragment()
        Molecule objects may represent complete molecules or sub-structure fragments, depending on, whether they are flagges as being a fragment or not. Both representations have much in common, but in certain aspects behave differently. Thus, complete molecules are considered to carry implicit hydrogens to fill unoccupied atom valences. Sub-structure fragments on the other hand may carry atom or bond query features. Depiction, sub-structure search, and other algorithms treat fragments and complete molecules differerently.
        Returns:
      • is3D

        public boolean is3D()
        Returns:
        true if at least one z-coordinate is different from 0.0
      • isNaturalAbundance

        public boolean isNaturalAbundance​(int atom)
        Parameters:
        atom -
        Returns:
        whether the atom has the natural isotop distribution
      • isPurelyOrganic

        public boolean isPurelyOrganic()
        Returns:
        true if atom is one of H,B,C,N,O,F,Si,P,S,Cl,As,Se,Br,Te,I
      • isSelectedAtom

        public boolean isSelectedAtom​(int atom)
      • isMarkedAtom

        public boolean isMarkedAtom​(int atom)
        Atom marking may be used for any external purpose
      • isBondBackgroundHilited

        public boolean isBondBackgroundHilited​(int bond)
        Used for depiction only.
        Parameters:
        bond -
      • isBondForegroundHilited

        public boolean isBondForegroundHilited​(int bond)
        Used for depiction only.
        Parameters:
        bond -
      • isSelectedBond

        public boolean isSelectedBond​(int bond)
      • isAutoMappedAtom

        public boolean isAutoMappedAtom​(int atom)
      • isStereoBond

        public boolean isStereoBond​(int bond)
        Checks whether bond is drawn as up/down single bond
        Parameters:
        bond -
        Returns:
        true if bond is a stereo bond
      • isStereoBond

        public boolean isStereoBond​(int bond,
                                    int atom)
        Checks whether bond is drawn as up/down single bond and is connected to atom with its pointed tip
        Parameters:
        bond -
        atom -
        Returns:
        true if bond is a stereo bond referring to atom
      • setAllAtoms

        public void setAllAtoms​(int no)
        Low level method for constructing/modifying a molecule from scratch. Use setAtomicNo(), possibly setAtomX(), setAtomY() and other setAtomXXX() methods for new atoms.
        Parameters:
        no -
      • setAllBonds

        public void setAllBonds​(int no)
        Low level method for constructing/modifying a molecule from scratch. Use setBondType() and setBondAtom() if you increase the number of bonds with this method.
        Parameters:
        no -
      • setAtomAbnormalValence

        public void setAtomAbnormalValence​(int atom,
                                           int valence)
        Set an atom's maximum valance to be different from the default one. If a carbon atom's valence is set to -1,0 or 4 its radical state is removed. If a carbon atom's valence is set to 2, a singulet carbene state is assumed.
        Parameters:
        atom -
        valence - 0-14: new maximum valence; -1: use default
      • setAtomCharge

        public void setAtomCharge​(int atom,
                                  int charge)
      • setAtomColor

        public void setAtomColor​(int atom,
                                 int color)
      • setAtomConfigurationUnknown

        public void setAtomConfigurationUnknown​(int atom,
                                                boolean u)
        This is a user applied information, rather than a calculated value. The stereo center configuration is declared to be unknown. If the atom is recognized a stereo center, then its parity will be cAtomParityUnknown.
        Parameters:
        atom -
        u -
      • setAtomSelection

        public void setAtomSelection​(int atom,
                                     boolean s)
      • setAtomMarker

        public void setAtomMarker​(int atom,
                                  boolean s)
        Atom marking may be used for any external purpose
      • setAtomicNo

        public void setAtomicNo​(int atom,
                                int no)
        Set an atom's atomic number and defines the isotop to be natural abundance.
        Parameters:
        atom -
        no -
      • setAtomList

        public void setAtomList​(int atom,
                                int[] list)
        Defines a list of allowed/excluded atomic numbers for sub-structure matching. If this atom's query feature cAtomQFAny (any atom) is set, then the list is considered to be a NOT-list. Depending on cAtomQFAny the list must contain at least 1 or 2 members.
        Parameters:
        atom -
        list - null or int[] of valid unique, but not sorted, atomic numbers
      • setAtomList

        public void setAtomList​(int atom,
                                int[] list,
                                boolean isExcludeList)
        Defines an atom list as query feature for substructure search
        Parameters:
        atom -
        list - is null or a sorted int[] of valid atomic numbers
        isExcludeList - true if atom is a wild card and list contains atoms to be excluded
      • setAtomMapNo

        public void setAtomMapNo​(int atom,
                                 int mapNo,
                                 boolean autoMapped)
        Defines an atom mapping number within the context of a reaction. Atoms that share the same mapping number on the reactant and product side are considered to be the same atom.
        Parameters:
        atom -
        mapNo -
        autoMapped -
      • setAtomMass

        public void setAtomMass​(int atom,
                                int mass)
        Set atom to specific isotop or to have a natural isotop distribution
        Parameters:
        atom -
        mass - rounded atom mass or 0 (default) for natural abundance
      • setAtomParity

        public void setAtomParity​(int atom,
                                  int parity,
                                  boolean isPseudo)
        The atom parity is a calculated property available above/equal helper level cHelperParities. It describes the stereo configuration of a chiral atom and is calculated either from 2D-atom-coordinates and up/down-bonds or from 3D-atom-coordinates, whatever is available. It depends on the atom indices of the neighbor atoms and their orientation in space.
        The parity is defined as follows: Look at the chiral atom such that its neighbor atom with the highest atom index (or the hydrogen atom if it is implicit) is oriented to the back. If the remaining three neighbors are in clockwise order (considering ascending atom indexes) than the parity is 1. If they are in anti-clockwise order, then the parity is 2.
        For linear chirality (allenes): Look along the straight line of double bonds such that the rear neighbor with the lower atom index points to the top. If the front neighbor with the lower atom index points to the right than the parity is 1.
        This method is called by the Canonizer and usually should not be called otherwise.
        Parameters:
        atom -
        parity - one of cAtomParity1,cAtomParity2,cAtomParityNone,cAtomParityUnknown
        isPseudo - true if the configuration is only meaningful relative to another one
      • setAtomStereoCenter

        protected void setAtomStereoCenter​(int atom,
                                           boolean isStereoCenter)
        An atom is considered a stereo center, if it is a stereo center in at least in one of the molecule configurations represented by the ESR definitions. Pseudo stereo centers are not(!) considered to be a stereo center. This method is called by the Canonizer and usually should not be called otherwise.
        Parameters:
        atom -
        isStereoCenter -
      • setAtomQueryFeature

        public void setAtomQueryFeature​(int atom,
                                        int feature,
                                        boolean value)
        Introduce or remove an atom query feature and make sure, the molecule is flagged to be a sub-structure fragment (see setFragment()). A query feature is usually a flag, which if set, poses an additional atom/bond matching constraint for the sub-structure search and, thus, reduces the number of matching atoms and therefore also the number of molecules found. Often multiple query feature flags are related and grouped, e.g. to define the number of hydrogens atoms. These are the flags related to hydrogen neighbors:

        public static final int cAtomQFHydrogen = 0x00000780;
        public static final int cAtomQFNot0Hydrogen = 0x00000080;
        public static final int cAtomQFNot1Hydrogen = 0x00000100;
        public static final int cAtomQFNot2Hydrogen = 0x00000200;
        public static final int cAtomQFNot3Hydrogen = 0x00000400;

        An inverse logic needs to be applied to translate a user request to the bits needed. For example, to only accept atoms that have 1 or 2 hydrogen neighbors, we need to filter out all others. Thus, we would call
        setAtomQueryFeature(atom, cAtomQFNot0Hydrogen | cAtomQFNot3Hydrogen, true);

        To match only atoms without hydrogen neighbors, call
        setAtomQueryFeature(atom, cAtomQFHydrogen & ~cAtomQFNot3Hydrogen, true);
        This mechanism allows a very efficient atom matching and therefore very fast sub-structure search.

        Parameters:
        atom -
        feature - one of cAtomQF...
        value - if true, the feature is set, otherwise it is removed
      • setAtomRadical

        public void setAtomRadical​(int atom,
                                   int radical)
        Sets an atom's radical state as singulet,dublet,triplet or none
        Parameters:
        atom -
        radical - one of cAtomRadicalStateNone,cAtomRadicalStateS,cAtomRadicalStateD,cAtomRadicalStateT
      • setAtomCIPParity

        public void setAtomCIPParity​(int atom,
                                     int parity)
        The atom Cahn-Ingold-Prelog parity is a calculated property available above/equal helper level cHelperCIP. It encodes the stereo configuration of an atom with its neighbors using up/down-bonds or 3D-atom-coordinates, whatever is available. It depends on the atom indices of the neighbor atoms and their orientation is space. This method is called by the Canonizer and usually should not be called otherwise.
        Parameters:
        atom -
        parity - one of cAtomCIPParityRorM,cAtomCIPParitySorP,cAtomCIPParityProblem
      • setAtomX

        public void setAtomX​(int atom,
                             double x)
      • setAtomY

        public void setAtomY​(int atom,
                             double y)
      • setAtomZ

        public void setAtomZ​(int atom,
                             double z)
      • setBondAtom

        public void setBondAtom​(int no,
                                int bond,
                                int atom)
      • setBondCIPParity

        public void setBondCIPParity​(int bond,
                                     int parity)
        The bond Cahn-Ingold-Prelog parity is a calculated property available above/equal helper level cHelperCIP. It encodes the stereo configuration of a bond with its neighbors using 2D-coordinates and up/down-bonds or 3D-atom-coordinates, whatever is available. It depends on the atom indices of the neighbor atoms and their orientation is space. This method is called by the Canonizer and usually should not be called otherwise. Considered are E/Z-double bonds and M/P-BINAP type single bonds.
        Parameters:
        bond -
        parity - one of cBondCIPParityEorP,cBondCIPParityZorM,cBondCIPParityProblem
      • setBondBackgroundHiliting

        public void setBondBackgroundHiliting​(int bond,
                                              boolean s)
        Used for depiction only.
        Parameters:
        bond -
        s -
      • setBondForegroundHiliting

        public void setBondForegroundHiliting​(int bond,
                                              boolean s)
        Used for depiction only.
        Parameters:
        bond -
        s -
      • setBondParity

        public void setBondParity​(int bond,
                                  int parity,
                                  boolean isPseudo)
        The bond parity is a calculated property available above/equal helper level cHelperParities. It encodes the stereo configuration of a double bond or BINAP type single bond from up/down-bonds and 2D-coordinates or 3D-atom-coordinates, whatever is available. It depends on the atom indices of the neighbor atoms and their orientation is space. This method is called by the Canonizer and usually should not be called otherwise.
        Parameters:
        bond -
        parity - one of cBondParityEor1,cBondParityZor2,cBondParityNone,cBondParityUnknown
        isPseudo - true if the configuration is only meaningful relative to another one
      • setBondParityUnknownOrNone

        public void setBondParityUnknownOrNone​(int bond)
        This hint/flag is set by CoordinateInventor for double bonds without given EZ-parity, because the new coordinates may imply a not intended EZ-parity. If parities are calculated later by the Canonizer is can correctly assign cBondParityUnknown if the bond is a stereo bond. The setBondParity() method clears this flag. This method usually should not be called for other purposes.
        Parameters:
        bond -
      • setBondQueryFeature

        public void setBondQueryFeature​(int bond,
                                        int feature,
                                        boolean value)
      • setBondOrder

        public void setBondOrder​(int bond,
                                 int order)
        Sets the bond type based on bond order without stereo orientation.
        Parameters:
        bond -
        order - 1,2, or 3
      • setBondType

        public void setBondType​(int bond,
                                int type)
        Defines a bond type combining bod order and stereo orientation.
        Parameters:
        bond -
        type - one of cBondTypeSingle,cBondTypeDouble,cBondTypeUp,cBondTypeCross,...
      • setChirality

        public void setChirality​(int c)
        Sets the overall chirality of the molecule taking into account: Recognition of stereo centers and stereo bonds, defined ESR features, meso detection. The chirality combines the knowledge about how many stereo isomers are represented, whether all of these are meso, whether we have one defined stereo isomer, a mixture of racemates, epimers, or other diastereomers. The information is used during depiction. This method is called by the Canonizer and usually should not be called otherwise.
        Parameters:
        c -
      • setHydrogenProtection

        public void setHydrogenProtection​(boolean protectHydrogen)
        Fragment's query features are checked for consistency and normalized during helper array creation. As part of this, simple hydrogen atoms are converted into hydrogen-count query features. If hydrogen protection is enabled, explicit hydrogens are not touched.
        Parameters:
        protectHydrogen -
      • setHelperValidity

        public void setHelperValidity​(int helperValidity)
        Use this method with extreme care. If you make a change to the molecule, the validity of the helper arrays is typically set to cHelperNone. If you make a small change to a molecule that doesn't change its topology, you may override the automatic automatically cleared helper validity with this method and avoid a new calculation of the neighbour arrays and ring detection.
        Parameters:
        helperValidity - cHelperNeighbours or cHelperRings
      • setToRacemate

        public void setToRacemate()
        This is for compatibility with old MDL stereo representation that contained a 'chiral' flag to indicate that the molecule is not a racemate. If a molecule is constructed from a source format (e.g. a molfile version 2) that contains a 'chiral' flag then setToRacemate() needs to be called if the chiral flag is not(!) set. This causes after stereo center recognition to turn all absolute stereo centers into racemic ones.
      • setAtomCustomLabel

        public void setAtomCustomLabel​(int atom,
                                       byte[] label)
        If a custom atom label is set, a molecule depiction displays the custom label instead of the original one. Custom labels are not interpreted otherwise. However, they may optionally be encoded into idcodes; see Canonizer.encodeAtomCustomLabels(). If a custom label start with ']' then the label without the ']' symbol is shown at the top left of the original atom label rather than replacing the original atom label. the
        Parameters:
        atom -
        label - null to remove custom label
      • setAtomCustomLabel

        public void setAtomCustomLabel​(int atom,
                                       java.lang.String label)
        If a custom atom label is set, a molecule depiction displays the custom label instead of the original one. Custom labels are not interpreted otherwise. However, they may optionally be encoded into idcodes; see Canonizer.encodeAtomCustomLabels(). If a custom label start with ']' then the label without the ']' symbol is shown at the top left of the original atom label rather than replacing the original atom label. If label is null or equals the normal atom label, then the custom label is removed. This method is less efficient than the byte[] version: setAtomCustomLabel(int, byte[])
        Parameters:
        atom -
        label - null to remove custom label
      • setAtomESR

        public void setAtomESR​(int atom,
                               int type,
                               int group)
        This is MDL's enhanced stereo representation (ESR). Stereo atoms and bonds with the same ESR type (AND or OR) and the same ESR group number are in the same group, i.e. within this group they have the defined (relative) stereo configuration.
        Parameters:
        atom -
        type - one of cESRTypeAbs,cESRTypeAnd,cESRTypeOr
        group - index starting with 0 (not considered if type is cESRTypeAbs)
      • setBondESR

        public void setBondESR​(int bond,
                               int type,
                               int group)
        MDL's enhanced stereo representation for BINAP type of stereo bonds. Stereo atoms and bonds with the same ESR type (AND or OR) and the same ESR group number are in the same group, i.e. within this group they have the defined (relative) stereo configuration.
        Parameters:
        bond -
        type - one of cESRTypeAbs,cESRTypeAnd,cESRTypeOr
        group - index starting with 0
      • setFragment

        public void setFragment​(boolean isFragment)
        Molecule objects may represent complete molecules or sub-structure fragments, depending on, whether they are flagges as being a fragment or not. Both representations have much in common, but in certain aspects behave differently. Thus, complete molecules are considered to carry implicit hydrogens to fill unoccupied atom valences. Sub-structure fragments on the other hand may carry atom or bond query features. Depiction, sub-structure search, and other algorithms treat fragments and complete molecules differently.
        Parameters:
        isFragment - if false, then all query features are removed
      • setName

        public void setName​(java.lang.String name)
      • getUserData

        public java.lang.Object getUserData()
      • setUserData

        public void setUserData​(java.lang.Object userData)
      • removeQueryFeatures

        public boolean removeQueryFeatures()
        Removes any query features from the molecule
        Returns:
        whether any query features were removed
      • setStereoProblem

        protected void setStereoProblem​(int atom)
        The stereo problem flag is set by the stereo recognition (available equal/above helper level cHelperParities) if an atom has over- or under-specified stereo bonds attached, i.e. a stereo center with less or more than one up/down-bond, an non-stereo-center atom carrying (a) stereo bond(s), or a stereo center with neighbors coordinates such that the stereo configuration cannot be deduced. This flag is used by the depiction and causes affected atoms to be drawn in margenta. This method usually is not used for other purposees.
        Parameters:
        atom -
      • stripIsotopInfo

        public boolean stripIsotopInfo()
        Removes all isotop information, i.e. sets all atoms to the natural isotop abundance.
        Returns:
        true if something was changed
      • translateCoords

        public void translateCoords​(double dx,
                                    double dy)
      • scaleCoords

        public void scaleCoords​(double f)
      • zoomAndRotateInit

        public void zoomAndRotateInit​(double x,
                                      double y)
      • zoomAndRotate

        public void zoomAndRotate​(double zoom,
                                  double angle,
                                  boolean selected)
      • validateBondType

        protected boolean validateBondType​(int bond,
                                           int type)
      • getOccupiedValence

        protected int getOccupiedValence​(int atom)
        The sum of bond orders of explicitly connected neighbour atoms.
        Parameters:
        atom -
        Returns:
        explicitly used valence
      • getMaxValenceUncharged

        public int getMaxValenceUncharged​(int atom)
        This is the defined maximum valence (or set abnormal valence) neglecting atom charge or radical influences, e.g. N or N(+) -> 3.
        Parameters:
        atom -
        Returns:
      • getDefaultMaxValenceUncharged

        public int getDefaultMaxValenceUncharged​(int atom)
        This is the default maximum valence of the atom neglecting atom charge or radical influences, e.g. N or N(+) -> 3. If the atomic no has multiple valid max valences, it is the highest one.
        Parameters:
        atom -
        Returns:
      • getMaxValence

        public int getMaxValence​(int atom)
        This is the defined maximum valence (or set abnormal valence) corrected by atom charge or radical influences, e.g. N(+) -> 4.
        Parameters:
        atom -
        Returns:
      • getElectronValenceCorrection

        public int getElectronValenceCorrection​(int atom,
                                                int occupiedValence)
        This is the maximum valence correction caused by atom charge or radical status, e.g. N+ -> 1; N- -> -1; Al+ -> -1; C+,C- -> -1. In some cases, where the atomicNo can have multiple valences, the influence of a charge depends on the atom's actual valence, e.g. valence corrections for R3P(+) and R5P(+) are 1 and -1, respectively. Criteria are:
        -in the given valence state is there a lone pair that can be protonated
        -can we introduce a negative substituent as in BH3 or PF5 vs. SF6
        Parameters:
        atom -
        occupiedValence -
        Returns:
      • isAtomicNoElectronegative

        public static boolean isAtomicNoElectronegative​(int atomicNo)
      • isElectronegative

        public boolean isElectronegative​(int atom)
        Parameters:
        atom -
        Returns:
        whether atom is an electronegative one
      • isAtomicNoElectropositive

        public static boolean isAtomicNoElectropositive​(int atomicNo)
      • isElectropositive

        public boolean isElectropositive​(int atom)
        Parameters:
        atom -
        Returns:
        whether atom is an electropositive one
      • isMetalAtom

        public boolean isMetalAtom​(int atom)
        Parameters:
        atom -
        Returns:
        whether atom is any metal atom
      • isOrganicAtom

        public boolean isOrganicAtom​(int atom)
        Parameters:
        atom -
        Returns:
        true if this atom is not a metal and not a nobel gas
      • removeAtomMapping

        public void removeAtomMapping​(boolean keepManualMapping)
      • removeMappingNo

        protected void removeMappingNo​(int mapNo)
      • compressMolTable

        protected int[] compressMolTable()