chemaxon.struc
Class MoleculeGraph

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

public class MoleculeGraph
extends CGraph
implements chemaxon.struc.ReadableMolecule, MTransformable, StereoConstants

A graph consisting of MolAtom vertices and MolBond edges.

Since:
Marvin 3.0, 10/11/2002
Version:
4.2, 09/23/2006
Author:
Peter Csizmadia, Ferenc Csizmadia, Andras Volford, Gyorgy Pirok, Szilveszter Juhos, Szabolcs Csepregi, Erika Biro
See Also:
MolAtom, MolBond, Serialized Form

Field Summary
static int AROM_BASIC
          Basic aromatization.
static int AROM_CHEMAXON
          Deprecated. please use AROM_BASIC instead. Chemaxon aromatization.
static int AROM_DAYLIGHT
          Deprecated. please use AROM_GENERAL instead. Daylight aromatization (modified Huckel rule).
static int AROM_GENERAL
          General (Daylight conform) aromatization.
static int CACHE_REMOVE_AROMATAMODULE
          Cache removal option for remove module used in aromatization.
static int CACHE_REMOVE_GRINVMODULE
          Cache removal option for remove module used in graph invariant calculation.
static int CACHE_REMOVE_PARITYMODULE
          Cache removal option for remove module used in parity calculation.
static int CACHE_REMOVE_SSSRMODULE
          Cache removal option for remove module used in sssr.
protected static int DIM_MASK
          Dimension bits in flags.
protected  int flags
          Stores the dimension (0, 2 or 3) and the chiral flag.
static int GRINV_DONT_STORE
          Graph invariant option to instruct that the graph invariant should not be stored in MoleculeGraph.
static int GRINV_NOHYDROGEN
          Graph invariant option for ignoring explicit hydrogens.
static int GRINV_OLDSTEREO
          Graph invariant option for calculating graph invariants using the old stereo method.
static int GRINV_STEREO
          Graph invariant option for calculating graph invariants using stereo information.
static int GRINV_VALUE_OPTIONS
          Unified mask of graph invariant options affecting grinv value.
static java.lang.String INVALID_LINKNODE_MESSAGE
           
protected  boolean isMultiChiral
          true if there are at least two chiral centres
static int MIN_RING_SIZE_FOR_TRANS_DB
          The minimal size of the ring for the existence of TRANS double bond.
protected  double orix
          Origin x.
protected  double oriy
          Origin y.
protected  double oriz
          Origin z.
protected  MPropertyContainer propertyContainer
           
static int RMCLEANUP_MOBJECT
          Remove graphics objects containing the removed node.
static int RMCLEANUP_STEREO
          When removing a H atom, keep stereo information unchanged.
 
Fields inherited from class chemaxon.struc.CGraph
btab, CACHE_REMOVE_ALL, CACHE_REMOVE_CACHEMEMORY, cacheMemory, ctab, edgeCount, edges, fragIds, grinv, grinvCC, grinvOptions, INITIAL_CAPACITY, nFrags, nGrinv, nodeCount, nodes, parentGraph, RMCLEANUP_ALL, RMCLEANUP_EDGES, RMCLEANUP_NONE, sssr, sssrl2idx, superGraph
 
Fields inherited from interface chemaxon.struc.ReadableMolecule
HS_S, HS_SP, HS_SP2, HS_SP3, HS_UNKNOWN
 
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, int na, int nb)
          Construct a molecule or fragment with the specified number of atoms and bonds.
 
Method Summary
protected  void addAtomsAndBondsTo(MoleculeGraph s)
          Adds all atoms and bonds to the specified molecule.
 void addExplicitLonePairs()
          Adds explicit lone pairs.
 void adjustMultiChiralFlag()
          Checks whether the molecule has multiple chiral centres
 void aromatize()
          Aromatize molecule using the default general aromatization method.
 void aromatize(boolean a)
          Aromatize (using the default general aromatization method) or dearomatize molecule.
 void aromatize(int method)
          Aromatize molecule.
 void arrangeComponents()
          Arranges molecule components (reactants, agents, products, R-group definitions) nicely.
 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 calcHybridization()
          Calculates and sets hybridazation state for each atom.
 DPoint3 calcOutRect()
          Calculates the outer rectangle.
 void calcOutRect(DPoint3 p)
          Calculates the outer rectangle.
 DPoint3 calcOutRectCenter()
          Calculates the center of the outer rectangle.
 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 canBeCT(int i2, int i3, boolean grcheck)
          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.
 boolean clean(int dim, java.lang.String opts, chemaxon.marvin.util.MProgressMonitor pmon)
          Calculates atom coordinates.
 void clear()
          Clears the molecule.
 void clearCachedInfo(int options)
          Deletes the cached information depending on the given options.
 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.
 void dearomatize()
          Dearomatize molecule.
 MolAtom findAtomClone(MolAtom a)
          Finds the clone of an atom.
