chemaxon.struc
Class MoleculeGraph

java.lang.Object
  extended bychemaxon.struc.CGraph
      extended bychemaxon.struc.MoleculeGraph
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, StereoConstants
Direct Known Subclasses:
Molecule, SelectionMolecule

public class MoleculeGraph
extends CGraph
implements StereoConstants

A graph consisting of MolAtom vertices and MolBond edges.

Since:
3.0, 10/11/2002
Version:
3.3, 01/02/2004
Author:
Peter Csizmadia, Ferenc Csizmadia, Andras Volford, Gyorgy Pirok, Szilveszter Juhos
See Also:
MolAtom, MolBond, Serialized Form

Field Summary
protected static int DIM_MASK
          Dimension bits in flags.
protected  int flags
          Stores the dimension (0, 2 or 3) and the chiral flag.
protected  boolean isMultiChiral
          true if there are at least two chiral centres
protected  double orix
          Origin x.
protected  double oriy
          Origin y.
protected  double oriz
          Origin z.
protected static int RMCLEANUP_STEREO
          When removing a H atom, keep stereo information unchanged.
 
Fields inherited from class chemaxon.struc.CGraph
btab, ctab, edgeCount, edges, fragIds, grinv, grinvCC, INITIAL_CAPACITY, nFrags, nGrinv, nodeCount, nodes, parentGraph, RMCLEANUP_ALL, RMCLEANUP_EDGES, RMCLEANUP_NONE, sssr, superGraph
 
Fields inherited from interface chemaxon.struc.StereoConstants
ATOMSTEREO_EITHER, ATOMSTEREO_MASK, ATOMSTEREO_NONE, ATOMSTEREO_SPECIFIC, CHIRALITY_MASK, CHIRALITY_R, CHIRALITY_S, CHIRALITYSUPPORT_ALL, CHIRALITYSUPPORT_NONE, CHIRALITYSUPPORT_SELECTED, CIS, CTUMASK, CTUNKNOWN, CTUNSPEC, DBS_ALL, DBS_MARKED, DBS_NONE, PARITY_EITHER, PARITY_EVEN, PARITY_MASK, PARITY_ODD, PARITY_UNSPEC, STGRP_ABS, STGRP_AND, STGRP_NONE, STGRP_OR, TRANS
 
Constructor Summary
MoleculeGraph()
          Construct a molecule.
MoleculeGraph(MoleculeGraph p)
          Construct a molecule or fragment.
MoleculeGraph(MoleculeGraph p, int na, int nb)
          Construct a molecule or fragment with the specified number of atoms and bonds.
 
Method Summary
 void adjustMultiChiralFlag()
          Checks wether the molecule has multiple chiral centres
 void aromatize(boolean a)
          Aromatize or dearomatize molecule.
 double bondlength()
          Calculates the regular bond length.
 DPoint3 calcCenter()
          Calculates the geometrical center.
 void calcCenter(DPoint3 p)
          Calculates the geometrical center.
 int calcDehydrogenizedGrinv(int[] gi)
          Calculates the graph invariants with the assumption that hydrogens are removed.
 double calcHeight()
          Calculates the molecule height.
 void calcOutRectCenter(DPoint3 p)
           
 double calcWidth()
          Calculates the molecule width.
 boolean canBeCT(int i2, int i3)
          Determines whether the bond between the specified atoms can be a CIS/TRANS or not.
 boolean clean(int dim, java.lang.String opts)
          Calculates atom coordinates.
 void clear()
          Clears the molecule.
 void clearForImport(java.lang.String format)
          Clears the edges vector, the properties, the flags, and sets the origin coordinates to 0.
 java.lang.Object clone()
          Make an identical copy of the molecule.
 void clonecopy(CGraph g)
          Make another molecule identical to this one.
 void clonelesscopy(CGraph g)
          Copy to selection.
 boolean contains(CGraph graph)
          Does the graph contain the specified fragment?
 int[][] createBHtab()
          Creates the bond table extended with implicit hydrogen atoms.
 int[][] createCHtab()
          Creates the connection table extended with implicit hydrogen atoms.
