chemaxon.struc
Class RxnMolecule

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

public class RxnMolecule
extends Molecule

Reaction.

Since:
Marvin 2.9
Version:
4.1.2, 09/20/2006
Author:
Peter Csizmadia
See Also:
Serialized Form

Field Summary
static int AGENTS
          "Agent" structure type.
static int PRODUCTS
          "Product" structure type.
static int REACTANTS
          "Reactant" structure type.
static int RGROUPED
          Add R-groups to component structure.
static int TYPE_COUNT
          Number of structure types.
static int TYPE_MASK
          Component type mask.
 
Fields inherited from class chemaxon.struc.Molecule
RMCLEANUP_FROMSGROUPS, RMCLEANUP_SGROUPATOMS
 
Fields inherited from class chemaxon.struc.MoleculeGraph
AROM_BASIC, AROM_CHEMAXON, AROM_DAYLIGHT, AROM_GENERAL, CACHE_REMOVE_AROMATAMODULE, CACHE_REMOVE_GRINVMODULE, CACHE_REMOVE_PARITYMODULE, CACHE_REMOVE_SSSRMODULE, DIM_MASK, flags, GRINV_DONT_STORE, GRINV_NOHYDROGEN, GRINV_OLDSTEREO, GRINV_STEREO, GRINV_VALUE_OPTIONS, INVALID_LINKNODE_MESSAGE, isMultiChiral, MIN_RING_SIZE_FOR_TRANS_DB, orix, oriy, oriz, propertyContainer, RMCLEANUP_MOBJECT, RMCLEANUP_STEREO
 
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
RxnMolecule()
          Create a reaction.
 
Method Summary
 void add(CEdge e)
          Adds a bond to a reactant, product, agent.
 void add(CNode node)
          Adds an atom to a reactant, product or agent structure.
 void addComponent(Molecule m, int type)
          Adds a reactant, product or agent.
 void addComponent(Molecule m, int type, boolean beNew)
          Adds a reactant, product or agent.
 void addStructure(Molecule m, int type)
          Deprecated. as of Marvin 4.1, replaced by addComponent(Molecule, int)
 void addStructure(Molecule m, int type, boolean beNew)
          Deprecated. as of Marvin 4.1, replaced by addComponent(Molecule, int, boolean)
 void clearForImport(java.lang.String fmt)
          Clear the edges vector and the properties.
 void clonecopy(CGraph g)
          Make another molecule identical to this one.
 void clonelesscopy(CGraph g)
          Copy to selection.
 Molecule cloneMolecule()
          Make an identical copy of the molecule.
 boolean contains(java.lang.Object o)
          Checks if a reactant, agent or product structure contains the specified node or edge.
 int[][] createBHtab()
          Creates the graph union's bond table extended with implicit hydrogen atoms.
 int[][] createCHtab()
          Creates the graph union's connection table extended with implicit hydrogen atoms.
static RxnMolecule createReaction(Molecule mol, DPoint3[] arw, int art)
          Creates a reaction.
static double determineArrowDistance(double x, double y, double z, DPoint3[] ar)
          Project the point (x,y,z) to the line of the reaction arrow 'ar'.
 int determineType(double x, double y, double z)
          Determines whether a point should be in a reactant, in a product or in an agent.
protected  void fillSelectionMolecule(SelectionMolecule s)
          Adds all atoms and bonds of the root structure and the R-groups to the specified molecule.
 void fuse(CGraph graph)
          Add the atoms and bonds of another molecule.
protected  void fuse0(CGraph graph)
          Add those nodes and edges of a graph that are not already elements.
 Molecule getAgent(int i)
          Gets an agent.
 int getAgentCount()
          Gets the number of agents.
 int[][] getBtab()
          Gets the bond table for the graph union.
 DPoint3 getCenter(int type, int i)
          Gets the geometrical center of a reaction component.
 Molecule getComponent(int flags, int i)
          Gets a reactant, product or agent.
 Molecule getComponent(long id)
          Gets a reactant, product or agent.
 int getComponentCount(int type)
          Gets the number of reactants, products or agents.
 int getComponentFlags(long id)
          Gets the reaction component type flags from the ID.
 long getComponentID(MolAtom a)
          Gets the reaction component ID of an atom.
 long getComponentID(MolBond b)
          Gets the reaction component ID of a bond.
 long getComponentID(Molecule m)
          Gets the ID of a reaction component.
 int getComponentIndex(long id)
          Gets the reactant, product or agent index from the ID.
 int getComponentType(long id)
          Gets the reaction component type from the ID.
 int[][] getCtab()
          Gets the connection table for the graph union.
 CEdge getEdge(int i)
          Gets an edge.
 int getEdgeCount()
          Gets the number of edges in the graph union.
 java.util.Vector getEdgeVector()
          Gets the edges.
 java.lang.String getFormula()
          Gets the molecular formula in Hill order.
 MoleculeGraph getGraphUnion()
          Gets a graph containing all the atoms and bonds.