protected  void fuse0(CGraph g)
          Add the atoms and bonds of another molecule.
 int[][][] getAromaticAndAliphaticRings(int aromatizationType, boolean onlyAromrings, boolean aromatize, int maxRingSize, int ringsLimit)
          Get aromatic and or aliphatic ring atom indexes.
 int[][] getAromrings()
          Deprecated. please use getAromaticAndAliphaticRings instead.
 int[][] getAromrings(int size)
          Deprecated. please use getAromaticAndAliphaticRings instead.
 MolAtom getAtom(int n)
          Gets the nth atom.
 MolAtom[] getAtomArray()
          Creates an array of atoms.
 int getAtomCount()
          Gets the number of atoms.
 MolBond getBond(int n)
          Gets the nth bond.
 MolBond[] getBondArray()
          Creates an array of bonds.
 int getBondCount()
          Gets the number of bonds.
 int getCharge(int k)
          Gets the charge of an atom.
 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 document object.
protected  MDocument getDocumentForChild(MoleculeGraph g)
          Gets the parent document for a child graph.
 CEdge[] getEdgeArray()
          Creates an array of bonds.
 java.util.Vector getEdgeVector()
          Creates an array of atoms.
 double getExactMass()
          Calculates the molecular exact weight of the molecule.
 int getExplicitHcount()
          Gets the total number of explicit hydrogens attached to the molecule.
 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)
          Deprecated. Please use getGrinv(int[], int) instead.
 int getGrinv(int[] gi, int options)
          Gets the graph invariants (canonical labels).
 int getHybridizationState(int k)
          Gets the hybridization state.
 int getImplicitHcount()
          Gets the total number of implicit hydrogens attached to the molecule.
 int getLocalChirality(int idx, int[] ch)
          Get local chirality.
 int getLocalParity(int i)
          Computes the local 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 getLocation()
          Gets the origin of the molecule.
 int getLonePairCount(int i)
          Gets the number of lone pairs.
 double getMass()
          Calculates the molecular weight of the molecule.
 int getMassno(int k)
          Gets the mass number of an atom.
 java.lang.String getName()
          Gets the molecule name.
 int getNeighbor(int k, int i)
          Gets the index of a neighbor of an atom.
 int getNeighborCount(int k)
          Gets the number of neighbors of an atom.
 java.util.Vector getNodeVector()
          Creates an array of atoms.
 int[][] getNonAromrings()
          Deprecated. please use getAromaticAndAliphaticRings instead.
 int[][] getNonAromrings(int size)
          Deprecated. please use getAromaticAndAliphaticRings instead.
protected  MDocument getParentDocument()
          Gets the document or the document of the parent graph.
 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 getRadical(int k)
          Gets the radical value of an atom.
 int[] getSSSRBondSet()
          Deprecated. please use getSSSRBondSetInLong() instead.
 long[] getSSSRBondSetInLong()
          Get SSSR bond bitsets in long 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.
protected  int getSubGraphCount()
          Gets the number of all "submolecules".
 MoleculeGraph[] getSubGraphs()
          Gets all "submolecules".
protected  void getSubGraphs(MoleculeGraph[] m, int off)
          Gets all "submolecules".
 double[] getVisibleCoords(MolAtom ma)
          Returns the coordinates of the given atom (contained in the molecule).
 boolean hasAtomSet()
          Tests whether the molecule graph has atom sets.
 boolean hasBondSet()
          Tests whether the molecule graph has atom sets.
 boolean hasExplicitLonePairs()
          Tests whether the molecule has implicit explici lone pair nodes.
 boolean hasExtraLabelSet()
           
 boolean hasImplicitH()
          Indicates, whether the molecule has implicit hydrogen atoms.
 boolean hasValenceError()
          Determines if this molecule has a valence error on any of its 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 isQuery()
          Indicates if the molecule has query features.
 boolean isRingBond(int idx)
          Is this bond in ring?
 boolean isSimilarTo(CGraph g)
          Checks if the graph is similar to another graph.
 boolean isValidLinkNode(int linkAtomIdx, int outer1, int outer2)
          Checks whether the specified link atom is valid or not.
protected  void makeItSimilar(CGraph g)
          Copies some properties of this molecule to the other one specified as argument.
 void mergeNodes(CNode that, CNode a)
          Merges edges of a node with another node, then adds the node to the molecule.
 void moveTo(DPoint3 o)
          Move the molecule.
 CGraph newInstance()
          Creates a new MoleculeGraph object.
 boolean partialClean(int dim, int[] fixed, java.lang.String opts)
          Calculates atom coordinates by using fixed atoms.
 MPropertyContainer properties()
          Gets the property container.
 void qpropCheck(java.util.Vector v)
          Check for query property errors.
 void removeExplicitLonePairs()
          Removes explicit lone pairs.
 void removeNode(CNode node, int cleanupFlags)
          Removes a node and its edges with extra options.
 void removeNode(int i, int cleanupFlags)
          Removes a node and its edges with extra options.
protected  java.lang.Object[] restoreCache(int n)
          Restores caches like connection table, bond table, etc.
 void revalidateCoordDependentProps()
          Revalidate coordinate dependent properties.
