Package com.actelion.research.chem
Class Molecule
- java.lang.Object
-
- com.actelion.research.chem.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
-
-
Field Summary
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
addAtom(double x, double y)
High level function for constructing a molecule.int
addAtom(double x, double y, double z)
High level function for constructing a molecule.int
addAtom(int atomicNo)
High level function for constructing a molecule.int
addAtom(java.lang.String atomLabel)
High level function for constructing a molecule.int
addBond(int atom1, int atom2)
High level function for constructing a molecule.int
addBond(int atom1, int atom2, int type)
High level function for constructing a molecule.int[]
addMolecule(Molecule mol)
Copies all atoms and bonds of mol to the end of this Molecule's atom and bond tables.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.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.int
addOrChangeBond(int atm1, int atm2, int type)
High level function for constructing a molecule.boolean
addRing(double x, double y, int ringSize, boolean aromatic)
High level function for constructing a molecule.boolean
addRingToAtom(int atom, int ringSize, boolean aromatic)
High level function for constructing a molecule.boolean
addRingToBond(int bond, int ringSize, boolean aromatic)
High level function for constructing a molecule.int[]
addSubstituent(Molecule substituent, int connectionAtom)
Adds and connects the substituent molecule to the connectionAtom of this molecule.int[]
addSubstituent(Molecule substituent, int connectionAtom, boolean encodeRingClosuresInMapNo)
Adds and connects the substituent molecule to the connectionAtom of this molecule.double
calculateTorsion(int[] atom)
Calculates a signed torsion as an exterior spherical angle from a valid 4-atom strand.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.boolean
changeAtom(int atom, int atomicNo, int mass, int abnormalValence, int radical)
High level function for constructing a molecule.boolean
changeAtomCharge(double x, double y, boolean positive)
High level function for constructing a molecule.boolean
changeAtomCharge(int atom, boolean positive)
High level function for constructing a molecule.boolean
changeBond(int bnd, int type)
High level function for constructing a molecule.void
clear()
Empties the molecule to serve as container for constructing a new molecule, e.g.protected int[]
compressMolTable()
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.int
copyBond(Molecule destMol, int sourceBond, int esrGroupOffsetAND, int esrGroupOffsetOR, int[] atomMap, boolean useBondTypeDelocalized)
int
copyBond(Molecule destMol, int sourceBond, int esrGroupOffsetAND, int esrGroupOffsetOR, int destAtom1, int destAtom2, boolean useBondTypeDelocalized)
void
copyMolecule(Molecule destMol)
Copies this molecule including parity settings, if valid.void
copyMoleculeProperties(Molecule destMol)
Copies name,isFragment,chirality and validity of parity & CIP flags.void
deleteAtom(int atom)
High level function for constructing a molecule.boolean
deleteAtomOrBond(double x, double y)
High level function for constructing a molecule.int[]
deleteAtoms(boolean[] deleteAtom)
High level function for constructing a molecule.int[]
deleteAtoms(int[] atomList)
High level function for constructing a molecule.void
deleteBond(int bond)
High level function for constructing a molecule.void
deleteBondAndSurrounding(int bond)
High level function for constructing a molecule.int[]
deleteMarkedAtomsAndBonds()
High level function for constructing a molecule.void
deleteMolecule()
Deprecated.boolean
deleteSelectedAtoms()
High level function for constructing a molecule.int
findAtom(double pickx, double picky)
int
findBond(double pickx, double picky)
int
getAllAtoms()
int
getAllBonds()
static byte[]
getAllowedValences(int atomicNo)
For any known atomicNo this returns all allowed atom valences.static double
getAngle(double x1, double y1, double x2, double y2)
static double
getAngleDif(double angle1, double angle2)
int
getAtomAbnormalValence(int atom)
Get an atom's defined maximum valance if different from the default one.int
getAtomCharge(int atom)
int
getAtomCIPParity(int atom)
The atom Cahn-Ingold-Prelog parity is a calculated property available above/equal helper level cHelperCIP.int
getAtomColor(int atom)
Coordinates[]
getAtomCoordinates()
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.byte[]
getAtomCustomLabelBytes(int atom)
This method is more efficient than getAtomCustomLabel(), because internally atom custom labels are stored as a byte[].int
getAtomESRGroup(int atom)
This is MDL's enhanced stereo representation (ESR).int
getAtomESRType(int atom)
This is MDL's enhanced stereo representation (ESR).int
getAtomicNo(int atom)
In addition to the natural atomic numbers, we support additional pseudo atomic numbers.static int
getAtomicNoFromLabel(java.lang.String atomLabel)
java.lang.String
getAtomLabel(int atom)
int[]
getAtomList(int atom)
The list of atoms that are allowed at this position during sub-structure search.java.lang.String
getAtomListString(int atom)
int
getAtomMapNo(int atom)
Returns an atom mapping number within the context of a reaction.int
getAtomMass(int atom)
int
getAtomParity(int atom)
The atom parity is a calculated property available above/equal helper level cHelperParities.int
getAtomQueryFeatures(int atom)
Returns all set query features for this atom.int
getAtomRadical(int atom)
Gets an atom's radical state as singulet,dublet,triplet or nonedouble
getAtomX(int atom)
double
getAtomY(int atom)
double
getAtomZ(int atom)
double
getAverageBondLength()
Calculates and returns the mean bond length.double
getAverageBondLength(int atoms, int bonds)
Calculates and returns the mean bond length of all bonds 0...bonds.double
getAverageBondLength(int atoms, int bonds, double defaultBondLength)
Calculates and returns the mean bond length of all bonds 0...bonds.double
getAverageBondLength(int atoms, int bonds, double defaultBondLength, Coordinates[] coords)
Calculates and returns the mean bond length of all bonds 0...bonds.double
getBondAngle(int atom1, int atom2)
int
getBondAtom(int no, int bond)
int
getBondBridgeMaxSize(int bond)
int
getBondBridgeMinSize(int bond)
int
getBondCIPParity(int bond)
The bond Cahn-Ingold-Prelog parity is a calculated property available above/equal helper level cHelperCIP.int
getBondESRGroup(int bond)
This is MDL's enhanced stereo representation (ESR).int
getBondESRType(int bond)
This is MDL's enhanced stereo representation (ESR).double
getBondLength(int bond)
int
getBondOrder(int bond)
Returns the formal bond order.int
getBondParity(int bnd)
Returns the pre-calculated bond parity, e.g.int
getBondQueryFeatures(int bnd)
int
getBondType(int bond)
Returns bond type combining bond order and stereo orientation.int
getBondTypeSimple(int bond)
This is the bond type without stereo information.java.awt.geom.Rectangle2D.Double
getBounds(java.awt.geom.Rectangle2D.Double r)
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.Coordinates
getCoordinates(int atom)
static double
getDefaultAverageBondLength()
int
getDefaultMaxValenceUncharged(int atom)
This is the default maximum valence of the atom neglecting atom charge or radical influences, e.g.int[]
getDeleteAtomsBondMap(boolean[] deleteAtom)
int[]
getDeleteAtomsBondMap(int[] atomList)
int
getElectronValenceCorrection(int atom, int occupiedValence)
This is the maximum valence correction caused by atom charge or radical status, e.g.int
getMaxAtoms()
The currently defined maximum of atoms, which increases automatically when using high level construction methods and new atoms exceed the current maximum.int
getMaxBonds()
The currently defined maximum of bonds, which increases automatically when using high level construction methods and new bonds exceed the current maximum.int
getMaxValence(int atom)
This is the defined maximum valence (or set abnormal valence) corrected by atom charge or radical influences, e.g.int
getMaxValenceUncharged(int atom)
This is the defined maximum valence (or set abnormal valence) neglecting atom charge or radical influences, e.g.int
getMoleculeColor()
cMoleculeColorDefault: atom coloring depends on atomic number.java.lang.String
getName()
Allows to set a molecule name or identifier, that is, for instance, written to or read from molfiles.protected int
getOccupiedValence(int atom)
The sum of bond orders of explicitly connected neighbour atoms.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.java.lang.Object
getUserData()
void
invalidateHelperArrays(int helperBits)
Clears helperBits from mValidHelperArrays.boolean
is3D()
boolean
isAtomConfigurationUnknown(int atom)
static boolean
isAtomicNoElectronegative(int atomicNo)
static boolean
isAtomicNoElectropositive(int atomicNo)
boolean
isAtomMarkedForDeletion(int atom)
Checks whether this atom was marked to be deleted and not deleted yet.boolean
isAtomParityPseudo(int atom)
Pseudo paries are parities that indicate a relative configuration.boolean
isAtomStereoCenter(int atom)
Atoms with pseudo parities are not considered stereo centers.boolean
isAutoMappedAtom(int atom)
boolean
isBondBackgroundHilited(int bond)
Used for depiction only.boolean
isBondBridge(int bond)
boolean
isBondForegroundHilited(int bond)
Used for depiction only.boolean
isBondMarkedForDeletion(int bond)
Checks whether this bond was marked to be deleted and not deleted yet.boolean
isBondParityPseudo(int bond)
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.boolean
isElectronegative(int atom)
boolean
isElectropositive(int atom)
boolean
isFragment()
Molecule objects may represent complete molecules or sub-structure fragments, depending on, whether they are flagges as being a fragment or not.boolean
isMarkedAtom(int atom)
Atom marking may be used for any external purposeboolean
isMetalAtom(int atom)
boolean
isNaturalAbundance(int atom)
boolean
isOrganicAtom(int atom)
boolean
isPurelyOrganic()
boolean
isSelectedAtom(int atom)
boolean
isSelectedBond(int bond)
boolean
isStereoBond(int bond)
Checks whether bond is drawn as up/down single bondboolean
isStereoBond(int bond, int atom)
Checks whether bond is drawn as up/down single bond and is connected to atom with its pointed tipvoid
markAtomForDeletion(int atom)
Marks this atom to be deleted in a later call to deleteMarkedAtomsAndBonds().void
markBondForDeletion(int bond)
Marks this bond to be deleted in a later call to deleteMarkedAtomsAndBonds().void
removeAtomColors()
void
removeAtomCustomLabels()
This removes all custom labels from the atoms.void
removeAtomMapping(boolean keepManualMapping)
void
removeAtomMarkers()
void
removeAtomSelection()
void
removeBondHiliting()
protected void
removeMappingNo(int mapNo)
boolean
removeQueryFeatures()
Removes any query features from the moleculeint
renumberESRGroups(int type)
For the given ESR type (AND or OR) renumbers all group indexes starting from 0.void
scaleCoords(double f)
void
setAllAtoms(int no)
Low level method for constructing/modifying a molecule from scratch.void
setAllBonds(int no)
Low level method for constructing/modifying a molecule from scratch.void
setAtomAbnormalValence(int atom, int valence)
Set an atom's maximum valance to be different from the default one.void
setAtomCharge(int atom, int charge)
void
setAtomCIPParity(int atom, int parity)
The atom Cahn-Ingold-Prelog parity is a calculated property available above/equal helper level cHelperCIP.void
setAtomColor(int atom, int color)
void
setAtomConfigurationUnknown(int atom, boolean u)
This is a user applied information, rather than a calculated value.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.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.void
setAtomESR(int atom, int type, int group)
This is MDL's enhanced stereo representation (ESR).void
setAtomicNo(int atom, int no)
Set an atom's atomic number and defines the isotop to be natural abundance.void
setAtomList(int atom, int[] list)
Defines a list of allowed/excluded atomic numbers for sub-structure matching.void
setAtomList(int atom, int[] list, boolean isExcludeList)
Defines an atom list as query feature for substructure searchvoid
setAtomMapNo(int atom, int mapNo, boolean autoMapped)
Defines an atom mapping number within the context of a reaction.void
setAtomMarker(int atom, boolean s)
Atom marking may be used for any external purposevoid
setAtomMass(int atom, int mass)
Set atom to specific isotop or to have a natural isotop distributionvoid
setAtomParity(int atom, int parity, boolean isPseudo)
The atom parity is a calculated property available above/equal helper level cHelperParities.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()).void
setAtomRadical(int atom, int radical)
Sets an atom's radical state as singulet,dublet,triplet or nonevoid
setAtomSelection(int atom, boolean s)
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.void
setAtomX(int atom, double x)
void
setAtomY(int atom, double y)
void
setAtomZ(int atom, double z)
void
setBondAtom(int no, int bond, int atom)
void
setBondBackgroundHiliting(int bond, boolean s)
Used for depiction only.void
setBondCIPParity(int bond, int parity)
The bond Cahn-Ingold-Prelog parity is a calculated property available above/equal helper level cHelperCIP.void
setBondESR(int bond, int type, int group)
MDL's enhanced stereo representation for BINAP type of stereo bonds.void
setBondForegroundHiliting(int bond, boolean s)
Used for depiction only.void
setBondOrder(int bond, int order)
Sets the bond type based on bond order without stereo orientation.void
setBondParity(int bond, int parity, boolean isPseudo)
The bond parity is a calculated property available above/equal helper level cHelperParities.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.void
setBondQueryFeature(int bond, int feature, boolean value)
void
setBondType(int bond, int type)
Defines a bond type combining bod order and stereo orientation.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.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.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.void
setHelperValidity(int helperValidity)
Use this method with extreme care.void
setHydrogenProtection(boolean protectHydrogen)
Fragment's query features are checked for consistency and normalized during helper array creation.void
setMaxAtoms(int v)
Usually called automatically and hardly needed to be called.void
setMaxBonds(int v)
Usually called automatically and hardly needed to be called.void
setMoleculeColor(int color)
Currently, this method only allows to switch the default atomic number dependent atom coloring off by passing cMoleculeColorNeutral.void
setName(java.lang.String name)
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.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.void
setUserData(java.lang.Object userData)
boolean
stripIsotopInfo()
Removes all isotop information, i.e.int
suggestBondType(int atom1, int atom2)
Suggests either cBondTypeSingle or cBondTypeMetalLigand whatever seems more appropriate for a new bond between the two atoms.void
swapAtoms(int atom1, int atom2)
Swaps two atoms' indexes/locations in the atom table.void
swapBonds(int bond1, int bond2)
Swaps two bonds' indexes/locations in the atom table.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.void
translateCoords(double dx, double dy)
protected boolean
validateBondType(int bond, int type)
void
zoomAndRotate(double zoom, double angle, boolean selected)
void
zoomAndRotateInit(double x, double y)
-
-
-
Field Detail
-
cMaxAtomicNo
public static final int cMaxAtomicNo
- See Also:
- Constant Field Values
-
cAtomFlagsParity
protected static final int cAtomFlagsParity
- See Also:
- Constant Field Values
-
cAtomParityNone
public static final int cAtomParityNone
- See Also:
- Constant Field Values
-
cAtomParity1
public static final int cAtomParity1
- See Also:
- Constant Field Values
-
cAtomParity2
public static final int cAtomParity2
- See Also:
- Constant Field Values
-
cAtomParityUnknown
public static final int cAtomParityUnknown
- See Also:
- Constant Field Values
-
cAtomParityIsPseudo
public static final int cAtomParityIsPseudo
- See Also:
- Constant Field Values
-
cAtomFlagSmallRing
protected static final int cAtomFlagSmallRing
- See Also:
- Constant Field Values
-
cAtomRadicalState
public static final int cAtomRadicalState
- See Also:
- Constant Field Values
-
cAtomRadicalStateShift
public static final int cAtomRadicalStateShift
- See Also:
- Constant Field Values
-
cAtomRadicalStateNone
public static final int cAtomRadicalStateNone
- See Also:
- Constant Field Values
-
cAtomRadicalStateS
public static final int cAtomRadicalStateS
- See Also:
- Constant Field Values
-
cAtomRadicalStateD
public static final int cAtomRadicalStateD
- See Also:
- Constant Field Values
-
cAtomRadicalStateT
public static final int cAtomRadicalStateT
- See Also:
- Constant Field Values
-
cAtomColorNone
public static final int cAtomColorNone
- See Also:
- Constant Field Values
-
cAtomColorBlue
public static final int cAtomColorBlue
- See Also:
- Constant Field Values
-
cAtomColorRed
public static final int cAtomColorRed
- See Also:
- Constant Field Values
-
cAtomColorGreen
public static final int cAtomColorGreen
- See Also:
- Constant Field Values
-
cAtomColorMagenta
public static final int cAtomColorMagenta
- See Also:
- Constant Field Values
-
cAtomColorOrange
public static final int cAtomColorOrange
- See Also:
- Constant Field Values
-
cAtomColorDarkGreen
public static final int cAtomColorDarkGreen
- See Also:
- Constant Field Values
-
cAtomColorDarkRed
public static final int cAtomColorDarkRed
- See Also:
- Constant Field Values
-
cAtomFlagsHelper
protected static final int cAtomFlagsHelper
- See Also:
- Constant Field Values
-
cAtomFlagsHelper2
protected static final int cAtomFlagsHelper2
- See Also:
- Constant Field Values
-
cAtomFlagsHelper3
protected static final int cAtomFlagsHelper3
- See Also:
- Constant Field Values
-
cAtomFlagsRingBonds
protected static final int cAtomFlagsRingBonds
- See Also:
- Constant Field Values
-
cAtomFlags2RingBonds
protected static final int cAtomFlags2RingBonds
- See Also:
- Constant Field Values
-
cAtomFlags3RingBonds
protected static final int cAtomFlags3RingBonds
- See Also:
- Constant Field Values
-
cAtomFlags4RingBonds
protected static final int cAtomFlags4RingBonds
- See Also:
- Constant Field Values
-
cAtomFlagAromatic
protected static final int cAtomFlagAromatic
- See Also:
- Constant Field Values
-
cAtomFlagAllylic
protected static final int cAtomFlagAllylic
- See Also:
- Constant Field Values
-
cAtomFlagStabilized
protected static final int cAtomFlagStabilized
- See Also:
- Constant Field Values
-
cAtomCIPParityNone
public static final int cAtomCIPParityNone
- See Also:
- Constant Field Values
-
cAtomCIPParityRorM
public static final int cAtomCIPParityRorM
- See Also:
- Constant Field Values
-
cAtomCIPParitySorP
public static final int cAtomCIPParitySorP
- See Also:
- Constant Field Values
-
cAtomCIPParityProblem
public static final int cAtomCIPParityProblem
- See Also:
- Constant Field Values
-
cAtomFlagStereoProblem
protected static final int cAtomFlagStereoProblem
- See Also:
- Constant Field Values
-
cAtomFlagMarked
protected static final int cAtomFlagMarked
- See Also:
- Constant Field Values
-
cESRTypeAbs
public static final int cESRTypeAbs
- See Also:
- Constant Field Values
-
cESRTypeAnd
public static final int cESRTypeAnd
- See Also:
- Constant Field Values
-
cESRTypeOr
public static final int cESRTypeOr
- See Also:
- Constant Field Values
-
cESRMaxGroups
public static final int cESRMaxGroups
- See Also:
- Constant Field Values
-
cESRGroupBits
public static final int cESRGroupBits
- See Also:
- Constant Field Values
-
cAtomFlagsESR
protected static final int cAtomFlagsESR
- See Also:
- Constant Field Values
-
cAtomFlagConfigurationUnknown
protected static final int cAtomFlagConfigurationUnknown
- See Also:
- Constant Field Values
-
cAtomFlagsValence
protected static final int cAtomFlagsValence
- See Also:
- Constant Field Values
-
cAtomQFNoOfBits
public static final int cAtomQFNoOfBits
- See Also:
- Constant Field Values
-
cAtomQFAromStateBits
public static final int cAtomQFAromStateBits
- See Also:
- Constant Field Values
-
cAtomQFAromStateShift
public static final int cAtomQFAromStateShift
- See Also:
- Constant Field Values
-
cAtomQFRingStateBits
public static final int cAtomQFRingStateBits
- See Also:
- Constant Field Values
-
cAtomQFRingStateShift
public static final int cAtomQFRingStateShift
- See Also:
- Constant Field Values
-
cAtomQFHydrogenBits
public static final int cAtomQFHydrogenBits
- See Also:
- Constant Field Values
-
cAtomQFHydrogenShift
public static final int cAtomQFHydrogenShift
- See Also:
- Constant Field Values
-
cAtomQFPiElectronBits
public static final int cAtomQFPiElectronBits
- See Also:
- Constant Field Values
-
cAtomQFPiElectronShift
public static final int cAtomQFPiElectronShift
- See Also:
- Constant Field Values
-
cAtomQFNeighbourBits
public static final int cAtomQFNeighbourBits
- See Also:
- Constant Field Values
-
cAtomQFNeighbourShift
public static final int cAtomQFNeighbourShift
- See Also:
- Constant Field Values
-
cAtomQFRingSizeBits
public static final int cAtomQFRingSizeBits
- See Also:
- Constant Field Values
-
cAtomQFRingSizeShift
public static final int cAtomQFRingSizeShift
- See Also:
- Constant Field Values
-
cAtomQFChargeBits
public static final int cAtomQFChargeBits
- See Also:
- Constant Field Values
-
cAtomQFChargeShift
public static final int cAtomQFChargeShift
- See Also:
- Constant Field Values
-
cAtomQFRxnParityBits
public static final int cAtomQFRxnParityBits
- See Also:
- Constant Field Values
-
cAtomQFRxnParityShift
public static final int cAtomQFRxnParityShift
- See Also:
- Constant Field Values
-
cAtomQFSimpleFeatures
public static final int cAtomQFSimpleFeatures
- See Also:
- Constant Field Values
-
cAtomQFNarrowing
public static final int cAtomQFNarrowing
- See Also:
- Constant Field Values
-
cAtomQFAny
public static final int cAtomQFAny
- See Also:
- Constant Field Values
-
cAtomQFAromState
public static final int cAtomQFAromState
- See Also:
- Constant Field Values
-
cAtomQFAromatic
public static final int cAtomQFAromatic
- See Also:
- Constant Field Values
-
cAtomQFNotAromatic
public static final int cAtomQFNotAromatic
- See Also:
- Constant Field Values
-
cAtomQFRingState
public static final int cAtomQFRingState
- See Also:
- Constant Field Values
-
cAtomQFNotChain
public static final int cAtomQFNotChain
- See Also:
- Constant Field Values
-
cAtomQFNot2RingBonds
public static final int cAtomQFNot2RingBonds
- See Also:
- Constant Field Values
-
cAtomQFNot3RingBonds
public static final int cAtomQFNot3RingBonds
- See Also:
- Constant Field Values
-
cAtomQFNot4RingBonds
public static final int cAtomQFNot4RingBonds
- See Also:
- Constant Field Values
-
cAtomQFHydrogen
public static final int cAtomQFHydrogen
- See Also:
- Constant Field Values
-
cAtomQFNot0Hydrogen
public static final int cAtomQFNot0Hydrogen
- See Also:
- Constant Field Values
-
cAtomQFNot1Hydrogen
public static final int cAtomQFNot1Hydrogen
- See Also:
- Constant Field Values
-
cAtomQFNot2Hydrogen
public static final int cAtomQFNot2Hydrogen
- See Also:
- Constant Field Values
-
cAtomQFNot3Hydrogen
public static final int cAtomQFNot3Hydrogen
- See Also:
- Constant Field Values
-
cAtomQFNoMoreNeighbours
public static final int cAtomQFNoMoreNeighbours
- See Also:
- Constant Field Values
-
cAtomQFMoreNeighbours
public static final int cAtomQFMoreNeighbours
- See Also:
- Constant Field Values
-
cAtomQFMatchStereo
public static final int cAtomQFMatchStereo
- See Also:
- Constant Field Values
-
cAtomQFPiElectrons
public static final int cAtomQFPiElectrons
- See Also:
- Constant Field Values
-
cAtomQFNot0PiElectrons
public static final int cAtomQFNot0PiElectrons
- See Also:
- Constant Field Values
-
cAtomQFNot1PiElectron
public static final int cAtomQFNot1PiElectron
- See Also:
- Constant Field Values
-
cAtomQFNot2PiElectrons
public static final int cAtomQFNot2PiElectrons
- See Also:
- Constant Field Values
-
cAtomQFNeighbours
public static final int cAtomQFNeighbours
- See Also:
- Constant Field Values
-
cAtomQFNot0Neighbours
public static final int cAtomQFNot0Neighbours
- See Also:
- Constant Field Values
-
cAtomQFNot1Neighbour
public static final int cAtomQFNot1Neighbour
- See Also:
- Constant Field Values
-
cAtomQFNot2Neighbours
public static final int cAtomQFNot2Neighbours
- See Also:
- Constant Field Values
-
cAtomQFNot3Neighbours
public static final int cAtomQFNot3Neighbours
- See Also:
- Constant Field Values
-
cAtomQFNot4Neighbours
public static final int cAtomQFNot4Neighbours
- See Also:
- Constant Field Values
-
cAtomQFRingSize
public static final int cAtomQFRingSize
- See Also:
- Constant Field Values
-
cAtomQFCharge
public static final int cAtomQFCharge
- See Also:
- Constant Field Values
-
cAtomQFNotChargeNeg
public static final int cAtomQFNotChargeNeg
- See Also:
- Constant Field Values
-
cAtomQFNotCharge0
public static final int cAtomQFNotCharge0
- See Also:
- Constant Field Values
-
cAtomQFNotChargePos
public static final int cAtomQFNotChargePos
- See Also:
- Constant Field Values
-
cAtomQFFlatNitrogen
public static final int cAtomQFFlatNitrogen
- See Also:
- Constant Field Values
-
cAtomQFExcludeGroup
public static final int cAtomQFExcludeGroup
- See Also:
- Constant Field Values
-
cAtomQFRxnParityHint
public static final int cAtomQFRxnParityHint
- See Also:
- Constant Field Values
-
cAtomQFRxnParityRetain
public static final int cAtomQFRxnParityRetain
- See Also:
- Constant Field Values
-
cAtomQFRxnParityInvert
public static final int cAtomQFRxnParityInvert
- See Also:
- Constant Field Values
-
cAtomQFRxnParityRacemize
public static final int cAtomQFRxnParityRacemize
- See Also:
- Constant Field Values
-
cBondTypeSingle
public static final int cBondTypeSingle
- See Also:
- Constant Field Values
-
cBondTypeDouble
public static final int cBondTypeDouble
- See Also:
- Constant Field Values
-
cBondTypeTriple
public static final int cBondTypeTriple
- See Also:
- Constant Field Values
-
cBondTypeDown
public static final int cBondTypeDown
- See Also:
- Constant Field Values
-
cBondTypeUp
public static final int cBondTypeUp
- See Also:
- Constant Field Values
-
cBondTypeCross
public static final int cBondTypeCross
- See Also:
- Constant Field Values
-
cBondTypeMetalLigand
public static final int cBondTypeMetalLigand
- See Also:
- Constant Field Values
-
cBondTypeDelocalized
public static final int cBondTypeDelocalized
- See Also:
- Constant Field Values
-
cBondTypeDeleted
public static final int cBondTypeDeleted
- See Also:
- Constant Field Values
-
cBondTypeIncreaseOrder
public static final int cBondTypeIncreaseOrder
- See Also:
- Constant Field Values
-
cBondTypeMaskSimple
protected static final int cBondTypeMaskSimple
- See Also:
- Constant Field Values
-
cBondTypeMaskStereo
protected static final int cBondTypeMaskStereo
- See Also:
- Constant Field Values
-
cBondFlagsHelper2
protected static final int cBondFlagsHelper2
- See Also:
- Constant Field Values
-
cBondFlagsHelper3
protected static final int cBondFlagsHelper3
- See Also:
- Constant Field Values
-
cBondFlagsParity
protected static final int cBondFlagsParity
- See Also:
- Constant Field Values
-
cBondParityNone
public static final int cBondParityNone
- See Also:
- Constant Field Values
-
cBondParityEor1
public static final int cBondParityEor1
- See Also:
- Constant Field Values
-
cBondParityZor2
public static final int cBondParityZor2
- See Also:
- Constant Field Values
-
cBondParityUnknown
public static final int cBondParityUnknown
- See Also:
- Constant Field Values
-
cBondFlagsCIPParityShift
protected static final int cBondFlagsCIPParityShift
- See Also:
- Constant Field Values
-
cBondCIPParityNone
public static final int cBondCIPParityNone
- See Also:
- Constant Field Values
-
cBondCIPParityEorP
public static final int cBondCIPParityEorP
- See Also:
- Constant Field Values
-
cBondCIPParityZorM
public static final int cBondCIPParityZorM
- See Also:
- Constant Field Values
-
cBondCIPParityProblem
public static final int cBondCIPParityProblem
- See Also:
- Constant Field Values
-
cBondFlagRing
protected static final int cBondFlagRing
- See Also:
- Constant Field Values
-
cBondFlagSmallRing
protected static final int cBondFlagSmallRing
- See Also:
- Constant Field Values
-
cBondFlagAromatic
protected static final int cBondFlagAromatic
- See Also:
- Constant Field Values
-
cBondFlagDelocalized
protected static final int cBondFlagDelocalized
- See Also:
- Constant Field Values
-
cBondFlagsESR
protected static final int cBondFlagsESR
- See Also:
- Constant Field Values
-
cBondQFNoOfBits
public static final int cBondQFNoOfBits
- See Also:
- Constant Field Values
-
cBondQFBondTypesBits
public static final int cBondQFBondTypesBits
- See Also:
- Constant Field Values
-
cBondQFBondTypesShift
public static final int cBondQFBondTypesShift
- See Also:
- Constant Field Values
-
cBondQFRingStateBits
public static final int cBondQFRingStateBits
- See Also:
- Constant Field Values
-
cBondQFRingStateShift
public static final int cBondQFRingStateShift
- See Also:
- Constant Field Values
-
cBondQFBridgeBits
public static final int cBondQFBridgeBits
- See Also:
- Constant Field Values
-
cBondQFBridgeShift
public static final int cBondQFBridgeShift
- See Also:
- Constant Field Values
-
cBondQFBridgeMinBits
public static final int cBondQFBridgeMinBits
- See Also:
- Constant Field Values
-
cBondQFBridgeMinShift
public static final int cBondQFBridgeMinShift
- See Also:
- Constant Field Values
-
cBondQFBridgeSpanBits
public static final int cBondQFBridgeSpanBits
- See Also:
- Constant Field Values
-
cBondQFBridgeSpanShift
public static final int cBondQFBridgeSpanShift
- See Also:
- Constant Field Values
-
cBondQFRingSizeBits
public static final int cBondQFRingSizeBits
- See Also:
- Constant Field Values
-
cBondQFRingSizeShift
public static final int cBondQFRingSizeShift
- See Also:
- Constant Field Values
-
cBondQFAromStateBits
public static final int cBondQFAromStateBits
- See Also:
- Constant Field Values
-
cBondQFAromStateShift
public static final int cBondQFAromStateShift
- See Also:
- Constant Field Values
-
cBondQFAllFeatures
public static final int cBondQFAllFeatures
- See Also:
- Constant Field Values
-
cBondQFSimpleFeatures
public static final int cBondQFSimpleFeatures
- See Also:
- Constant Field Values
-
cBondQFNarrowing
public static final int cBondQFNarrowing
- See Also:
- Constant Field Values
-
cBondQFBondTypes
public static final int cBondQFBondTypes
- See Also:
- Constant Field Values
-
cBondQFSingle
public static final int cBondQFSingle
- See Also:
- Constant Field Values
-
cBondQFDouble
public static final int cBondQFDouble
- See Also:
- Constant Field Values
-
cBondQFTriple
public static final int cBondQFTriple
- See Also:
- Constant Field Values
-
cBondQFDelocalized
public static final int cBondQFDelocalized
- See Also:
- Constant Field Values
-
cBondQFMetalLigand
public static final int cBondQFMetalLigand
- See Also:
- Constant Field Values
-
cBondQFRingState
public static final int cBondQFRingState
- See Also:
- Constant Field Values
-
cBondQFNotRing
public static final int cBondQFNotRing
- See Also:
- Constant Field Values
-
cBondQFRing
public static final int cBondQFRing
- See Also:
- Constant Field Values
-
cBondQFBridge
public static final int cBondQFBridge
- See Also:
- Constant Field Values
-
cBondQFBridgeMin
public static final int cBondQFBridgeMin
- See Also:
- Constant Field Values
-
cBondQFBridgeSpan
public static final int cBondQFBridgeSpan
- See Also:
- Constant Field Values
-
cBondQFRingSize
public static final int cBondQFRingSize
- See Also:
- Constant Field Values
-
cBondQFMatchStereo
public static final int cBondQFMatchStereo
- See Also:
- Constant Field Values
-
cBondQFAromState
public static final int cBondQFAromState
- See Also:
- Constant Field Values
-
cBondQFAromatic
public static final int cBondQFAromatic
- See Also:
- Constant Field Values
-
cBondQFNotAromatic
public static final int cBondQFNotAromatic
- See Also:
- Constant Field Values
-
cHelperNone
public static final int cHelperNone
- See Also:
- Constant Field Values
-
cHelperBitNeighbours
public static final int cHelperBitNeighbours
- See Also:
- Constant Field Values
-
cHelperBitRingsSimple
public static final int cHelperBitRingsSimple
- See Also:
- Constant Field Values
-
cHelperBitRings
public static final int cHelperBitRings
- See Also:
- Constant Field Values
-
cHelperBitParities
public static final int cHelperBitParities
- See Also:
- Constant Field Values
-
cHelperBitCIP
public static final int cHelperBitCIP
- See Also:
- Constant Field Values
-
cHelperBitSymmetrySimple
public static final int cHelperBitSymmetrySimple
- See Also:
- Constant Field Values
-
cHelperBitSymmetryDiastereotopic
public static final int cHelperBitSymmetryDiastereotopic
- See Also:
- Constant Field Values
-
cHelperBitSymmetryEnantiotopic
public static final int cHelperBitSymmetryEnantiotopic
- See Also:
- Constant Field Values
-
cHelperBitIncludeNitrogenParities
public static final int cHelperBitIncludeNitrogenParities
- See Also:
- Constant Field Values
-
cHelperBitsStereo
public static final int cHelperBitsStereo
- See Also:
- Constant Field Values
-
cHelperNeighbours
public static final int cHelperNeighbours
- See Also:
- Constant Field Values
-
cHelperRingsSimple
public static final int cHelperRingsSimple
- See Also:
- Constant Field Values
-
cHelperRings
public static final int cHelperRings
- See Also:
- Constant Field Values
-
cHelperParities
public static final int cHelperParities
- See Also:
- Constant Field Values
-
cHelperCIP
public static final int cHelperCIP
- See Also:
- Constant Field Values
-
cHelperSymmetrySimple
public static final int cHelperSymmetrySimple
- See Also:
- Constant Field Values
-
cHelperSymmetryDiastereotopic
public static final int cHelperSymmetryDiastereotopic
- See Also:
- Constant Field Values
-
cHelperSymmetryEnantiotopic
public static final int cHelperSymmetryEnantiotopic
- See Also:
- Constant Field Values
-
cChiralityIsomerCountMask
public static final int cChiralityIsomerCountMask
- See Also:
- Constant Field Values
-
cChiralityUnknown
public static final int cChiralityUnknown
- See Also:
- Constant Field Values
-
cChiralityNotChiral
public static final int cChiralityNotChiral
- See Also:
- Constant Field Values
-
cChiralityMeso
public static final int cChiralityMeso
- See Also:
- Constant Field Values
-
cChiralityRacemic
public static final int cChiralityRacemic
- See Also:
- Constant Field Values
-
cChiralityKnownEnantiomer
public static final int cChiralityKnownEnantiomer
- See Also:
- Constant Field Values
-
cChiralityUnknownEnantiomer
public static final int cChiralityUnknownEnantiomer
- See Also:
- Constant Field Values
-
cChiralityEpimers
public static final int cChiralityEpimers
- See Also:
- Constant Field Values
-
cChiralityDiastereomers
public static final int cChiralityDiastereomers
- See Also:
- Constant Field Values
-
cMoleculeColorDefault
public static final int cMoleculeColorDefault
- See Also:
- Constant Field Values
-
cMoleculeColorNeutral
public static final int cMoleculeColorNeutral
- See Also:
- Constant Field Values
-
cAtomLabel
public static final java.lang.String[] cAtomLabel
-
cRoundedMass
public static final short[] cRoundedMass
-
cDefaultAtomValence
public static final int cDefaultAtomValence
- See Also:
- Constant Field Values
-
cAtomValence
public static final byte[][] cAtomValence
-
cCommonOxidationState
public static final byte[][] cCommonOxidationState
-
mMaxAtoms
protected transient int mMaxAtoms
-
mMaxBonds
protected transient int mMaxBonds
-
mValidHelperArrays
protected transient int mValidHelperArrays
-
mAllAtoms
protected transient int mAllAtoms
-
mAllBonds
protected transient int mAllBonds
-
mAtomicNo
protected transient int[] mAtomicNo
-
mAtomCharge
protected transient int[] mAtomCharge
-
mAtomMapNo
protected transient int[] mAtomMapNo
-
mAtomMass
protected transient int[] mAtomMass
-
mAtomFlags
protected transient int[] mAtomFlags
-
mAtomQueryFeatures
protected transient int[] mAtomQueryFeatures
-
mBondAtom
protected transient int[][] mBondAtom
-
mBondType
protected transient int[] mBondType
-
mBondFlags
protected transient int[] mBondFlags
-
mBondQueryFeatures
protected transient int[] mBondQueryFeatures
-
mCoordinates
protected transient Coordinates[] mCoordinates
-
mIsFragment
protected transient boolean mIsFragment
-
mIsRacemate
protected transient boolean mIsRacemate
-
mProtectHydrogen
protected transient boolean mProtectHydrogen
-
mChirality
protected transient int mChirality
-
mAtomList
protected transient int[][] mAtomList
-
mAtomCustomLabel
protected transient byte[][] mAtomCustomLabel
-
-
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 copiedbonds
- 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 moleculedestAtom2
- second bond atom index in destination moleculeuseBondTypeDelocalized
-- 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 consideredbonds
- 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 consideredbonds
- bond indexes >= this are not considereddefaultBondLength
-- 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 consideredbonds
- bond indexes >= this are not considereddefaultBondLength
-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 1bond
-- 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 numbersisExcludeList
- 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,cAtomParityUnknownisPseudo
- 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,cBondParityUnknownisPseudo
- 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,cESRTypeOrgroup
- 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,cESRTypeOrgroup
- 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()
-
-