protected  MoleculeGraph createDehydrogenizedReadOnlyGraph()
          Creates a dehydrogenized version of the molecule.
 int[][] getAromrings()
          Get aromatic ring atom indexes.
 int[][] getAromrings(int size)
          Get aromatic ring atom indexes.
 MolAtom getAtom(int n)
          Gets the nth atom.
 MolAtom[] getAtomArray()
          Create an array of atoms.
 int getAtomCount()
          Gets the number of atoms.
 MolBond getBond(int n)
          Gets the nth bond.
 int getBondCount()
          Gets the number of bonds.
 int getChirality(int i)
          Computes the chirality of an atom of the Molecule instance based on both the coordinates of the neighbouring atoms and the stereo information of the bonds to those.
 double getDesiredLength(int atno1, int atno2, int type)
          Gets the ideal bond length in Angstroms.
 double getDesiredLength(MolBond b)
          Gets the ideal bond length in Angstroms.
 int getDim()
          Gets the dimension.
 MDocument getDocument()
          Gets the parent document object.
 java.lang.String getFormula()
          Gets the molecular formula.
 MoleculeGraph getGraphUnion()
          Gets a graph containing all the atoms and bonds.
 int getGrinv(int[] gi)
          Gets the graph invariants.
 int getGrinv(int[] gi, boolean uniqueFlag)
          Gets the graph invariants (canonical labels).
 int getImplicitHcount()
          Gets the total number of implicit hydrogens attached to the molecule.
 DPoint3 getLocation()
          Gets the origin of the molecule.
 double getMass()
          Calculates the molecular weight of the molecule.
 int[][] getNonAromrings()
          Get alpihatic ring atom indexes.
 int[][] getNonAromrings(int size)
          Get alpihatic ring atom indexes.
 int getParity(int i)
          Computes the parity of an atom of the Molecule instance based on both the coordinates of the neighbouring atoms and the stereo information of the bonds to those.
 DPoint3[] getPoints()
          Gets an array containing the atom coordinates.
 int[] getSSSRBondSet()
          Get SSSR bond bitsets in integer array.
 int getStereo2(CNode a1, int i2, int i3, CNode a4)
          Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration.
 int getStereo2(int i1, int i2, int i3, int i4)
          Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration.
 int getStereo2(MolBond b)
          Gets cis/trans (Z/E) stereo information for the given bond.
 int getStereo2(MolBond b, CNode a1, CNode a4)
          Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration.
 int getStereo2(MolBond b, CNode a1, CNode a4, boolean grcheck)
          Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration.
protected  int getStereo2(MolBond b, CNode a1, int i2, int i3, CNode a4)
          Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration.
protected  int getStereo2(MolBond b, CNode a1, int i2, int i3, CNode a4, boolean grcheck)
          Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration.
 boolean hasImplicitH()
          Indicates, whether the molecule has implicit hydrogen atoms.
 boolean hydrogenize(boolean add)
          Implicit/explicit Hydrogen conversion.
 void implicitizeHydrogens(int f)
          Removes explicit bound Hydrogens from the graph and converts them to implicit.
 boolean isAbsStereo()
          Gets the absolute stereoconfiguration flag.
 boolean isAtom()
          Determines whether the structure represents only one atom and an arbitrary number of bonds.
 boolean isBond()
          Determines whether the structure represents only one bond and zero or two atoms.
 boolean isMultiChiral()
          Returns the multiple chirality flag.
 boolean isRingBond(int idx)
          Is this bond in ring?
protected  void makeItSimilar(CGraph g)
          Copies some properties of this molecule to the other one specified as argument.
 void moveTo(DPoint3 o)
          Move the molecule.
 CGraph newInstance()
          Creates a new MoleculeGraph object.
 void qpropCheck(java.util.Vector v)
          Check for query property errors.
protected  void removeNode(CNode node, int cleanupFlags)
          Removes a node and its edges.