protected  java.lang.Object[] saveCache(int n)
          Saves caches like connection table, bond table, etc.
 void setAbsStereo(boolean c)
          Sets the absolute stereoconfiguration flag.
 void setAtomSetSeqs(int id)
          Sets the set sequence number of all atoms.
 void setBondSetSeqs(int id)
          Sets the set sequence number of all bonds.
 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 setEdge(int i, CEdge edge)
          Sets the edge at the specified index.
 void setLinkNodeDefaultOuters(MolAtom atom)
          Sets link node outer atoms to default values, if they are not set yet; making sure that the resulting link node configuration is valid.
 void setLocation(DPoint3 o)
          Set the origin of the molecule.
protected  void setNode0(int i, CNode node)
          Sets the node at the specified index.
 boolean setParity(int[] p)
          Change the bonds flag (UP/DOWN) connected to the whole molecule to achieve the specified parity array.
 boolean setParity(int[] p, boolean useActualWedges)
          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)
          Deprecated. as of Marvin 4.0, replaced by setAtomSetSeq
 boolean stereoClean()
          Reset the wedges of the molecule, based on the actual parity information.
 java.lang.String toString()
          Overrides CGraph.toString() to ease debugging.
 void transform(CTransform3D t)
          Apply a transformation matrix to the atomic coordinates.
 void transform(CTransform3D t, boolean incg)
          Apply a transformation matrix to the atomic coordinates.
protected  void updateDim(MoleculeGraph m)
          Updates the dimensions when fusing two structures.
 void valenceCheck()
          Check valence and query property errors for each atoms.
 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, findComponentIds, findComponentIds, findEdge, findFrag, findFragById, findFrags, findNode, fuse, getBtab, getCtab, getEdge, getEdgeCount, getForefather, getFragCount, getFragIds, getGrinv, getGrinvCC, getLock, getNode, getNodeCount, getParent, getSmallestRingSizeForIdx, getSSSR, incGrinvCC, incGrinvCCOnly, indexOf, indexOf, insertEdge, insertNode, insertNullEdges, insertNullNodes, isEmpty, isRealNodeParent, isRing, isSymmetric, pack, regenCtabs, regenEdges, removeAll, removeAllEdges, removeEdge, removeEdge, removeEdge, removeEdge, removeNode, removeNode, replaceEdge, resetCtab, resetGrinvInParents, setGrinvCC, setNode, sortEdgesAccordingTo
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AROM_BASIC

public static final int AROM_BASIC
Basic aromatization.

Since:
Marvin 4.1, 12/09/2005
See Also:
aromatize(int), Constant Field Values

AROM_CHEMAXON

public static final int AROM_CHEMAXON
Deprecated. please use AROM_BASIC instead. Chemaxon aromatization.

Since:
Marvin 3.4, 05/10/2004
See Also:
aromatize(int), Constant Field Values

AROM_GENERAL

public static final int AROM_GENERAL
General (Daylight conform) aromatization.

Since:
Marvin 4.1, 12/09/2005
See Also:
aromatize(int), Constant Field Values

AROM_DAYLIGHT

public static final int AROM_DAYLIGHT
Deprecated. please use AROM_GENERAL instead. Daylight aromatization (modified Huckel rule).

Since:
Marvin 3.4, 05/10/2004
See Also:
aromatize(int), Constant Field Values

INVALID_LINKNODE_MESSAGE

public static final java.lang.String INVALID_LINKNODE_MESSAGE
See Also:
Constant Field Values

DIM_MASK

protected static final int DIM_MASK
Dimension bits in flags.

See Also:
flags, Constant Field Values

RMCLEANUP_STEREO

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

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

RMCLEANUP_MOBJECT

public static final int RMCLEANUP_MOBJECT
Remove graphics objects containing the removed node.

Since:
Marvin 4.1, 03/07/2006
See Also:
removeNode(CNode, int), removeNode(int, int), CGraph.RMCLEANUP_NONE, CGraph.RMCLEANUP_ALL, CGraph.RMCLEANUP_EDGES, Constant Field Values

GRINV_NOHYDROGEN

public static final int GRINV_NOHYDROGEN
Graph invariant option for ignoring explicit hydrogens.

See Also:
getGrinv(int[], int), Constant Field Values

GRINV_STEREO

public static final int GRINV_STEREO
Graph invariant option for calculating graph invariants using stereo information. (Chirality & E/Z)

See Also:
getGrinv(int[], int), Constant Field Values

GRINV_OLDSTEREO

public static final int GRINV_OLDSTEREO
Graph invariant option for calculating graph invariants using the old stereo method. (Chirality only.)

See Also:
getGrinv(int[], int), Constant Field Values

GRINV_VALUE_OPTIONS

public static final int GRINV_VALUE_OPTIONS
Unified mask of graph invariant options affecting grinv value.

See Also:
Constant Field Values

GRINV_DONT_STORE

public static final int GRINV_DONT_STORE
Graph invariant option to instruct that the graph invariant should not be stored in MoleculeGraph.

