Class RxnMolecule

  • All Implemented Interfaces:
    chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>, chemaxon.core.structure.MoleculeForBuilder, chemaxon.core.structure.ReactionForBuilder, chemaxon.core.structure.RootStructureForBuilder, chemaxon.core.structure.StructureForBuilder, Incomplecule, chemaxon.struc.MObjectContainer, MTransformable, StereoConstants, Serializable

    @PublicAPI
    public class RxnMolecule
    extends Molecule
    implements chemaxon.struc.MObjectContainer, chemaxon.core.structure.ReactionForBuilder
    Reaction.
    Since:
    Marvin 2.9
    See Also:
    Serialized Form
    • Constructor Detail

      • RxnMolecule

        public RxnMolecule()
        Create a reaction.
    • Method Detail

      • 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
      • createReaction

        public static RxnMolecule createReaction​(MoleculeGraph mol,
                                                 DPoint3[] arw)
        Creates a reaction.
        Parameters:
        mol - contains the atoms of reactants and products
        arw - two-element array containing the endpoints of the reaction arrow
        Returns:
        the reaction
      • 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 static int determineType​(double x,
                                        double y,
                                        double z,
                                        DPoint3[] ar)
        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
        ar - reaction arrow
        Returns:
        REACTANTS, PRODUCTS or AGENTS
      • getReaction

        public static RxnMolecule getReaction​(MoleculeGraph 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
      • add

        public void add​(MolAtom a)
        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 MoleculeGraph
        Parameters:
        a - the new atom
      • add

        public void add​(MolBond 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 Molecule
        Parameters:
        e - the new edge
      • addComponent

        public void addComponent​(Molecule m,
                                 int type)
                          throws IllegalArgumentException
        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
        Throws:
        IllegalArgumentException - if m is of a subclass of Molecule for which the embedding in an RxnMolecule is not supported
      • addComponent

        public void addComponent​(Molecule m,
                                 int type,
                                 boolean beNew)
                          throws IllegalArgumentException
        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
        Throws:
        IllegalArgumentException - if m is of a subclass of Molecule for which the embedding in an RxnMolecule is not supported
      • addReactionStep

        public void addReactionStep​(List<Molecule> reactants,
                                    List<Molecule> products,
                                    List<Molecule> agents,
                                    chemaxon.struc.graphics.MRArrow arrow,
                                    int arrowType)
      • addSgroup

        public void addSgroup​(Sgroup sg,
                              boolean setparent)
        Adds an S-group to this object.
        Overrides:
        addSgroup in class Molecule
        Parameters:
        setparent - if true then the parent of the S-group is set to the root or that R-group member of this molecule which contains the S-group and the S-group is removed from the old parent molecule.
        sg - the S-group to add.
      • canBeReactionComponent

        public boolean canBeReactionComponent()
        Tests whether an object of this class can be a reaction component. This implementation returns false, RxnMolecules cannot be embedded in each other.
        Overrides:
        canBeReactionComponent in class Molecule
        Returns:
        true if it can be a reactant, product or agent, false if adding it to an RxnMolecule is not supported
        Since:
        Marvin 4.1.13, 09/19/2007
      • clearObjects

        public void clearObjects()
        Deletes the graphical objects from this.
        Specified by:
        clearObjects in interface chemaxon.struc.MObjectContainer
        Overrides:
        clearObjects in class Molecule
      • clone

        public RxnMolecule clone()
        Make an identical copy of the reaction structure. Document is not cloned!
        Overrides:
        clone in class Molecule
        Returns:
        the copy
      • clonecopy

        public void clonecopy​(int[] iatoms,
                              MoleculeGraph g)
        Copies the specified nodes and edges of this graph to another one. The RxnMolecule implementation of this method is incomplete.
        Overrides:
        clonecopy in class Molecule
        Parameters:
        iatoms - array of atom indices to copy
        g - the target graph
        Since:
        Marvin 5.0.2, 03/11/2008
      • clonecopy

        public void clonecopy​(MoleculeGraph g)
        Make another molecule identical to this one.
        Overrides:
        clonecopy in class Molecule
        Parameters:
        g - the target structure
      • clonelesscopy

        @Deprecated
        public void clonelesscopy​(MoleculeGraph g)
        Deprecated.
        as of Marvin 6.3.
        Not supported feature.
        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
      • cloneMoleculeWithDocument

        public RxnMolecule cloneMoleculeWithDocument()
        Description copied from class: Molecule
        Makes an identical copy of the molecule and its document. If the molecule does not have a parent, then copies non-molecular data: graphics objects, electron flows, text boxes, atom and bond sets (color, font and thickness). Otherwise (root, rgroup, component molecule) creates a new document.
        Overrides:
        cloneMoleculeWithDocument in class Molecule
        Returns:
        the copy
      • contains

        public boolean contains​(MolAtom node)
        Checks if a reactant, agent or product structure contains the specified node.
        Overrides:
        contains in class Molecule
        Parameters:
        node - the node object
        Returns:
        true if the graph contains the object, false otherwise
      • contains

        public boolean contains​(MolBond edge)
        Checks if a reactant, agent or product structure contains the specified edge.
        Overrides:
        contains in class MoleculeGraph
        Parameters:
        edge - the edge object
        Returns:
        true if the graph contains the object, false otherwise
        See Also:
        Object.equals(Object)
      • 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
      • 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
      • fuse

        public void fuse​(MoleculeGraph graph,
                         boolean check)
        Add the atoms and bonds of another molecule.
        Overrides:
        fuse in class MoleculeGraph
        Parameters:
        graph - the other molecule
        check - true if a containment check should be performed to ensure that only those nodes and edges are added that are not already elements - false if the graph is known to be disjoint from this graph and this check can be safely skipped
        Since:
        Marvin 5.0
      • fuse

        public void fuse​(RxnMolecule rxnMol)
        Fuse and RxnMolecule to this RxnMolecule. Adds the reactants of the parameter to the reactants, the agents of the parameter to the agents and the products of the parameter to the products.
        Parameters:
        rxnMol -
        Since:
        Marvin 6.2, 09/23/2013
      • getAgent

        public Molecule getAgent​(int i)
        Gets an agent.
        Parameters:
        i - agent index
        Returns:
        an agent
      • getAgentCount

        public int getAgentCount()
        Gets the number of agents.
        Returns:
        the number of agents
      • getAgents

        public Molecule[] getAgents()
        Gets all agents in an array.
        Returns:
        the agents
        Since:
        Marvin 5.3
      • getAllFragments

        public List<Molecule> getAllFragments()
        Gets the list of reaction fragments (product, reactant, agent components) that build up this reaction.
        Returns:
        the list of fragments (Molecule)
        Since:
        Marvin 5.0, 12/06/2007
        See Also:
        Molecule
      • getAllObjects

        public List<MObject> getAllObjects()
        Specified by:
        getAllObjects in interface chemaxon.struc.MObjectContainer
        Overrides:
        getAllObjects in class Molecule
      • getArrowAsProperty

        public MPropertyContainer getArrowAsProperty()
        Gets the properties (type, endpoint coordinates) of the reaction arrow in this reaction.
        Returns:
        the properties
      • getAtom

        public MolAtom getAtom​(int i)
        Gets a node.
        Overrides:
        getAtom in class MoleculeGraph
        Parameters:
        i - node index
        Returns:
        the node object
      • getAtomCount

        public int getAtomCount()
        Returns the number of nodes in the graph union.
        Specified by:
        getAtomCount in interface Incomplecule
        Specified by:
        getAtomCount in interface chemaxon.core.structure.StructureForBuilder
        Overrides:
        getAtomCount in class MoleculeGraph
        Returns:
        the number of nodes
      • getAtomCount

        public int getAtomCount​(int atomicNumber)
        Gets the number of atoms with the given atomic number in the unified molecule graph of the reaction. When atomicNumber is 1, sum includes only explicit Hydrogen atoms (but also D and T isotopes).
        Overrides:
        getAtomCount in class MoleculeGraph
        Parameters:
        atomicNumber - atomic number of atoms looked for
        Returns:
        number of atoms with the given atomic number
        Since:
        Marvin 5.5, 27/01/2011
      • getAtomIterator

        public IteratorFactory.AtomIterator getAtomIterator()
        Returns an iterator over the atoms in this molecule in proper sequence.
        Overrides:
        getAtomIterator in class MoleculeGraph
        Returns:
        an iterator over the atoms in this molecule in proper sequencer
        Since:
        Marvin 6.2, 2013.09.09.
      • getBond

        public MolBond getBond​(int i)
        Gets an edge.
        Overrides:
        getBond in class MoleculeGraph
        Parameters:
        i - edge index in the graph union
        Returns:
        the edge object
      • getBondIterator

        public IteratorFactory.BondIterator getBondIterator()
        Returns an iterator over the bonds in this molecule in proper sequence.
        Overrides:
        getBondIterator in class MoleculeGraph
        Returns:
        an iterator over the bonds in this molecule in proper sequence
        Since:
        Marvin 6.2, 2013.09.09.
      • getBondTable

        public BondTable getBondTable()
        Gets the bond table for the graph union. If there is no bond table for the molecule, then create it. btab.elementAt(i, j) will be the index of the bond between atoms i and j, or -1 if there is no bond.
        Overrides:
        getBondTable in class MoleculeGraph
        Returns:
        the btab array
        Since:
        Marvin 5.4
      • 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
      • getComponent

        public Molecule getComponent​(int typeFlag,
                                     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:
        typeFlag - 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
      • 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)
      • 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
      • 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
      • getComponentID

        public long getComponentID​(MolAtom atom)
        Gets the reaction component ID of an atom.
        Parameters:
        atom - the atom
        Returns:
        the reaction component ID or -1 if not found
        Since:
        Marvin 4.1, 11/19/2005
      • getComponentID

        public long getComponentID​(MolBond bond)
        Gets the reaction component ID of a bond.
        Parameters:
        bond - the bond
        Returns:
        the reaction component ID or -1 if not found
        Since:
        Marvin 4.1, 11/19/2005
      • getComponentID

        public long getComponentID​(Molecule molecule)
        Gets the ID of a reaction component.
        Parameters:
        molecule - the reaction component
        Returns:
        the reaction component ID or -1 if not found
        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
      • 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
      • 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 MoleculeGraph
        Returns:
        the ctab array
      • getFormula

        public String getFormula()
        Gets the molecular formula in Hill order.
        Overrides:
        getFormula in class MoleculeGraph
        Returns:
        the formula
      • getItsArrow

        public chemaxon.struc.graphics.MRArrow getItsArrow()
        Gets the reaction arrow of this reaction. If the arrow is not yet set creates one.
        Returns:
        the reaction arrow of this reaction
        Since:
        Marvin 5.0, 12/06/2007
      • 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
      • getMSLogic

        @Deprecated
        public Map<chemaxon.struc.graphics.MRArrow,​RxnMolecule> getMSLogic()
        Deprecated.
        Multi-step reactions not supported. Method performs no operations.
        Multi-step reactions not supported. Method always returns null.
        Returns:
        returns the hash that stores the mapping.
      • getObjectCount

        public int getObjectCount()
        Specified by:
        getObjectCount in interface chemaxon.struc.MObjectContainer
        Overrides:
        getObjectCount in class Molecule
      • getProduct

        public Molecule getProduct​(int i)
        Gets a product.
        Parameters:
        i - product index
        Returns:
        a product
      • getProductCount

        public int getProductCount()
        Gets the number of products.
        Returns:
        the number of products
      • getProducts

        public Molecule[] getProducts()
        Gets all products in an array.
        Returns:
        the products
        Since:
        Marvin 5.3
      • getReactant

        public Molecule getReactant​(int i)
        Gets a reactant.
        Parameters:
        i - reactant index
        Returns:
        a reactant
      • getReactantCount

        public int getReactantCount()
        Gets the number of reactants.
        Returns:
        the number of reactants
      • getReactants

        public Molecule[] getReactants()
        Gets all reactants in an array.
        Returns:
        the reactants
        Since:
        Marvin 5.3
      • getReactionArrow

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

        public chemaxon.struc.graphics.MRArrow getReactionArrow​(boolean generate)
        Gets the reaction arrow of this reaction with the possibility to generate an arrow if the arrow is not yet set.
        Parameters:
        generate - if true then arrow is generated in case when the arrow is not yet set.
        Returns:
        the arrow of this reaction, null if the arrow is not set and the generate parameter was false.
      • getReactionArrowList

        public List<chemaxon.struc.graphics.MRArrow> getReactionArrowList()
        Gets the list of the reaction arrows of this reaction.
        Returns:
        the list of MRArrow-s
        Since:
        Marvin 5.0
        See Also:
        MRArrow
      • getReactionArrowTypeName

        public String getReactionArrowTypeName()
        Gets the reaction arrow type name. Used in molecule export.
        Returns:
        the reaction arrow type name:
        • "DEFAULT" for arrow type RxnMolecule.REGULAR_SINGLE or in case if no reaction arrow is set.
        • "RESONANCE" for arrow type RxnMolecule.RESONANCE or RxnMolecule.TWO_HEADED_SINGLE
        • "RETROSYNTHETIC" for arrow type RxnMolecule.RETROSYNTHETIC or RxnMolecule.REGULAR_DOUBLE
        • "EQUILIBRIUM" for arrow type RxnMolecule.EQUILIBRIUM or RxnMolecule.TWO_HEADED_DOUBLE
        Since:
        Marvin 3.5
      • getReactionSteps

        public ArrayList<RxnMolecule> getReactionSteps()
        Divides this reaction into simple step reactions if this is a multistep reaction.
        Returns:
        the list of RxnMolecule-s if this is a multistep reaction empty list otherwise.
        Since:
        Marvin 5.0
      • getType

        public int getType​(MoleculeGraph selection)
        Checks whether the atoms in the selection are all in reactants, products or agents.
        Parameters:
        selection - the molecule graph containing the selection
        Returns:
        REACTANTS, PRODUCTS or AGENTS or -1 if not of the same type or there is an atom which is not contained in any component
      • hasAtomSet

        public boolean hasAtomSet()
        Tests whether the molecule graph has atom sets.
        Overrides:
        hasAtomSet in class Molecule
        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​(MolAtom node)
        Gets the index of the specified node in the graph union.
        Overrides:
        indexOf in class MoleculeGraph
        Parameters:
        node - the node
        Returns:
        the index, or -1 if not found
        Since:
        Marvin 2.7
      • indexOf

        public int indexOf​(MolBond edge)
        Gets the index of the specified edge in the graph union.
        Overrides:
        indexOf in class MoleculeGraph
        Parameters:
        edge - the edge
        Returns:
        the index, or -1 if not found
        Since:
        Marvin 2.7
        See Also:
        Object.equals(Object)
      • isAtom

        @Deprecated
        public boolean isAtom()
        Deprecated.
        As of Marvin 14.7.7, no replacement.
        Not supported feature.
        A reaction molecule cannot represent an atom.
        Overrides:
        isAtom in class MoleculeGraph
        Returns:
        false
      • isBond

        @Deprecated
        public boolean isBond()
        Deprecated.
        As of Marvin 14.7.7, no replacement.
        Not supported feature.
        A reaction molecule cannot represent a bond.
        Overrides:
        isBond in class MoleculeGraph
        Returns:
        false
      • 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
      • 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
      • isMergedComponent

        public boolean isMergedComponent​(MoleculeGraph m)
        Check whether given molecule is reaction component with a set of intentionally merged fragments or not.
        Parameters:
        m - the molecule to check
        Returns:
        true if merged
      • isQuery

        public boolean isQuery()
        Indicates if the molecule has query features: query atoms or query bonds.
        Overrides:
        isQuery in class MoleculeGraph
        Returns:
        true if any of the components has query features
        Since:
        Marvin 6.0 26/01/2013
        See Also:
        MolAtom.isQuery(), MolBond.isQuery()
      • isReaction

        public boolean isReaction()
        Checks if the structure represents a reaction or not.
        Overrides:
        isReaction in class Molecule
        Returns:
        true
        Since:
        Marvin 3.0
      • isSingleStepReaction

        @Deprecated
        public boolean isSingleStepReaction()
        Deprecated.
        Multi-step reactions not supported. Method always returns true.
        Returns:
        true
      • mergeAtoms

        @Deprecated
        public void mergeAtoms​(MolAtom that,
                               MolAtom node)
        Deprecated.
        As of Marvin 6.2, use MergeUtil.mergeAtoms(MolAtom, MolAtom, boolean) instead.
        Merges bonds of an atom with another atom, then add the atom to the molecule.
        Overrides:
        mergeAtoms in class Molecule
        Parameters:
        that - the atom
        node - the other atom
      • mergeComponentParts

        public void mergeComponentParts​(MoleculeGraph m,
                                        int type,
                                        boolean isMergeStored)
                                 throws IllegalArgumentException
        Finds those component parts that are contained in the molecule graph m and creates a new component containing all atoms of m, splitting them from the previous merges.
        Parameters:
        m - molecule graph that contains atoms of the fragments to merge
        type - type of component parts to merge (only parts of components of the same type can be merged)
        isMergeStored - if true then merged component remains merged until not splitted intentionnaly
        Throws:
        IllegalArgumentException
        See Also:
        splitComponentParts(chemaxon.struc.MoleculeGraph, int)
      • newInstance

        public MoleculeGraph 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
      • 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
      • recalcReactionArrow

        public void recalcReactionArrow()
        Recalculates the coordinates of the reaction arrow from the reactants and products, forced recalculation.
      • regenBonds

        public void regenBonds()
        Regenerate the edge vectors: remove their elements, then put the edge objects from the nodes into it.
        Overrides:
        regenBonds in class MoleculeGraph
      • 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
      • removeAllBonds

        public void removeAllBonds()
        Removes all bonds from the reactants, products and agents.
        Overrides:
        removeAllBonds in class Molecule
      • 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
      • removeEmptyComponents

        public void removeEmptyComponents()
        Checks all the componentes and removes those that are empty (node count is zero).
      • removeObject

        public void removeObject​(MObject o)
        Removes a graphical object from this.
        Specified by:
        removeObject in interface chemaxon.struc.MObjectContainer
        Overrides:
        removeObject in class Molecule
        Parameters:
        o - the graphical object
      • removeReactionArrow

        public void removeReactionArrow()
        Removes the reaction arrow of this reacion.
      • 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
      • selectAllObjects

        public void selectAllObjects​(boolean s)
        Specified by:
        selectAllObjects in interface chemaxon.struc.MObjectContainer
        Overrides:
        selectAllObjects in class Molecule
      • 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.setFlags(int)
      • setMSLogic

        @Deprecated
        public void setMSLogic​(Map<chemaxon.struc.graphics.MRArrow,​RxnMolecule> ms)
        Deprecated.
        Multi-step reactions not supported. Method performs no operations.
        Multi-step reactions not supported. Method performs no operations. Method declaration kept for compatibility reasons.
        Parameters:
        ms - mapping store.
      • setReactionArrow

        public void setReactionArrow​(DPoint3... points)
        Sets the endpoint coordinates of the reaction arrow. Sets the stored reaction arrow to its calculated value if no argument passed.
        Parameters:
        points - endpoint coordinates of the reaction arrow
        Throws:
        IllegalArgumentException - if argument contains one point only.
      • setReactionArrow

        public void setReactionArrow​(chemaxon.struc.graphics.MRArrow arrow)
        Sets the reaction arrow.
        Parameters:
        arrow -
      • setReactionArrow0

        public void setReactionArrow0​(DPoint3... points)
        Sets the reaction arrow. Sets the stored reaction arrow 'arrowPoints' to its calculated value if no argument passed.
        Parameters:
        points - is the new reaction arrow.
        Throws:
        IllegalArgumentException - if argument contains one point only.
      • setReactionArrowEndPoints

        public void setReactionArrowEndPoints​(DPoint3[] points)
        Sets the endpoints of the reaction arrow in this reaction. If the arrow is not yet set creates one with the given endpoint coordinates.
        Parameters:
        points - the endpoint coordinates of the arrow
        Since:
        Marvin 5.0, 12/06/2007
      • 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​(String name)
        Sets the reaction arrow type from type name. Used in molecule import.
        Parameters:
        name - the reaction arrow type name
        Throws:
        IllegalArgumentException - for invalid type name
        Since:
        Marvin 3.5
      • 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:
        IllegalArgumentException - neither reactants, nor products or agents contain the atom
        Since:
        Marvin 3.0
      • 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()
      • simplifyToMolecule

        public Molecule simplifyToMolecule()
        Simplifies this RxnMolecule by moving the atoms and bonds from the reactants, products, and agents to a Molecule. Clears reactans, products, agents.
        Returns:
        the simplified molecule
        Since:
        Marvin 5.0
      • sortBondsAccordingTo

        public void sortBondsAccordingTo​(MolBond[] order)
        Sort edges in the same order as they appear in the specified array.
        Overrides:
        sortBondsAccordingTo in class MoleculeGraph
        Parameters:
        order - the array
        Since:
        Marvin 3.5, 09/02/2004
      • splitAllDisconnectedComponents

        public void splitAllDisconnectedComponents()
        Replaces all disconnected reaction components by its connected fragments in the structure array.
        Since:
        Marvin 5.4, 07/07/2010
        See Also:
        splitDisconnectedComponent(int, int)
      • splitComponentParts

        public void splitComponentParts​(MoleculeGraph m,
                                        int type)
                                 throws IllegalArgumentException
        Finds those component parts that are contained in the molecule graph m and creates separate components from the fragments contained in m, splitting them from the previous merges.
        Parameters:
        m - molecule graph that contains atoms of the fragments to split
        type - type of component parts to merge (only parts of components of the same type can be merged)
        Throws:
        IllegalArgumentException
      • 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
      • 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)
      • stereoClean

        public boolean stereoClean()
        Reset the wedges of the molecule, based on the actual parity information in 2D remove wedges in 3D. Take care of expanding the molecule if neccessary.
        Overrides:
        stereoClean in class MoleculeGraph
        Returns:
        true if succesful
        See Also:
        MoleculeGraph.stereoClean()
      • toString

        public String toString()
        Overrides Object.toString() to ease debugging.
        Overrides:
        toString in class MoleculeGraph
        Returns:
        a string representation of the object
      • 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
      • updateComponentRoles

        public void updateComponentRoles()
        Updates fragment roles in the molecule. roles are like: - nodes that are sources only: are REACTANTS - nodes that are sinks only: are PRODUCTS - all other nodes: are AGENTS For single step reactions: if the reaction is stored as single step, does nothing. If the single reaction is stored in the hash, transforms it into a single step one.
      • addAtomToFragment

        protected void addAtomToFragment​(MolAtom a)
        Adds an atom to a fragment. S-groups are added only if all atoms are already in the molecule.
        Overrides:
        addAtomToFragment in class Molecule
        Parameters:
        a - the atom reference
      • checkSgroupConsistency

        protected void checkSgroupConsistency()
        Checks the consistency of S-groups.
        Overrides:
        checkSgroupConsistency in class Molecule
        Throws:
        RuntimeException - if inconsistency found
        Since:
        Marvin 5.0, 11/06/2007
      • createGearch

        protected chemaxon.struc.gearch.MoleculeGraphGearch createGearch()
        Overrides:
        createGearch in class Molecule
      • 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
      • fuse0

        protected void fuse0​(MoleculeGraph graph,
                             boolean check)
        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 Molecule
        Parameters:
        graph - the structure to fuse into this one
        check - true if a containment check should be performed to ensure that only those nodes and edges are added that are not already elements - false if the graph is known to be disjoint from this graph and this check can be safely skipped
        Since:
        Marvin 5.0
      • isRealAtomParent

        protected boolean isRealAtomParent()
        Reaction molecules cannot be real node parents.
        Overrides:
        isRealAtomParent in class MoleculeGraph
        Returns:
        false
        Since:
        Marvin 3.0
      • makeItSimilar

        protected void makeItSimilar​(MoleculeGraph 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
      • setSupergraph

        protected void setSupergraph​(MoleculeGraph molecule)
        Sets the given molecule as the supergraph of this graph and its components.
        Overrides:
        setSupergraph in class MoleculeGraph
        Parameters:
        molecule - the molecule
        Since:
        Marvin 14.7.7, Jul 2, 2014
      • transformReactionArrow

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