protected  void removeNode(int i, int cleanupFlags)
          Removes a node and its edges.
 void setAbsStereo(boolean c)
          Sets the absolute stereoconfiguration flag.
 boolean setChirality(int i, int c)
          Set chirality of an atom of the Molecule instance based on both the coordinates of the neighbouring atoms and the stereo information of the bonds to those.
 void setDim(int d)
          Sets the dimension.
 void setLocation(DPoint3 o)
          Set the origin of the molecule.
 boolean setParity(int[] p)
          Change the bonds flag (UP/DOWN) connected to the whole molecule to achieve the specified parity array.
 boolean setParity(int i, int p)
          Change the bonds flag (UP/DOWN) connected to the given atom to achieve the specified parity.
 void setSetSeqs(int id)
          Sets the set sequence number of all atoms.
 boolean stereoClean()
          Reset the wedges of the molecule, based on the actual parity information.
 void transform(CTransform3D t)
          Apply a transformation matrix to the atomic coordinates.
protected  void transform(CTransform3D t, boolean incg)
          Apply a transformation matrix to the atomic coordinates.
 void valenceCheck()
          Check valence and query property errors.
 void valenceCheck(java.util.Vector v)
          Check valence and query property errors.
 
Methods inherited from class chemaxon.struc.CGraph
add, add, addEdge0, addEdgeWithoutChangingIt, addNode0, addNodeWithoutChangingIt, contains, findFrag, findFrags, fuse, fuse0, getBtab, getCtab, getEdge, getEdgeCount, getEdgeVector, getForefather, getFragCount, getFragIds, getGrinv, getGrinvCC, getLock, getNode, getNodeCount, getNodeVector, getParent, getSSSR, indexOf, indexOf, isEmpty, isRealNodeParent, mergeNodes, pack, regenEdges, removeAll, removeAllEdges, removeEdge, removeEdge, removeEdge, removeEdge, removeNode, removeNode, resetCtab, resetGrinvInParents, setEdge, setNode, setNode0, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DIM_MASK

protected static final int DIM_MASK
Dimension bits in flags.

See Also:
flags, Constant Field Values

RMCLEANUP_STEREO

protected static final int RMCLEANUP_STEREO
When removing a H atom, keep stereo information unchanged.

Since:
3.1
See Also:
removeNode(CNode, int), removeNode(int, int), CGraph.RMCLEANUP_NONE, CGraph.RMCLEANUP_ALL, CGraph.RMCLEANUP_EDGES, Constant Field Values

orix

protected transient double orix
Origin x.


oriy

protected transient double oriy
Origin y.


oriz

protected transient double oriz
Origin z.


flags

protected transient int flags
Stores the dimension (0, 2 or 3) and the chiral flag.

See Also:
getDim(), isAbsStereo()

isMultiChiral

protected transient boolean isMultiChiral
true if there are at least two chiral centres

Constructor Detail

MoleculeGraph

public MoleculeGraph(MoleculeGraph p,
                     int na,
                     int nb)
Construct a molecule or fragment with the specified number of atoms and bonds.

Parameters:
p - the molecule that contains the created fragment
na - no reallocation needed until the number of atoms is less than this value
nb - no reallocation needed until the number of bonds is less than this value

MoleculeGraph

public MoleculeGraph(MoleculeGraph p)
Construct a molecule or fragment.

Parameters:
p - the parent structure

MoleculeGraph

public MoleculeGraph()
Construct a molecule.

Method Detail

getDocument

public MDocument getDocument()
Gets the parent document object.

Returns:
a Marvin document object
Since:
3.3

setDim

public void setDim(int d)
Sets the dimension.

Parameters:
d - 0, 2, or 3
See Also:
flags

getDim

public int getDim()
Gets the dimension.

Returns:
0, 2, or 3
See Also:
flags

isAbsStereo

public boolean isAbsStereo()
Gets the absolute stereoconfiguration flag. "Chiral flag" in MDL molfiles.

Returns:
true for absolute, false for relative configuration
See Also:
flags

setAbsStereo

public void setAbsStereo(boolean c)
Sets the absolute stereoconfiguration flag.

Parameters:
c - the absolute stereoconfiguration flag
See Also:
flags

clear

public void clear()
Clears the molecule. Does the same as clearForImport() but also clears the nodes vector.

See Also:
clearForImport(java.lang.String), CGraph.nodes

clearForImport

public void clearForImport(java.lang.String format)
Clears the edges vector, the properties, the flags, and sets the origin coordinates to 0. The molecule dimension is set to 2.

Parameters:
format - input file format, neglected
See Also:
CGraph.edges, orix, oriy, oriz, flags

removeNode