See Also:
getGrinv(int[], int), Constant Field Values

CACHE_REMOVE_GRINVMODULE

public static final int CACHE_REMOVE_GRINVMODULE
Cache removal option for remove module used in graph invariant calculation.

See Also:
clearCachedInfo(int), Constant Field Values

CACHE_REMOVE_PARITYMODULE

public static final int CACHE_REMOVE_PARITYMODULE
Cache removal option for remove module used in parity calculation.

See Also:
clearCachedInfo(int), Constant Field Values

CACHE_REMOVE_AROMATAMODULE

public static final int CACHE_REMOVE_AROMATAMODULE
Cache removal option for remove module used in aromatization.

See Also:
clearCachedInfo(int), Constant Field Values

CACHE_REMOVE_SSSRMODULE

public static final int CACHE_REMOVE_SSSRMODULE
Cache removal option for remove module used in sssr.

See Also:
clearCachedInfo(int), Constant Field Values

MIN_RING_SIZE_FOR_TRANS_DB

public static final int MIN_RING_SIZE_FOR_TRANS_DB
The minimal size of the ring for the existence of TRANS double bond.

See Also:
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


propertyContainer

protected transient MPropertyContainer propertyContainer
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()
Construct a molecule.

Method Detail

getDocument

public MDocument getDocument()
Gets the document object.

Returns:
a Marvin document object
Since:
Marvin 3.3

getParentDocument

protected MDocument getParentDocument()
Gets the document or the document of the parent graph. Moved to separate method because R-groups in RgMolecule should not have a normal document parent. If two R-groups would have a common document parent, then their bounds would be determined incorrectly because the graphics objects are common.

Returns:
the parent document
Since:
Marvin 4.1.1, 08/23/2006

getDocumentForChild

protected MDocument getDocumentForChild(MoleculeGraph g)
Gets the parent document for a child graph.

Parameters:
g - the child graph or this
Returns:
the parent document
Since:
Marvin 4.1.1, 08/23/2006

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

public void removeNode(CNode node,
                       int cleanupFlags)
Removes a node and its edges with extra options. This method is for internal use only. Use CGraph.removeNode(CNode) instead unless you are sure what you are doing.

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

removeNode

public void removeNode(int i,
                       int cleanupFlags)
Removes a node and its edges with extra options. This method is for internal use only. Use CGraph.removeNode(CNode) instead unless you are sure what you are doing.

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

setNode0

protected void setNode0(int i,
                        CNode node)
Sets the node at the specified index.

Overrides:
setNode0 in class CGraph
Parameters:
i - node index
node - new node reference

setEdge

public void setEdge(int i,
                    CEdge edge)
Sets the edge at the specified index.

Overrides:
setEdge in class CGraph
Parameters:
i - edge index
edge - the edge reference

setAtomSetSeqs

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

Parameters:
id - the set sequence number
Since:
Marvin 4.0

setBondSetSeqs

public final void setBondSetSeqs(int id)
Sets the set sequence number of all bonds.

Parameters:
id - the set sequence number
Since:
Marvin 4.0

setSetSeqs

public final void setSetSeqs(int id)
Deprecated. as of Marvin 4.0, replaced by setAtomSetSeq

Parameters:
id - the set sequence number
Since:
Marvin 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)

addExplicitLonePairs

public void addExplicitLonePairs()
Adds explicit lone pairs.

Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
Marvin 3.5, 07/06/2004

removeExplicitLonePairs

public void removeExplicitLonePairs()
Removes explicit lone pairs.

Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
Marvin 3.5, 07/06/2004

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:
Marvin 3.1
See Also:
MolAtom.LONELY_H, MolAtom.ISOTOPE_H, MolAtom.CHARGED_H, MolAtom.RADICAL_H, MolAtom.MAPPED_H, MolAtom.WEDGED_H, MolAtom.HCONNECTED_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)
Deprecated. Please use getGrinv(int[], int) instead.

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:
Marvin 3.3
See Also:
getGrinv(int[], int)

getGrinv

public int getGrinv(int[] gi,
                    int options)
Gets the graph invariants (canonical labels). Same like getGrinv() but depending on the options chiral info is also added to invariants (needed for unique SMILES) and/or hydrogens are ignored. In the latter case -1 graph invariant is assigned to explicit hydrogens.

Parameters:
gi - output array, its length must be equal to the number of atoms
options - options for the generation of graph invariants
Returns:
the number of different graph invariants
Throws:
java.lang.SecurityException - the GraphInvariants module cannot be loaded because of security reasons (firewall)
Since:
Marvin 4.0 7/08/2005
See Also:
GRINV_NOHYDROGEN, GRINV_STEREO, GRINV_DONT_STORE

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:
Marvin 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:
Marvin 3.1

fuse0

protected void fuse0(CGraph g)
Add the atoms and bonds of another molecule.

Overrides:
fuse0 in class CGraph
Parameters:
g - the other molecule

updateDim

protected final void updateDim(MoleculeGraph m)
Updates the dimensions when fusing two structures.