protected  int[] getGrinv()
          Gets the graph invariants for the graph union.
 int getGrinv(int[] gi)
          Gets the graph invariants for the graph union.
 double getMass()
          Calculates the molecular weight of the molecule.
 CNode getNode(int i)
          Gets a node.
 int getNodeCount()
          Returns the number of nodes in the graph union.
 java.util.Vector getNodeVector()
          Gets the nodes.
 Molecule getProduct(int i)
          Gets a product.
 int getProductCount()
          Gets the number of products.
 Molecule getReactant(int i)
          Gets a reactant.
 int getReactantCount()
          Gets the number of reactants.
static RxnMolecule getReaction(CGraph g)
          Returns the reaction represented by the given molecule if exists, otherwise null.
 DPoint3[] getReactionArrow()
          Gets a two-element array containing the endpoints of the reaction arrow.
 int getReactionArrowType()
          Gets the reaction arrow type.
 java.lang.String getReactionArrowTypeName()
          Gets the reaction arrow type name.
 Molecule getStructure(int flags, int i)
          Deprecated. as of Marvin 4.1, replaced by getComponent(int, int)
 int getStructureCount(int type)
          Deprecated. as of Marvin 4.1, replaced by getComponentCount(int)
protected  int getSubGraphCount()
          Gets the number of all "submolecules".
protected  void getSubGraphs(MoleculeGraph[] arr, int off)
          Gets all "submolecules".
 boolean hasAtomSet()
          Tests whether the molecule graph has atom sets.
 boolean hasBondSet()
          Tests whether the molecule graph has atom sets.
 void implicitizeHydrogens(int f)
          Removes explicit bound Hydrogens from the graph and converts them to implicit.
 int indexOf(CEdge edge)
          Gets the index of the specified edge in the graph union.
 int indexOf(CNode node)
          Gets the index of the specified node in the graph union.
 boolean isAtom()
          A reaction molecule cannot represent an atom.
 boolean isBond()
          A reaction molecule cannot represent a bond.
 boolean isEmpty()
          Ask if the reaction is empty or not.
 boolean isIncompleteReaction()
          Check whether the reaction is incomplete or not.
 boolean isReaction()
          Checks if the structure represents a reaction or not.
protected  boolean isRealNodeParent()
          Reaction molecules cannot be real node parents.
protected  void makeItSimilar(CGraph g)
          Copies some properties of this molecule to the other one specified as argument.
 void mergeNodes(CNode that, CNode node)
          Merges bonds of an atom with another atom, then add the atom to the molecule.
 CGraph newInstance()
          Creates a new RxnMolecule object.
 void rebuildStructures()
          For each structure (reactant or product) determines whether it should be a reactant or a product depending on its the relative position to the reaction arrow.
 void rebuildStructures(DPoint3[] arw, int art)
          Sets the reaction arrow.
 void recalcReactionArrow()
          Recalculates the reaction arrow, forced recalculation.
 void regenEdges()
          Regenerate the edge vectors: remove their elements, then put the edge objects from the nodes into it.
 void removeAll()
          Remove all the atoms and bonds from the root structure, and from all the R-groups.
 void removeAllEdges()
          Removes all bonds from the reactants, products and agents.
 Molecule removeComponent(int flags, int i)
          Removes a reactant, product or agent.
protected  void removeEdge(CEdge edge, int cleanupFlags)
          Removes a bond from the reactants, products or agents.
protected  void removeEdge(int iu, int cleanupFlags)
          Removes an edge from a reactant, agent or product.
 void removeNode(CNode node, int cleanupFlags)
          Removes an atom from the reactants, products or agents.
 void removeNode(int iu, int cleanupFlags)
          Removes an atom from the reactants, products or agents.
 Molecule removeStructure(int flags, int i)
          Deprecated. as of Marvin 4.1, replaced by removeComponent(int, int)
 void replaceEdge(CEdge olde, CEdge newe)
          Replaces an edge by another one.
 void revalidateCoordDependentProps()
          Revalidate coordinate dependent properties.
 void setAbsStereo(boolean c)
          Sets the absolute stereoconfiguration flag for all the structures.
 void setDim(int d)
          Sets the dimension for all the structures.
 void setEdge(int iu, CEdge edge)
          Sets the edge at the specified index.
 void setLocation(DPoint3 p)
          Set the origin of the molecule.
 void setNode(int iu, CNode node)
          Sets the node at the specified index.
 void setReactionArrow()
          Sets the stored reaction arrow.
 void setReactionArrow(DPoint3[] arw)
          Sets the reaction arrow.
 void setReactionArrow0()
          Sets the stored reaction arrow 'arrowPoints' to its calculated value.
 void setReactionArrowType(int type)
          Sets the reaction arrow type.
 void setReactionArrowType(java.lang.String name)
          Sets the reaction arrow type from type name.
 void setSgroupParent(MolAtom a, Sgroup sg, boolean set)
          Sets or unsets an S-group as a parent of an atom in reactants, products or agents.
 Molecule simplifyIncompleteReactionToMolecule()
          Simplify a reaction to a molecule if possible.
 void sortEdgesAccordingTo(CEdge[] order)
          Sort edges in the same order as they appear in the specified array.
 void splitDisconnectedComponent(int type, int index)
          Replaces a disconnected reaction component by its connected fragments in the structure array.
 void splitDisconnectedComponent(long id)
          Replaces a disconnected reaction component by its connected fragments in the structure array.
 void transform(CTransform3D t, boolean incg)
          Apply a transformation matrix to the atomic coordinates and the reaction arrow.