protected void removeNode(CNode node,
                          int cleanupFlags)
Removes a node and its edges.

Overrides:
removeNode in class CGraph
Parameters:
node - the node
cleanupFlags - extra clean-up methods
Since:
3.1
See Also:
CGraph.RMCLEANUP_NONE, CGraph.RMCLEANUP_ALL, CGraph.RMCLEANUP_EDGES, RMCLEANUP_STEREO

removeNode

protected void removeNode(int i,
                          int cleanupFlags)
Removes a node and its edges.

Overrides:
removeNode in class CGraph
Parameters:
i - the node index
cleanupFlags - extra clean-up methods
Since:
3.1
See Also:
CGraph.RMCLEANUP_NONE, CGraph.RMCLEANUP_ALL, CGraph.RMCLEANUP_EDGES, RMCLEANUP_STEREO

setSetSeqs

public void setSetSeqs(int id)
Sets the set sequence number of all atoms.

Parameters:
id - the set sequence number
Since:
2.9.1

hydrogenize

public boolean hydrogenize(boolean add)
Implicit/explicit Hydrogen conversion. Adds explicit H atoms instead of the current implicit ones, or removes explicit H atoms and increases the number of implicit hydrogens.

Parameters:
add - add explicit H atoms if true, remove if false
Returns:
true for success, false if an error occured
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)

implicitizeHydrogens

public void implicitizeHydrogens(int f)
Removes explicit bound Hydrogens from the graph and converts them to implicit. Only those explicit H atoms are converted for which MolAtom.isImplicitizableH(int) returns true.

Parameters:
f - flags specifying special H atom types to include
Since:
3.1
See Also:
MolAtom.LONELY_H, MolAtom.ISOTOPE_H, MolAtom.CHARGED_H, MolAtom.RADICAL_H, MolAtom.MAPPED_H

getGrinv

public int getGrinv(int[] gi)
Gets the graph invariants. The graph invariants are copied into the specified array, that must have the same length as the number of atoms in the molecule.

Notes: 1. For normal molecules and R-groups, graph invariants are recalculated only if an atom or bond changed, removed or added.
2. For selections, graph invariants are recalculated each time this function is called, because atoms and bonds cannot notify selections about their changes.

Overrides:
getGrinv in class CGraph
Parameters:
gi - output array, its length must be equal to the number of atoms
Returns:
the number of different graph invariants
Throws:
java.lang.SecurityException - the GraphInvariants module cannot be loaded because of security reasons (firewall)

getGrinv

public int getGrinv(int[] gi,
                    boolean uniqueFlag)
Gets the graph invariants (canonical labels). Same like the former method but if the boolean flag is true chiral info is also added to invariants (needed for unique SMILES).

Parameters:
gi - output array, its length must be equal to the number of atoms
uniqueFlag - boolean flag
Returns:
the number of different graph invariants
Throws:
java.lang.SecurityException - the GraphInvariants module cannot be loaded because of security reasons (firewall)
Since:
3.3

calcDehydrogenizedGrinv

public int calcDehydrogenizedGrinv(int[] gi)
Calculates the graph invariants with the assumption that hydrogens are removed. Entries corresponding to hydrogens are filled with -1 values in the output array. Only normal Hydrogen atoms are removed, isotopes (Deuterium and Tricium) are not.

Parameters:
gi - output array, its length must be equal to the number of atoms
Returns:
the number of different graph invariants
Throws:
java.lang.SecurityException - the GraphInvariants module cannot be loaded because of security reasons (firewall)
Since:
3.1
See Also:
getGrinv(int[])

createDehydrogenizedReadOnlyGraph

protected MoleculeGraph createDehydrogenizedReadOnlyGraph()
Creates a dehydrogenized version of the molecule. The same atom and bond objects are used as in the original molecule, so the returned structure must be used for reading only. Hydrogen isotopes (Deuterium and Tricium) are not removed.

Returns:
dehydrogenized structure
Since:
3.1

valenceCheck

public void valenceCheck()
Check valence and query property errors.

See Also:
MolAtom.valenceCheck()

valenceCheck

public void valenceCheck(java.util.Vector v)
Check valence and query property errors. Check all the atoms if the argument is null.

Parameters:
v - contains the atoms to check
See Also:
MolAtom.valenceCheck()