Parameters:
m - the other molecule
Since:
Marvin 4.0.2, 08/26/2005

mergeNodes

public void mergeNodes(CNode that,
                       CNode a)
Merges edges of a node with another node, then adds the node to the molecule.

Overrides:
mergeNodes in class CGraph
Parameters:
that - the node
a - the other node

hasValenceError

public boolean hasValenceError()
Determines if this molecule has a valence error on any of its atoms.

Returns:
true if there is an atom with valence error, false if there is no valence error
Since:
Marvin 4.1
See Also:
valenceCheck(), MolAtom.hasValenceError()

valenceCheck

public void valenceCheck()
Check valence and query property errors for each atoms. During this check implicit hydrogens are calculated and the valence error flag is set in case of error.

See Also:
MolAtom.valenceCheck(), MolAtom.getImplicitHcount(), hasValenceError()

valenceCheck

public void valenceCheck(java.util.Vector v)
Check valence and query property errors. Check all the atoms if the argument is null. During this check implicit hydrogens are calculated and the valence error flag is set in case of error.

Parameters:
v - contains the atoms to check
See Also:
MolAtom.valenceCheck(), 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

isSimilarTo

public boolean isSimilarTo(CGraph g)
Checks if the graph is similar to another graph.

Overrides:
isSimilarTo in class CGraph
Returns:
true if the graphs are similar, false otherwise
Since:
Marvin 3.4.1, 07/21/2004
See Also:
CNode.haveEqualProperties(CNode), CNode.haveSimilarEdges(CNode)

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

getName

public java.lang.String getName()
Gets the molecule name. This method is implemented for the ReadableMolecule interface but it returns empty string in this basic implementation.

Specified by:
getName in interface chemaxon.struc.ReadableMolecule
Returns:
empty string
Since:
Marvin 4.1, 05/28/2006

properties

public MPropertyContainer properties()
Gets the property container.

Specified by:
properties in interface chemaxon.struc.ReadableMolecule
Returns:
the property container
Since:
Marvin 4.1, 05/28/2006

revalidateCoordDependentProps

public void revalidateCoordDependentProps()
Revalidate coordinate dependent properties. This method should be called at molecule import, after all atomic coordinates and bonds are parsed.

Since:
Marvin 4.1, 08/03/2006

getAtomCount

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

Specified by:
getAtomCount in interface chemaxon.struc.ReadableMolecule
Returns:
number of atoms

getBondCount

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

Specified by:
getBondCount in interface chemaxon.struc.ReadableMolecule
Returns:
number of bonds

getCharge

public int getCharge(int k)
Gets the charge of an atom.

Specified by:
getCharge in interface chemaxon.struc.ReadableMolecule
Parameters:
k - the atom index
Returns:
the charge
Since:
Marvin 4.1, 05/28/2006

getRadical

public int getRadical(int k)
Gets the radical value of an atom.

Specified by:
getRadical in interface chemaxon.struc.ReadableMolecule
Parameters:
k - the atom index
Returns:
the radical value
Since:
Marvin 4.1, 05/28/2006

getHybridizationState

public int getHybridizationState(int k)
Gets the hybridization state.

Specified by:
getHybridizationState in interface chemaxon.struc.ReadableMolecule
Parameters:
k - the atom index
Returns:
the hybridization state
Since:
Marvin 4.1, 05/28/2006
See Also:
ReadableMolecule.HS_UNKNOWN, ReadableMolecule.HS_S, ReadableMolecule.HS_SP, ReadableMolecule.HS_SP2, ReadableMolecule.HS_SP3

getMassno

public int getMassno(int k)
Gets the mass number of an atom. In the case of an element it returns 0, because it is a mix of isotopes having different mass numbers.

Specified by:
getMassno in interface chemaxon.struc.ReadableMolecule
Parameters:
k - the atom index
Returns:
the mass number, or zero if not specified
Since:
Marvin 4.1, 05/28/2006

getNeighborCount

public int getNeighborCount(int k)
Gets the number of neighbors of an atom.

Specified by:
getNeighborCount in interface chemaxon.struc.ReadableMolecule
Parameters:
k - the atom index
Returns:
the number of neighbors
Since:
Marvin 4.1, 05/28/2006

getNeighbor

public int getNeighbor(int k,
                       int i)
Gets the index of a neighbor of an atom.

Specified by:
getNeighbor in interface chemaxon.struc.ReadableMolecule
Parameters:
k - the atom index
i - the neighbor index
Returns:
the atom index of the i-th neighbor of atom k
Since:
Marvin 4.1, 05/28/2006

getAtom

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

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

getBond

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

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

getNodeVector

public java.util.Vector getNodeVector()
Creates an array of atoms.

Overrides:
getNodeVector in class CGraph
Returns:
array of atom objects

getEdgeVector

public java.util.Vector getEdgeVector()
Creates an array of atoms.

Overrides:
getEdgeVector in class CGraph
Returns:
array of atom objects

getAtomArray

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