protected  void transformReactionArrow(CTransform3D t)
          Apply a transformation matrix to the reaction arrow.
 
Methods inherited from class chemaxon.struc.Molecule
addNode0, addSgroupClones, addSgroupsOf, aromatize, bondlength, clean, cleanSgroups, clear, clearExtraLabels, clearProperties, clone, clonecopyWithoutSgroups, cloneMoleculeWithDocument, contractSgroups, convertToFrags, dearomatize, draw, endReuse, expandSgroups, expandSgroups, exportToBinFormat, exportToFormat, exportToObject, findContractableSgroup, findExpandableSgroup, findFrags, findFrags, findSgroupContaining, findSgroupOf, findSmallestSgroupContaining, getComment, getEndPosition, getGraphUnionAsSelection, getImageSize, getInputFormat, getName, getOrderedComponentSgroupCount, getProperty, getPropertyCount, getPropertyKey, getPropertyKeys, getPropertyObject, getSgroup, getSgroupArray, getSgroupCount, getSgroupLigands, getSimplifiedMolecule, getSortedSgroups, getStartPosition, getVisibleCoords, indexOf, isExpandable, isGUIContracted, isSgroup, newSelectionMolecule, postClean, removeAllSgroups, removeSgroupFromList, removeSgroupsOf, reparentSgroups, residueSymbolOf, residueTypeOf, reuseAtom, setComment, setEndPosition, setGUIContracted, setInputFormat, setName, setNode0, setProperty, setPropertyObject, setStartPosition, toBinFormat, toFormat, toObject, ungroupSgroup, ungroupSgroup, ungroupSgroups
 
Methods inherited from class chemaxon.struc.MoleculeGraph
addAtomsAndBondsTo, addExplicitLonePairs, adjustMultiChiralFlag, aromatize, aromatize, arrangeComponents, calcCenter, calcCenter, calcDehydrogenizedGrinv, calcHeight, calcHybridization, calcOutRect, calcOutRect, calcOutRectCenter, calcOutRectCenter, calcWidth, canBeCT, canBeCT, clean, clearCachedInfo, contains, createDehydrogenizedReadOnlyGraph, findAtomClone, getAromaticAndAliphaticRings, getAromrings, getAromrings, getAtom, getAtomArray, getAtomCount, getBond, getBondArray, getBondCount, getCharge, getChirality, getDesiredLength, getDesiredLength, getDim, getDocument, getDocumentForChild, getEdgeArray, getExactMass, getExplicitHcount, getGrinv, getGrinv, getHybridizationState, getImplicitHcount, getLocalChirality, getLocalParity, getLocation, getLonePairCount, getMassno, getNeighbor, getNeighborCount, getNonAromrings, getNonAromrings, getParentDocument, getParity, getPoints, getRadical, getSSSRBondSet, getSSSRBondSetInLong, getStereo2, getStereo2, getStereo2, getStereo2, getStereo2, getStereo2, getStereo2, getSubGraphs, hasExplicitLonePairs, hasExtraLabelSet, hasImplicitH, hasValenceError, hydrogenize, isAbsStereo, isMultiChiral, isQuery, isRingBond, isSimilarTo, isValidLinkNode, moveTo, partialClean, properties, qpropCheck, removeExplicitLonePairs, restoreCache, saveCache, setAtomSetSeqs, setBondSetSeqs, setChirality, setLinkNodeDefaultOuters, setParity, setParity, setParity, setSetSeqs, stereoClean, toString, transform, updateDim, valenceCheck, valenceCheck
 
Methods inherited from class chemaxon.struc.CGraph
addEdge0, addEdgeWithoutChangingIt, addNodeWithoutChangingIt, findComponentIds, findComponentIds, findEdge, findFrag, findFragById, findNode, getForefather, getFragCount, getFragIds, getGrinvCC, getLock, getParent, getSmallestRingSizeForIdx, getSSSR, incGrinvCC, incGrinvCCOnly, insertEdge, insertNode, insertNullEdges, insertNullNodes, isRing, isSymmetric, pack, regenCtabs, removeEdge, removeEdge, removeNode, removeNode, resetCtab, resetGrinvInParents, setGrinvCC
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_COUNT