qpropCheck

public void qpropCheck(java.util.Vector v)
Check for query property errors. Check all the atoms if the argument is null.

Parameters:
v - contains the atoms to check
See Also:
MolAtom.qpropCheck()

contains

public final boolean contains(CGraph graph)
Does the graph contain the specified fragment?

Overrides:
contains in class CGraph
Parameters:
graph - the fragment
Returns:
true if it contains the graph, false if not

isAtom

public boolean isAtom()
Determines whether the structure represents only one atom and an arbitrary number of bonds. Note: a one-atom structure has bonds only if it is a fragment.

Returns:
true if the number of nodes is one

isBond

public boolean isBond()
Determines whether the structure represents only one bond and zero or two atoms.

Returns:
true if the structure is the representation of a bond

getAtomCount

public final int getAtomCount()
Gets the number of atoms.

Returns:
number of atoms

getAtom

public MolAtom getAtom(int n)
Gets the nth atom.

Parameters:
n - the atom index
Returns:
the atom object

getBondCount

public final int getBondCount()
Gets the number of bonds.

Returns:
number of bonds

getBond

public MolBond getBond(int n)
Gets the nth bond.

Parameters:
n - the bond index
Returns:
the bond object

getAtomArray

public MolAtom[] getAtomArray()
Create an array of atoms.

Returns:
array of atom objects
Since:
2.6

calcCenter

public void calcCenter(DPoint3 p)
Calculates the geometrical center.

Parameters:
p - reference to the object that will hold the result
Since:
2.7

calcOutRectCenter

public void calcOutRectCenter(DPoint3 p)

calcCenter

public DPoint3 calcCenter()
Calculates the geometrical center.

Returns:
center point

calcWidth

public double calcWidth()
Calculates the molecule width.

Returns:
the molecule width
Since:
3.0

calcHeight

public double calcHeight()
Calculates the molecule height.

Returns:
the molecule height
Since:
3.0

getDesiredLength

public double getDesiredLength(int atno1,
                               int atno2,
                               int type)
Gets the ideal bond length in Angstroms.

Parameters:
atno1 - atomic number of first molecule
atno2 - atomic number of second molecule
type - bond type
Returns:
the ideal bond length

getDesiredLength

public double getDesiredLength(MolBond b)
Gets the ideal bond length in Angstroms.

Parameters:
b - the bond
Returns:
the ideal bond length
Since:
2.7

bondlength

public double bondlength()
Calculates the regular bond length.

Returns:
the calculated length in Angstroms, or MolBond.CCLENGTH if the molecule has no bonds

getLocation

public DPoint3 getLocation()
Gets the origin of the molecule.

Returns:
the origin
Since:
2.7
See Also:
orix

setLocation

public void setLocation(DPoint3 o)
Set the origin of the molecule.

Parameters:
o - the origin
Since:
2.7
See Also:
orix

moveTo

public void moveTo(DPoint3 o)
Move the molecule.

Parameters:
o - the new origin
Since:
2.7
See Also:
orix

transform

public void transform(CTransform3D t)
Apply a transformation matrix to the atomic coordinates.

Parameters:
t - the transformation matrix
Since:
2.7

transform

protected void transform(CTransform3D t,
                         boolean incg)
Apply a transformation matrix to the atomic coordinates.

Parameters:
t - the transformation matrix
incg - change graph invariants (true) or not (false)
Since:
3.0

getPoints

public DPoint3[] getPoints()
Gets an array containing the atom coordinates.

Returns:
atom coordinates array
Since:
2.9.1

clonecopy

public void clonecopy(CGraph g)
Make another molecule identical to this one.

Overrides:
clonecopy in class CGraph
Parameters:
g - the target molecule

clonelesscopy

public void clonelesscopy(CGraph g)
Copy to selection. Make another molecule identical to this one, but do not clone atoms, bonds, and the properties.

Overrides:
clonelesscopy in class CGraph
Parameters:
g - the target molecule object (the selection)

clone

public java.lang.Object clone()
Make an identical copy of the molecule.

Overrides:
clone in class CGraph
Returns:
the copy

getParity