Returns:
array of atom objects
Since:
Marvin 2.6

getEdgeArray

public final CEdge[] getEdgeArray()
Creates an array of bonds.

Overrides:
getEdgeArray in class CGraph
Returns:
array of edge objects
Since:
Marvin 3.5, 09/02/2004

getBondArray

public MolBond[] getBondArray()
Creates an array of bonds.

Returns:
array of bond objects
Since:
Marvin 3.5, 07/14/2004

calcCenter

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

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

calcOutRect

public DPoint3 calcOutRect()
Calculates the outer rectangle.

Returns:
the outer rectangle (x, y, and z direction width of the outer rectangle)
Since:
Marvin 4.1

calcOutRect

public void calcOutRect(DPoint3 p)
Calculates the outer rectangle.

Parameters:
p - reference to the object that will hold the result (x, y, and z direction width of the outer rectangle)
Since:
Marvin 4.1

calcOutRectCenter

public DPoint3 calcOutRectCenter()
Calculates the center of the outer rectangle.

Returns:
the center
Since:
Marvin 4.1

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:
Marvin 3.0

calcHeight

public double calcHeight()
Calculates the molecule height.

Returns:
the molecule height
Since:
Marvin 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:
Marvin 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:
Marvin 2.7
See Also:
orix

setLocation

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

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

moveTo

public void moveTo(DPoint3 o)
Move the molecule.

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

transform

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

Specified by:
transform in interface MTransformable
Parameters:
t - the transformation matrix
Since:
Marvin 2.7

transform

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

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

getPoints

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

Returns:
atom coordinates array
Since:
Marvin 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)

toString

public java.lang.String toString()
Overrides CGraph.toString() to ease debugging. Returns a string consisting of the classname (without the package name!), the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. If the graph is not empty and it has more than one nodes, then the string also contains the number of nodes and edges in "[Na,Mb]" form. If there is only one atom, then its symbol appears between the square brackets.

Overrides:
toString in class CGraph
Returns:
a string representation of the object

clone

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

Specified by:
clone in class CGraph
Returns:
the copy

getParity

public 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)

getLocalParity

public int getLocalParity(int i)
Computes the local 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. The molecule symmetry is not checked, so even an atom with same ligands can have parity. Leaves the imported parity unchanged. Contracted sgroups must be expanded to achieve consistent result.

Parameters:
i - the index of the atom whose parity is to be determined
Returns:
PARITY_ODD or PARITY_EVEN for atoms of odd or even parity, PARITY_EITHER for atoms with wiggly bond 0 for atoms whose parity is unspecified or not known.
Throws:
java.lang.SecurityException - the Parity module cannot be loaded because of security reasons (firewall)
See Also:
StereoConstants.PARITY_ODD, StereoConstants.PARITY_EVEN, StereoConstants.PARITY_EITHER, 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. Take care of expanding the molecule if neccessary.

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

setParity

public boolean setParity(int[] p,
                         boolean useActualWedges)
Change the bonds flag (UP/DOWN) connected to the whole molecule to achieve the specified parity array. Take care of expanding the molecule if neccessary.

Parameters:
p - the parity for each atom in the molecule
useActualWedges - use actual wedge setup and change it if neccessary
Returns:
true if successful
Since:
Marvin 3.5, 12/18/2004
See Also:
StereoConstants.PARITY_ODD, StereoConstants.PARITY_EVEN, isAbsStereo(), setAbsStereo(boolean), MolBond.UP, MolBond.DOWN

getChirality

public 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. Take care of expanding the molecule if neccessary.

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 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(), for detailed examples.

getStereo2

public 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

Returned values for the four Carbons ("O" means set flag):

Dihedral Returned flags Remark
CIS TRANS CTUNSPEC
SMARTS bonds:
C/C=C/C - O -
C/C=C\C O - -
CC=CC O O -
C/?C=C/C - O O
C/?C=C\C O - O
ISIS bonds:
C-C=C-C O O - 180 degrees
C-C X C-C O O - "Cis" or "Trans" bond
C/C="C/T?"=C/C - O O "Not Cis" bond
C/C="C/T?"=C\C O - O "Not trans" bond
C-C="C/T?"=C-C O O O 180 degrees
See Also:
StereoConstants.CTUMASK, MolBond.calcStereo2()

getStereo2

public 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(), for detailed examples.

getStereo2

public 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(), for detailed examples.

getStereo2

public 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. For ring bonds 0 is returned. Not checking atom equivalences using graph invariants.

Parameters:
b - the bond
Returns:
the stereo flags
Since:
Marvin 4.1 4/13/2006
See Also:
StereoConstants.CTUMASK, MolBond.calcStereo2(), for detailed examples.

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(), for detailed examples.

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(), for detailed examples.

canBeCT

public 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.

canBeCT

public boolean canBeCT(int i2,
                       int i3,
                       boolean grcheck)
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
grcheck - true if check atom equivalences using graph invariants
Returns:
true if this is a double bond that can be either CIS, TRANS or EITHER, false else.
Since:
Marvin 4.0 1/23/2005