public static final int TYPE_COUNT
Number of structure types. Currently 3: REACTANTS, PRODUCTS, AGENTS.

See Also:
Constant Field Values

REACTANTS

public static final int REACTANTS
"Reactant" structure type.

See Also:
getComponent(int, int), Constant Field Values

PRODUCTS

public static final int PRODUCTS
"Product" structure type.

See Also:
getComponent(int, int), Constant Field Values

AGENTS

public static final int AGENTS
"Agent" structure type.

See Also:
getComponent(int, int), Constant Field Values

RGROUPED

public static final int RGROUPED
Add R-groups to component structure.

Since:
Marvin 3.1
See Also:
Constant Field Values

TYPE_MASK

public static final int TYPE_MASK
Component type mask.

Since:
Marvin 3.1
See Also:
REACTANTS, PRODUCTS, AGENTS, Constant Field Values
Constructor Detail

RxnMolecule

public RxnMolecule()
Create a reaction.

Method Detail

isEmpty

public boolean isEmpty()
Ask if the reaction is empty or not.

Overrides:
isEmpty in class Molecule
Returns:
true if there are no reactants, products or agents

isAtom

public boolean isAtom()
A reaction molecule cannot represent an atom.

Overrides:
isAtom in class MoleculeGraph
Returns:
false

isBond

public boolean isBond()
A reaction molecule cannot represent a bond.

Overrides:
isBond in class MoleculeGraph
Returns:
false

isReaction

public boolean isReaction()
Checks if the structure represents a reaction or not.

Overrides:
isReaction in class Molecule
Returns:
true
Since:
Marvin 3.0

getFormula

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

Overrides:
getFormula in class MoleculeGraph
Returns:
the formula

getMass

public double getMass()
Calculates the molecular weight of the molecule. Always returns 0 for reactions

Overrides:
getMass in class MoleculeGraph
Returns:
the molecular weight

getReaction

public static RxnMolecule getReaction(CGraph g)
Returns the reaction represented by the given molecule if exists, otherwise null. The corresponding reaction molecule is either the molecule itself or its root structure.

Parameters:
g - the molecule graph
Returns:
the corresponding reaction molecule

getReactantCount

public int getReactantCount()
Gets the number of reactants.

Returns:
the number of reactants

getProductCount

public int getProductCount()
Gets the number of products.

Returns:
the number of products

getAgentCount

public int getAgentCount()
Gets the number of agents.

Returns:
the number of agents

getComponentCount

public int getComponentCount(int type)
Gets the number of reactants, products or agents.

Parameters:
type - REACTANTS, PRODUCTS or AGENTS
Returns:
the number of reactants, products or agents
Since:
Marvin 4.1, 11/19/2005

getReactant

public Molecule getReactant(int i)
Gets a reactant.

Parameters:
i - reactant index
Returns:
a reactant

getProduct

public Molecule getProduct(int i)
Gets a product.

Parameters:
i - product index
Returns:
a product

getAgent

public Molecule getAgent(int i)
Gets an agent.

Parameters:
i - agent index
Returns:
an agent

getComponentID

public long getComponentID(Molecule m)
Gets the ID of a reaction component.

Parameters:
m - the reaction component
Returns:
the reaction component ID or -1 if not found
Since:
Marvin 4.1, 11/19/2005

getComponentID

public long getComponentID(MolAtom a)
Gets the reaction component ID of an atom.

Parameters:
a - the atom
Returns:
the reaction component ID or -1 if not found
Since:
Marvin 4.1, 11/19/2005

getComponentID

public long getComponentID(MolBond b)
Gets the reaction component ID of a bond.

Parameters:
b - the bond
Returns:
the reaction component ID or -1 if not found
Since:
Marvin 4.1, 11/19/2005

getComponentType

public int getComponentType(long id)
Gets the reaction component type from the ID.

Parameters:
id - the reaction component ID or -1
Returns:
the reaction component type or -1
Since:
Marvin 4.1, 11/19/2005

getComponentFlags

public int getComponentFlags(long id)
Gets the reaction component type flags from the ID.

Parameters:
id - the reaction component ID or -1
Returns:
the reaction component type or -1
Since:
Marvin 4.1, 11/19/2005

getComponentIndex

public int getComponentIndex(long id)
Gets the reactant, product or agent index from the ID.

Parameters:
id - the reaction component ID or -1
Returns:
the reaction component index or -1
Since:
Marvin 4.1, 11/19/2005

getComponent

public Molecule getComponent(long id)
Gets a reactant, product or agent.

Warning! The RGROUPED flag returns an RgMolecule object having the same atom objects as the original reactant/product/agent. The parent of the atom objects is unchanged (it is the original reactant/product/agent).

Parameters:
id - the reaction component ID
Returns:
a reactant, product or agent
Since:
Marvin 4.1, 11/19/2005
See Also:
getComponent(int, int)

getComponent

public Molecule getComponent(int flags,
                             int i)