public final int getParity(int i)
Computes the parity of an atom of the Molecule instance based on both the coordinates of the neighbouring atoms and the stereo information of the bonds to those. Leaves the imported parity unchanged.

Parameters:
i - the index of the atom whose parity is to be determined
Returns:
0 for nonchiral, PARITY_ODD or PARITY_EVEN for atoms of odd or even parity, PARITY_ODD|PARITY_EVEN for atoms whose parity is unspecified or cannot be assigned -as they are defined in MolAtom
Throws:
java.lang.SecurityException - the Parity module cannot be loaded because of security reasons (firewall)
See Also:
StereoConstants.PARITY_ODD, StereoConstants.PARITY_EVEN, isAbsStereo(), setAbsStereo(boolean)

setParity

public boolean setParity(int i,
                         int p)
Change the bonds flag (UP/DOWN) connected to the given atom to achieve the specified parity. If all atom parities will be set then setParity(int[] p) is more efficient.

Parameters:
i - the index of the atom whose parity is to be set
p - parity to be set (PARITY_ODD,PARITY_EVEN)
Returns:
true if successful
Throws:
java.lang.SecurityException - the Parity module cannot be loaded because of security reasons (firewall)
See Also:
StereoConstants.PARITY_ODD, StereoConstants.PARITY_EVEN, MolBond.UP, MolBond.DOWN, setParity(int[] p)

setParity

public boolean setParity(int[] p)
Change the bonds flag (UP/DOWN) connected to the whole molecule to achieve the specified parity array.

Parameters:
p - the parity for each atom in the molecule
Returns:
true if successful
See Also:
StereoConstants.PARITY_ODD, StereoConstants.PARITY_EVEN, isAbsStereo(), setAbsStereo(boolean), MolBond.UP, MolBond.DOWN

getChirality

public final int getChirality(int i)
Computes the chirality of an atom of the Molecule instance based on both the coordinates of the neighbouring atoms and the stereo information of the bonds to those. Leaves the imported configuration unchanged.

Parameters:
i - the index of the atom whose chirality is to be determined
Returns:
0 for nonchiral, CHIRALITY_R or CHIRALITY_S for atoms of R or S configuration, PARITY_EITHER for atoms whose configuration is unspecified or cannot be assigned -as they are defined in MolAtom
Throws:
java.lang.SecurityException - the Parity module cannot be loaded because of security reasons (firewall)
See Also:
StereoConstants.CHIRALITY_R, StereoConstants.CHIRALITY_S

setChirality

public boolean setChirality(int i,
                            int c)
Set chirality of an atom of the Molecule instance based on both the coordinates of the neighbouring atoms and the stereo information of the bonds to those.

Parameters:
i - the index of the atom whose chirality is to be set
c - chirality to be set (CHIRALITY_R,CHIRALITY_S)
Returns:
true if successful
Throws:
java.lang.SecurityException - the Parity module cannot be loaded because of security reasons (firewall)
See Also:
StereoConstants.CHIRALITY_R, StereoConstants.CHIRALITY_S

getStereo2

public final int getStereo2(int i1,
                            int i2,
                            int i3,
                            int i4)
Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration. Calculates the stereo information if the molecule is 2D or 3D, reports previously set information if it is 0D. Not checking atom equivalences using graph invariants.

Parameters:
i1 - index of atom A1
i2 - index of atom A2
i3 - index of atom A3
i4 - index of atom A4
Returns:
the cis/trans information, or 0 if A2 and A3 are not connected
See Also:
StereoConstants.CTUMASK, MolBond.calcStereo2()

getStereo2

public final int getStereo2(CNode a1,
                            int i2,
                            int i3,
                            CNode a4)
Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration. Calculates the stereo information if the molecule is 2D or 3D, reports previously set information if it is 0D.

Parameters:
a1 - atom A1
i2 - index of atom A2
i3 - index of atom A3
a4 - atom A4
Returns:
the cis/trans information, or 0 if A2 and A3 are not connected
See Also:
StereoConstants.CTUMASK, MolBond.calcStereo2()

getStereo2

public final int getStereo2(MolBond b,
                            CNode a1,
                            CNode a4)
Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration. Calculates the stereo information if the molecule is 2D or 3D, reports previously set information if it is 0D. Atoms A2 and A3 are node1 and node2 of the specified bond. Both (A2, A3) = (node1, node2) and (A2, A3) = (node2, node1) works. Not checking atom equivalences using graph invariants.