getLonePairCount

public int getLonePairCount(int i)
Gets the number of lone pairs.

Parameters:
i - atom index
Returns:
the number of lone pairs
Since:
Marvin 3.5, 09/29/2004

aromatize

public void aromatize(boolean a)
               throws java.lang.SecurityException
Aromatize (using the default general aromatization method) or dearomatize molecule.

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

aromatize

public final void aromatize()
Aromatize molecule using the default general aromatization method. Only single or double bonds are changed to aromatic, aromatic bonds are not changed.

Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
Marvin 3.4, 05/10/2004
See Also:
AROM_GENERAL

dearomatize

public void dearomatize()
Dearomatize molecule.

Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
Marvin 3.4, 05/10/2004

aromatize

public void aromatize(int method)
Aromatize molecule. Only single or double bonds are changed to aromatic, aromatic bonds are not changed.

Parameters:
method - specifies the algorithm for aromatization. Possible values:
  • AROM_BASIC - Basic aromatization
  • AROM_GENERAL - General (Daylight compatible) aromatization
Limits:
  • AROM_BASIC: only up to 18 membered rings are checked
  • AROM_GENERAL: no ring system limit
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
Marvin 3.4
See Also:
AROM_BASIC, AROM_GENERAL, Document about aromatization

calcHybridization

public void calcHybridization()
Calculates and sets hybridazation state for each atom. The calculation is based on simple rules that cannot be customized in the present implementation. However, setHybridizationState( int ) can be called to set the appropriate value directly.

Since:
Marvin 3.5
See Also:
LonePairCounter

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.

Returns:
the molecular weight

getExactMass

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

Returns:
the molecular exact weight

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.

Specified by:
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:
Marvin 3.0, 11/11/2002

getSubGraphs

public final MoleculeGraph[] getSubGraphs()
Gets all "submolecules".

Since:
Marvin 4.1.2
See Also:
getSubGraphCount()

getSubGraphCount

protected int getSubGraphCount()
Gets the number of all "submolecules". Submolecules are R-groups and the root structure in case of an RgMolecule, reactants, products and agents of an RxnMolecule etc.

Returns:
the number of submolecules
Since:
Marvin 4.1.2
See Also:
getSubGraphs(MoleculeGraph[], int)

getSubGraphs

protected void getSubGraphs(MoleculeGraph[] m,
                            int off)
Gets all "submolecules".

Parameters:
m - the output array
off - offset
Since:
Marvin 4.1.2
See Also:
getSubGraphs(), getSubGraphCount()

addAtomsAndBondsTo

protected void addAtomsAndBondsTo(MoleculeGraph s)
Adds all atoms and bonds to the specified molecule.

Parameters:
s - the selection molecule
Since:
Marvin 4.1, 11/25/2005

hasExplicitLonePairs

public boolean hasExplicitLonePairs()
Tests whether the molecule has implicit explici lone pair nodes.

Returns:
true if it has lone pairs, false otherwise
Since:
3.5.1, 11/24/2004

hasImplicitH

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

Returns:
true, if the molecule has at least one implicit hydrogen atom
Since:
Marvin 3.3, 01/14/2004

hasAtomSet

public boolean hasAtomSet()
Tests whether the molecule graph has atom sets.

Returns:
true if there are atom sets, false otherwise
Since:
Marvin 4.0, 03/02/2005

hasBondSet

public boolean hasBondSet()
Tests whether the molecule graph has atom sets.

Returns:
true if there are atom sets, false otherwise
Since:
Marvin 4.0, 03/02/2005

hasExtraLabelSet

public boolean hasExtraLabelSet()

clean

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

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

partialClean

public boolean partialClean(int dim,
                            int[] fixed,
                            java.lang.String opts)
Calculates atom coordinates by using fixed atoms. Internal use only. Works only in 2D.

Parameters:
dim - dimensions
fixed - atom indexes to be fixed
opts - cleaning options
Returns:
true for success, false if an error occured
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
Marvin 3.5.2, 01/01/2005

clean

public boolean clean(int dim,
                     java.lang.String opts,
                     chemaxon.marvin.util.MProgressMonitor pmon)
Calculates atom coordinates.

Parameters:
dim - dimensions
opts - cleaning options
pmon - progress monitor or null
Returns:
true for success, false if an error occured
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
Marvin 3.4, 05/06/2004
See Also:
clean(int, java.lang.String)

stereoClean

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

Returns:
true if succesful

getAromrings

public int[][] getAromrings()
Deprecated. please use getAromaticAndAliphaticRings instead.

Get aromatic ring atom indexes from basic aromatization. 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()
Deprecated. please use getAromaticAndAliphaticRings instead.

Get alpihatic ring atom indexes from basic aromatization. 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)
Deprecated. please use getAromaticAndAliphaticRings instead.

Get aromatic ring atom indexes from basic aromatization. Only rings smaller then the given size are examined.

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

getNonAromrings

public int[][] getNonAromrings(int size)
Deprecated. please use getAromaticAndAliphaticRings instead.