Gets a reactant, product or agent.

Warning! The RGROUPED flag returns an RgMolecule object having the same atom objects as the original reactant/product/agent. The parent of the atom objects is unchanged (it is the original reactant/product/agent).

Parameters:
flags - REACTANTS, PRODUCTS or AGENTS, can be combined with RGROUPED
i - reactant, product or agent index
Returns:
a reactant, product or agent
Since:
Marvin 4.1, 11/19/2005

getCenter

public DPoint3 getCenter(int type,
                         int i)
Gets the geometrical center of a reaction component.

Parameters:
type - REACTANTS, PRODUCTS or AGENTS
i - reactant, product or agent index
Returns:
the center of mass

revalidateCoordDependentProps

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

Overrides:
revalidateCoordDependentProps in class MoleculeGraph
Since:
Marvin 4.1, 08/03/2006

setReactionArrow0

public void setReactionArrow0()
Sets the stored reaction arrow 'arrowPoints' to its calculated value.


getReactionArrowType

public int getReactionArrowType()
Gets the reaction arrow type.

Returns:
the reaction arrow type
Since:
Marvin 3.5

getReactionArrowTypeName

public java.lang.String getReactionArrowTypeName()
Gets the reaction arrow type name. Used in molecule export.

Returns:
the reaction arrow type name
Since:
Marvin 3.5

setReactionArrowType

public void setReactionArrowType(int type)
Sets the reaction arrow type.

Parameters:
type - the reaction arrow type
Since:
Marvin 3.5

setReactionArrowType

public void setReactionArrowType(java.lang.String name)
Sets the reaction arrow type from type name. Used in molecule import.

Parameters:
name - the reaction arrow type name
Throws:
java.lang.IllegalArgumentException - for invalid type name
Since:
Marvin 3.5

getReactionArrow

public DPoint3[] getReactionArrow()
Gets a two-element array containing the endpoints of the reaction arrow.

Returns:
the arrow

setReactionArrow

public void setReactionArrow(DPoint3[] arw)
Sets the reaction arrow.

Parameters:
arw - is the new reaction arrow

setReactionArrow

public void setReactionArrow()
Sets the stored reaction arrow. to its calculated value.


recalcReactionArrow

public void recalcReactionArrow()
Recalculates the reaction arrow, forced recalculation.


rebuildStructures

public void rebuildStructures()
For each structure (reactant or product) determines whether it should be a reactant or a product depending on its the relative position to the reaction arrow. Rebuilds the reactant and product vectors accordingly.


rebuildStructures

public void rebuildStructures(DPoint3[] arw,
                              int art)
Sets the reaction arrow. For each reaction component (reactant or product) determines whether it should be a reactant or a product depending on its the relative position to the reaction arrow. Rebuilds the reactant and product vectors accordingly.

Parameters:
arw - is the new reaction arrow
art - is the new reaction arrow type

determineArrowDistance

public static double determineArrowDistance(double x,
                                            double y,
                                            double z,
                                            DPoint3[] ar)
Project the point (x,y,z) to the line of the reaction arrow 'ar'. Return the signed distance of the projected point from the start-point of the arrow divided by the arrow length.

Parameters:
x - is the x coordinate of the point
y - is the y coordinate of the point
z - is the z coordinate of the point
ar - is the reaction arrow
Returns:
the signed distance of the projected point from the start-point of the arrow divided by the arrow length

determineType

public int determineType(double x,
                         double y,
                         double z)
Determines whether a point should be in a reactant, in a product or in an agent.

Parameters:
x - point x coordinate
y - point y coordinate
z - point z coordinate
Returns:
REACTANTS, PRODUCTS or AGENTS

addComponent

public void addComponent(Molecule m,
                         int type)
Adds a reactant, product or agent. If atoms in the specified structure are already part of some other reactants, products or agents then removes them from those structures.

Parameters:
m - the reactant, product or agent
type - REACTANTS, PRODUCTS or AGENTS

addComponent

public void addComponent(Molecule m,
                         int type,
                         boolean beNew)
Adds a reactant, product or agent. If atoms in the specified structure are already part of some other reactants, products or agents then removes them from those structures.

Parameters:
m - the reactant, product or agent
type - REACTANTS, PRODUCTS or AGENTS
beNew - m should be a new structure if true

removeComponent

public Molecule removeComponent(int flags,
                                int i)
Removes a reactant, product or agent.

Warning! The RGROUPED flag returns an RgMolecule object having the same atom objects as the original reactant/product/agent. The parent of the atom objects is unchanged (it is the original reactant/product/agent).

Parameters:
flags - REACTANTS, PRODUCTS or AGENTS, can be combined with RGROUPED
i - reactant, product or agent index
Returns:
the removed reactant, product or agent
Since:
Marvin 4.1, 11/19/2005

clearForImport

public void clearForImport(java.lang.String fmt)
Clear the edges vector and the properties.