Parameters:
b - the bond
a1 - atom A1
a4 - atom A4
Returns:
the stereo flags
See Also:
StereoConstants.CTUMASK, MolBond.calcStereo2()

getStereo2

public final int getStereo2(MolBond b,
                            CNode a1,
                            CNode a4,
                            boolean grcheck)
Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration. Calculates the stereo information if the molecule is 2D or 3D, reports previously set information if it is 0D. Atoms A2 and A3 are node1 and node2 of the specified bond. Both (A2, A3) = (node1, node2) and (A2, A3) = (node2, node1) works.

Parameters:
b - the bond
a1 - atom A1
a4 - atom A4
grcheck - true if check atom equivalences using graph invariants
Returns:
the stereo flags
See Also:
StereoConstants.CTUMASK, MolBond.calcStereo2()

getStereo2

public final int getStereo2(MolBond b)
Gets cis/trans (Z/E) stereo information for the given bond. Use the CIP rules to determine the A1, A4 atoms in A1-A2=A3-A4 atom configuration. Calculates the stereo information if the molecule is 2D or 3D, reports previously set information if it is 0D. Not checking atom equivalences using graph invariants.

Parameters:
b - the bond
Returns:
the stereo flags
See Also:
StereoConstants.CTUMASK, MolBond.calcStereo2()

getStereo2

protected final int getStereo2(MolBond b,
                               CNode a1,
                               int i2,
                               int i3,
                               CNode a4)
Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration. Calculates the stereo information if the molecule is 2D or 3D, reports previously set information if it is 0D. Not checking atom equivalences using graph invariants.

Parameters:
b - the bond
a1 - atom A1
i2 - index of atom A2
i3 - index of atom A3
a4 - atom A4
Returns:
the stereo flags
See Also:
StereoConstants.CTUMASK, MolBond.calcStereo2()

getStereo2

protected final int getStereo2(MolBond b,
                               CNode a1,
                               int i2,
                               int i3,
                               CNode a4,
                               boolean grcheck)
Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration. Calculates the stereo information if the molecule is 2D or 3D, reports previously set information if it is 0D.

Parameters:
b - the bond
a1 - atom A1
i2 - index of atom A2
i3 - index of atom A3
a4 - atom A4
grcheck - true if check atom equivalences using graph invariants
Returns:
the stereo flags
See Also:
StereoConstants.CTUMASK, MolBond.calcStereo2()

canBeCT

public final boolean canBeCT(int i2,
                             int i3)
Determines whether the bond between the specified atoms can be a CIS/TRANS or not.

Parameters:
i2 - index of the first atom
i3 - index of the second atom
Returns:
true if this is a double bond that can be either CIS, TRANS or EITHER, false else.

aromatize

public void aromatize(boolean a)
Aromatize or dearomatize molecule.

Parameters:
a - aromatize (true) or dearomatize (false)
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
2.8

getFormula

public java.lang.String getFormula()
Gets the molecular formula.

Returns:
the formula

getMass

public double getMass()
Calculates the molecular weight of the molecule. Returns a double value.


makeItSimilar

protected void makeItSimilar(CGraph g)
Copies some properties of this molecule to the other one specified as argument. Copies the flags and the origin coordinates.

Overrides:
makeItSimilar in class CGraph
Parameters:
g - the molecule to change

newInstance

public CGraph newInstance()
Creates a new MoleculeGraph object. The dimension and the origin coordinates will be the same as in the original molecule.

Overrides:
newInstance in class CGraph
Returns:
a MoleculeGraph object

getGraphUnion

public MoleculeGraph getGraphUnion()
Gets a graph containing all the atoms and bonds.

Returns:
this object (in the default implementation)
Since:
3.0, 11/11/2002

hasImplicitH

public boolean hasImplicitH()
Indicates, whether the molecule has implicit hydrogen atoms.

Returns:
true, if the molecule has at least one implicit hydrogen atom

clean

public boolean clean(int dim,
                     java.lang.String opts)
Calculates atom coordinates.