Get alpihatic ring atom indexes from basic aromatization. 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.

getAromaticAndAliphaticRings

public int[][][] getAromaticAndAliphaticRings(int aromatizationType,
                                              boolean onlyAromrings,
                                              boolean aromatize,
                                              int maxRingSize,
                                              int ringsLimit)
Get aromatic and or aliphatic ring atom indexes. Note: If you want to get the aliphatic rings also, get first them by using getAliphaticrings and then the aromatic ones.

Parameters:
aromatizationType - use aromatization:
  • 0 - No aromatization. The molecule is used as it is.
  • AROM_BASIC - basic aromatization
  • AROM_GENERAL - general aromatization
onlyAromrings - get only the aromatic rings (Aromatic ring detection is faster than calculating Aliphatic and Aromatic rings in case BASIC aromatization, in case of GENERAL aromatization there is no difference in the speed),
aromatize - whether to set the bonds to aromatic (true), or keep the original form (false),
maxRingSize - the maximum ring size during ring detection (0: no limit)
ringsLimit - limit of the number of rings (0: no limit)
Returns:
the aromatic ring atom indexes in the array 0th position, the aliphatic ring atom indexes in the array 1st position
Since:
Marvin 4.1
See Also:
AROM_BASIC, AROM_GENERAL

getSSSRBondSet

public int[] getSSSRBondSet()
Deprecated. please use getSSSRBondSetInLong() instead.

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.

getSSSRBondSetInLong

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

Returns:
the SSSR ring bond indexes in long array.
Since:
Marvin 4.1

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:
Marvin 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:
Marvin 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

getExplicitHcount

public int getExplicitHcount()
Gets the total number of explicit hydrogens attached to the molecule.

Returns:
the explicit hydrogen count
Since:
Marvin 3.4

findAtomClone

public MolAtom findAtomClone(MolAtom a)
Finds the clone of an atom.

Parameters:
a - the original atom
Returns:
the clone or null if not found
Since:
Marvin 3.4.1, 07/06/2004

isValidLinkNode

public boolean isValidLinkNode(int linkAtomIdx,
                               int outer1,
                               int outer2)
Checks whether the specified link atom is valid or not. Invalid link atoms are those where repetition is impossible due to rings.

Parameters:
linkAtomIdx - atom index to be set to link atom.
outer1 - outer bond to be set by setLinkNodeOuterAtom(0)
outer2 - outer bond to be set by setLinkNodeOuterAtom(1)
Returns:
whether repetition is possible on the given atom and outer bonds.
Since:
Marvin 4.0 12/29/2004

setLinkNodeDefaultOuters

public void setLinkNodeDefaultOuters(MolAtom atom)
Sets link node outer atoms to default values, if they are not set yet; making sure that the resulting link node configuration is valid.

Parameters:
atom - Atom to set to link node.
Throws:
java.lang.IllegalArgumentException - if it is an invalid link node configuration.
Since:
Marvin 4.0 12/29/2004
See Also:
MolAtom.setLinkNodeDefaultOuters(), MolAtom.setLinkNodeOuterAtom(int, int)

getVisibleCoords

public double[] getVisibleCoords(MolAtom ma)
Returns the coordinates of the given atom (contained in the molecule).

Parameters:
ma - The atom to be queried.
Returns:
The coordinates of ma.
Since:
Marvin 4.0 8/07/2005

saveCache

protected java.lang.Object[] saveCache(int n)
Saves caches like connection table, bond table, etc.

Overrides:
saveCache in class CGraph
Since:
Marvin 3.4

restoreCache

protected java.lang.Object[] restoreCache(int n)
Restores caches like connection table, bond table, etc.

Overrides:
restoreCache in class CGraph
Since:
Marvin 3.4

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:
Marvin 3.3

adjustMultiChiralFlag

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

Since:
Marvin 3.3

isQuery

public boolean isQuery()
Indicates if the molecule has query features.

Returns:
true if the molecule has query features
Since:
Marvin 4.0 04/02/2005

clearCachedInfo

public void clearCachedInfo(int options)
Deletes the cached information depending on the given options.

Overrides:
clearCachedInfo in class CGraph
Parameters:
options - options for the cache clearing
Since:
Marvin 4.0.2 09/20/2005
See Also:
CACHE_REMOVE_GRINVMODULE, CACHE_REMOVE_PARITYMODULE, CACHE_REMOVE_AROMATAMODULE, CACHE_REMOVE_SSSRMODULE

getLocalChirality

public int getLocalChirality(int idx,
                             int[] ch)
Get local chirality. For internal use only.

Parameters:
idx - atom index
ch - already calculated chiralities
Returns:
the local chirality: CHIRALITY_R or CHIRALITY_S or PARITY_EITHER.
Since:
Marvin 4.0.2
See Also:
CACHE_REMOVE_GRINVMODULE

arrangeComponents

public void arrangeComponents()
Arranges molecule components (reactants, agents, products, R-group definitions) nicely.

Since:
Marvin 4.1