Overrides:
clearForImport in class Molecule
Parameters:
fmt - input file format. See the text formats on the File Formats in Marvin page.

setDim

public void setDim(int d)
Sets the dimension for all the structures.

Overrides:
setDim in class Molecule
Parameters:
d - 0, 2 or 3
See Also:
MoleculeGraph.flags

setAbsStereo

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

Overrides:
setAbsStereo in class MoleculeGraph
Parameters:
c - the absolute stereoconfiguration flag
See Also:
MoleculeGraph.flags

getNodeVector

public java.util.Vector getNodeVector()
Gets the nodes.

Overrides:
getNodeVector in class MoleculeGraph
Returns:
a node vector

getEdgeVector

public java.util.Vector getEdgeVector()
Gets the edges.

Overrides:
getEdgeVector in class MoleculeGraph
Returns:
an edge vector

getNodeCount

public int getNodeCount()
Returns the number of nodes in the graph union.

Overrides:
getNodeCount in class CGraph
Returns:
the number of nodes

getNode

public CNode getNode(int i)
Gets a node.

Overrides:
getNode in class CGraph
Parameters:
i - node index
Returns:
the node object

setNode

public void setNode(int iu,
                    CNode node)
Sets the node at the specified index.

Overrides:
setNode in class CGraph
Parameters:
iu - node index in the graph union
node - new node reference

getCtab

public int[][] getCtab()
Gets the connection table for the graph union. If there is no connection table for the molecule, then create it. ctab[i][j] will be the index of the jth neighbor of the ith atom.

Overrides:
getCtab in class CGraph
Returns:
the ctab array

getBtab

public int[][] getBtab()
Gets the bond table for the graph union. If there is no bond table for the molecule, then create it. btab[i][j] will be the index of the bond between atoms i and j, or -1 if there is no bond.

Overrides:
getBtab in class CGraph
Returns:
the btab array

createCHtab

public int[][] createCHtab()
Creates the graph union's connection table extended with implicit hydrogen atoms.

Overrides:
createCHtab in class MoleculeGraph
Returns:
the chtab array
Since:
Marvin 3.0

createBHtab

public int[][] createBHtab()
Creates the graph union's bond table extended with implicit hydrogen atoms.

Overrides:
createBHtab in class MoleculeGraph
Returns:
the chtab array
Since:
Marvin 3.0

getGrinv

public int getGrinv(int[] gi)
Gets the graph invariants for the graph union.

Overrides:
getGrinv in class MoleculeGraph
Parameters:
gi - output array
Returns:
the number of different graph invariants
Throws:
java.lang.SecurityException - the GraphInvariants module cannot be loaded because of security reasons (firewall)

getGrinv

protected int[] getGrinv()
Gets the graph invariants for the graph union.

Overrides:
getGrinv in class CGraph
Returns:
the graph invariants array

contains

public boolean contains(java.lang.Object o)
Checks if a reactant, agent or product structure contains the specified node or edge.

Overrides:
contains in class CGraph
Parameters:
o - the node or edge object
Returns:
true if the graph contains the object, false otherwise

hasAtomSet

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

Overrides:
hasAtomSet in class MoleculeGraph
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.

Overrides:
hasBondSet in class MoleculeGraph
Returns:
true if there are atom sets, false otherwise
Since:
Marvin 4.0, 03/02/2005

indexOf

public int indexOf(CNode node)
Gets the index of the specified node in the graph union.

Overrides:
indexOf in class CGraph
Parameters:
node - the node
Returns:
the index, or -1 if not found
Since:
Marvin 2.7

indexOf

public int indexOf(CEdge edge)
Gets the index of the specified edge in the graph union.

Overrides:
indexOf in class CGraph
Parameters:
edge - the edge
Returns:
the index, or -1 if not found
Since:
Marvin 2.7

add

public void add(CNode node)
Adds an atom to a reactant, product or agent structure. If a neighbour of the atom is in a reactant, product or agent, then adds the atom to that structure. Otherwise creates a new reactant or product.

Overrides:
add in class CGraph
Parameters:
node - the new node

getEdgeCount

public int getEdgeCount()
Gets the number of edges in the graph union.

Overrides:
getEdgeCount in class CGraph
Returns:
the number of edges

getEdge

public CEdge getEdge(int i)
Gets an edge.

Overrides:
getEdge in class CGraph
Parameters:
i - edge index in the graph union
Returns:
the edge object

setEdge

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

Overrides:
setEdge in class MoleculeGraph
Parameters:
iu - edge index in the graph union
edge - new node reference

replaceEdge

public void replaceEdge(CEdge olde,
                        CEdge newe)
Replaces an edge by another one.

Overrides:
replaceEdge in class CGraph
Parameters:
olde - the old edge
newe - the new edge
Since:
Marvin 4.1, 11/24/2005

add

public void add(CEdge e)
Adds a bond to a reactant, product, agent. If an endpoint of the edge is in a reactant, product or agent, then adds the edge to that structure.