Parameters:
dim - dimensions
opts - cleaning options
  • for 2D:

    O0 No optimization
    O1 Optimize if needed (default)
    O2 Always optimize

    e Verbose either flag

      If it is not possible to decide whether
      the double bond is CIS or TRANS, set the
      double bond to either

    d show debugging info

    tX set optimization time limit to X ms

      maximum time spend in the optimization
      default value: 5000ms
      if X<1, no time limit used

    iX set iteration limit to X step

      maximum iteration step in the optimization algorithm
      default value: 100

    rX set ring step limit to X step

      maximum number of steps when drawing a ring
      avoiding bond cross
      default value: no limit

    cX set branch step limit to X

      step limit for the recursively drawing
      a branch of a moleule avoiding bond cross
      default value: no limit

  • for 3D:

    O0 Lightweight optimization (default)

    OD Dreiding optimization

null use the default values

Returns:
true for success, false if an error occured
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)

stereoClean

public boolean stereoClean()
Reset the wedges of the molecule, based on the actual parity information. Only rings smaller then 19 atoms are examined.

Returns:
true if succesful

getAromrings

public int[][] getAromrings()
Get aromatic ring atom indexes. Only rings smaller then 19 atoms are examined. Note: If you want to get the aliphatic rings also, get first them by using getNonAromrings and then the aromatic ones.

Returns:
the aromatic ring atom indexes.

getNonAromrings

public int[][] getNonAromrings()
Get alpihatic ring atom indexes. Only rings smaller then 19 atoms are examined. Getting the aliphatic rings is much slower then the aromatic ones.

Returns:
the nonaromatic ring atom indexes.

getAromrings

public int[][] getAromrings(int size)
Get aromatic ring atom indexes. Only rings smaller then the given size are examined. Note: If you want to get the aliphatic rings also, get first them by using getAliphaticrings and then the aromatic ones.

Parameters:
size - the maximum ring size during ring detection
Returns:
the aromatic ring atom indexes.

getNonAromrings

public int[][] getNonAromrings(int size)
Get alpihatic ring atom indexes. Only rings smaller then the given size are examined. Getting the aliphatic rings is much slower then the aromatic ones.

Parameters:
size - the maximum ring size during ring detection
Returns:
the aliphatic ring atom indexes.

getSSSRBondSet

public int[] getSSSRBondSet()
Get SSSR bond bitsets in integer array. To get if the given 'n' bond is in the sssr integer array 'r', use the following code:
 static boolean get(int n, int[] r) {
    return (r[n/32] & (((int)1) << (31-(n % 32)))) != 0 ;
}

Returns:
the SSSR ring bond indexes in integer array.

isRingBond

public boolean isRingBond(int idx)
Is this bond in ring?

Parameters:
idx - the bond index
Returns:
true if the bond is in ring else false.

createCHtab

public int[][] createCHtab()
Creates the connection table extended with implicit hydrogen atoms. The implicit H atoms are indexed by free index numbers starting from the atom count and proceeding one-by-one from there. The current implementation always creates the table, the molecule does not store its extended connection table. chtab[i][j] will be the index of the jth neighbor of the ith atom, where atom indices greater than or equal to the atom count mean implicit hydrogen atoms.

Returns:
the chtab array
Since:
3.0

createBHtab

public int[][] createBHtab()
Creates the bond table extended with implicit hydrogen atoms. The implicit H atoms are indexed by free index numbers starting from the atom count and proceeding one-by-one from there. The current implementation always creates the table, the molecule does not store its extended connection table. bhtab[i][j] will be the index of the bond between atoms i and j, or -1 if there is no bond, -2 if it is an atom-implicitH bond where atom indices greater than or equal to the atom count mean implicit hydrogen atoms.

Returns:
the chtab array
Since:
3.0

getImplicitHcount

public int getImplicitHcount()
Gets the total number of implicit hydrogens attached to the molecule.

Returns:
the implicit hydrogen count or the number of query hydrogens

isMultiChiral

public boolean isMultiChiral()
Returns the multiple chirality flag. To speed up the canonical label calculations, add chirality invariant to only those molecules that has at least two possible chiral centres.

Since:
3.3

adjustMultiChiralFlag

public void adjustMultiChiralFlag()
Checks wether the molecule has multiple chiral centres

Since:
3.3