Overrides:
add in class CGraph
Parameters:
e - the new edge

simplifyIncompleteReactionToMolecule

public Molecule simplifyIncompleteReactionToMolecule()
Simplify a reaction to a molecule if possible. If the reaction is incomplete and it only contains one reactant, one product or one agent, then that object is returned. Otherwise, simplification is impossible and this is returned.

Returns:
a reactant, product, agent or this
Since:
Marvin 4.0
See Also:
Molecule.getSimplifiedMolecule()

removeNode

public void removeNode(CNode node,
                       int cleanupFlags)
Removes an atom from the reactants, products or agents. This method is for internal use only. Use CGraph.removeNode(CNode) instead unless you are sure what you are doing.

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

removeNode

public void removeNode(int iu,
                       int cleanupFlags)
Removes an atom from the reactants, products or agents. This method is for internal use only. Use CGraph.removeNode(CNode) instead unless you are sure what you are doing.

Overrides:
removeNode in class Molecule
Parameters:
iu - atom index in the graph union
cleanupFlags - extra clean-up methods
Since:
Marvin 3.1
See Also:
CGraph.RMCLEANUP_NONE, CGraph.RMCLEANUP_ALL, CGraph.RMCLEANUP_EDGES, MoleculeGraph.RMCLEANUP_STEREO, Molecule.RMCLEANUP_SGROUPATOMS, Molecule.RMCLEANUP_FROMSGROUPS

removeEdge

protected void removeEdge(CEdge edge,
                          int cleanupFlags)
Removes a bond from the reactants, products or agents.

Overrides:
removeEdge in class Molecule
Parameters:
edge - the edge
cleanupFlags - extra clean-up methods
Since:
Marvin 3.1
See Also:
CGraph.RMCLEANUP_NONE, CGraph.RMCLEANUP_ALL, CGraph.RMCLEANUP_EDGES, MoleculeGraph.RMCLEANUP_STEREO, Molecule.RMCLEANUP_SGROUPATOMS, Molecule.RMCLEANUP_FROMSGROUPS

removeEdge

protected void removeEdge(int iu,
                          int cleanupFlags)
Removes an edge from a reactant, agent or product.

Overrides:
removeEdge in class Molecule
Parameters:
iu - edge index in the graph union
cleanupFlags - extra clean-up methods
Since:
Marvin 3.1
See Also:
CGraph.RMCLEANUP_NONE, CGraph.RMCLEANUP_ALL, CGraph.RMCLEANUP_EDGES, MoleculeGraph.RMCLEANUP_STEREO, Molecule.RMCLEANUP_SGROUPATOMS, Molecule.RMCLEANUP_FROMSGROUPS

removeAllEdges

public void removeAllEdges()
Removes all bonds from the reactants, products and agents.

Overrides:
removeAllEdges in class Molecule

removeAll

public void removeAll()
Remove all the atoms and bonds from the root structure, and from all the R-groups.

Overrides:
removeAll in class Molecule

isRealNodeParent

protected boolean isRealNodeParent()
Reaction molecules cannot be real node parents.

Overrides:
isRealNodeParent in class CGraph
Returns:
false
Since:
Marvin 3.0

regenEdges

public void regenEdges()
Regenerate the edge vectors: remove their elements, then put the edge objects from the nodes into it.

Overrides:
regenEdges in class CGraph

sortEdgesAccordingTo

public void sortEdgesAccordingTo(CEdge[] order)
Sort edges in the same order as they appear in the specified array.

Overrides:
sortEdgesAccordingTo in class CGraph
Parameters:
order - the array
Since:
Marvin 3.5, 09/02/2004

setLocation

public void setLocation(DPoint3 p)
Set the origin of the molecule. The MolAtom coordinates are relative to this origin.

Overrides:
setLocation in class MoleculeGraph
Parameters:
p - the origin
See Also:
MoleculeGraph.orix

mergeNodes

public void mergeNodes(CNode that,
                       CNode node)
Merges bonds of an atom with another atom, then add the atom to the molecule.

Overrides:
mergeNodes in class Molecule
Parameters:
that - the atom
node - the other atom

fuse

public void fuse(CGraph graph)
Add the atoms and bonds of another molecule.

Overrides:
fuse in class CGraph
Parameters:
graph - the other molecule

fuse0

protected void fuse0(CGraph graph)
Add those nodes and edges of a graph that are not already elements. If the graph has an atom connected to a reactant or product, then also adds the graph to that structure. Handles one connected component.

Overrides:
fuse0 in class MoleculeGraph
Parameters:
graph - the structure to fuse into this one

setSgroupParent

public void setSgroupParent(MolAtom a,
                            Sgroup sg,
                            boolean set)
Sets or unsets an S-group as a parent of an atom in reactants, products or agents.

Overrides:
setSgroupParent in class Molecule
Parameters:
a - the atom
sg - the S-group
set - set (true) or unset (false)
Throws:
java.lang.IllegalArgumentException - neither reactants, nor products or agents contain the atom
Since:
Marvin 3.0

clonecopy

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

Overrides:
clonecopy in class Molecule
Parameters:
g - the target structure

clonelesscopy

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

Overrides:
clonelesscopy in class Molecule
Parameters:
g - the target structure

cloneMolecule

public Molecule cloneMolecule()
Make an identical copy of the molecule.

Overrides:
cloneMolecule in class Molecule
Returns:
the copy
Since:
Marvin 3.5.1, 11/20/2004

newInstance

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

Overrides:
newInstance in class Molecule
Returns:
the new reaction

makeItSimilar

protected void makeItSimilar(CGraph g)
Copies some properties of this molecule to the other one specified as argument. Copies the reaction arrow.

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

splitDisconnectedComponent

public void splitDisconnectedComponent(long id)
Replaces a disconnected reaction component by its connected fragments in the structure array.

Parameters:
id - the reaction component ID
Since:
Marvin 4.1, 11/19/2005
See Also:
splitDisconnectedComponent(int, int)

splitDisconnectedComponent

public void splitDisconnectedComponent(int type,
                                       int index)
Replaces a disconnected reaction component by its connected fragments in the structure array.

Parameters:
type - is the structure type: REACTANTS, PRODUCTS or AGENTS
index - is the structure index
Since:
Marvin 4.1, 11/19/2005

transform

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

Overrides:
transform in class Molecule
Parameters:
t - the transformation matrix
incg - increase grinvCC or not

transformReactionArrow

protected void transformReactionArrow(CTransform3D t)
Apply a transformation matrix to the reaction arrow.

Parameters:
t - the transformation matrix

createReaction

public static RxnMolecule createReaction(Molecule mol,
                                         DPoint3[] arw,
                                         int art)
Creates a reaction.

Parameters:
mol - contains the atoms of reactants and products
arw - two-element array containing the endpoints of the reaction arrow
art - the arrow type
Returns:
the reaction

getGraphUnion

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

Overrides:
getGraphUnion in class MoleculeGraph
Returns:
the unified structure
Since:
Marvin 3.0, 11/11/2002
See Also:
Molecule.getGraphUnionAsSelection()

getSubGraphCount

protected final int getSubGraphCount()
Gets the number of all "submolecules".

Overrides:
getSubGraphCount in class MoleculeGraph
Returns:
the number of submolecules
Since:
Marvin 4.1.2
See Also:
MoleculeGraph.getSubGraphs(MoleculeGraph[], int)

getSubGraphs

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

Overrides:
getSubGraphs in class MoleculeGraph
Parameters:
arr - the output array
off - offset
Since:
Marvin 4.1.2
See Also:
MoleculeGraph.getSubGraphs(), MoleculeGraph.getSubGraphCount()

fillSelectionMolecule

protected void fillSelectionMolecule(SelectionMolecule s)
Adds all atoms and bonds of the root structure and the R-groups to the specified molecule.

Overrides:
fillSelectionMolecule in class Molecule
Parameters:
s - the selection molecule
Since:
Marvin 3.0, 11/05/2002

getStructureCount

public int getStructureCount(int type)
Deprecated. as of Marvin 4.1, replaced by getComponentCount(int)

Gets the number of reactants, products or agents.

Parameters:
type - reaction component type
Returns:
the number of reactants, products or agents

getStructure

public Molecule getStructure(int flags,
                             int i)
Deprecated. as of Marvin 4.1, replaced by getComponent(int, int)

Gets a reactant, product or agent.

Parameters:
flags - component type and other flags
i - reactant, product or agent index
Returns:
a reactant, product or agent

addStructure

public void addStructure(Molecule m,
                         int type)
Deprecated. as of Marvin 4.1, replaced by addComponent(Molecule, int)

Adds a reactant, product or agent.

Parameters:
m - the reactant, product or agent
type - reaction component type

addStructure

public void addStructure(Molecule m,
                         int type,
                         boolean beNew)
Deprecated. as of Marvin 4.1, replaced by addComponent(Molecule, int, boolean)

Adds a reactant, product or agent.

Parameters:
m - the reactant, product or agent
type - reaction component type
beNew - m should be a new structure if true

removeStructure

public Molecule removeStructure(int flags,
                                int i)
Deprecated. as of Marvin 4.1, replaced by removeComponent(int, int)

Removes a reactant, product or agent.

Parameters:
flags - reaction component type and other flags
i - reactant, product or agent index
Returns:
the removed reactant, product or agent
Since:
Marvin 3.4.3

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.

Overrides:
implicitizeHydrogens in class MoleculeGraph
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

isIncompleteReaction

public boolean isIncompleteReaction()
Check whether the reaction is incomplete or not.

Returns:
true if something is missing, false if it seems to be okay
Since:
Marvin 3.5