Class RgMolecule

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

    @PublicAPI
    public class RgMolecule
    extends Molecule
    implements chemaxon.struc.RgMoleculeGraphIface, chemaxon.struc.MObjectContainer, chemaxon.core.structure.MarkushStructureForBuilder
    A molecule or reaction containing R-groups.
    Since:
    Marvin 2.6
    See Also:
    Serialized Form
    • Constructor Detail

      • RgMolecule

        public RgMolecule()
        Creates a 2 dimensional RgMolecule.
      • RgMolecule

        public RgMolecule​(Molecule root)
        Creates an RgMolecule with the given root structure.
    • Method Detail

      • setRoot

        public void setRoot​(Molecule mol)
        Sets the root structure.
        Parameters:
        mol - the root structure
      • getStereo2

        public int getStereo2​(MolBond bond,
                              MolAtom leftAtom,
                              MolAtom rightAtom,
                              boolean performGrinvCheck)
        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 atom1 and atom2 of the specified bond. Both (A2, A3) = (atom1, atom2) and (A2, A3) = (atom2, atom1) works. If A1 or A4 is null 0 is returned. Not checking if the bond is in small ring (MoleculeGraph.MIN_RING_SIZE_FOR_TRANS_DB (so chemically the double bond with its ring ligand can be cis only), but due to the perspective depiction in two dimension the double bond ligand arrangement looks trans. In this case the chemically incorrect trans returned.
        Overrides:
        getStereo2 in class MoleculeGraph
        Parameters:
        bond - the bond
        leftAtom - atom A1
        rightAtom - atom A4
        performGrinvCheck - true if check atom equivalences using graph invariants
        Returns:
        the stereo flags
        See Also:
        StereoConstants.CTUMASK, MolBond.calcStereo2(), for detailed examples.
      • getRoot

        public Molecule getRoot()
        Gets the root structure.
        Returns:
        the root
      • getRootG

        public final MoleculeGraph getRootG()
        Gets the root structure.
        Specified by:
        getRootG in interface chemaxon.struc.RgMoleculeGraphIface
        Returns:
        the root
      • getRgroupCount

        public int getRgroupCount()
        Gets the number of R-groups.
        Specified by:
        getRgroupCount in interface chemaxon.struc.RgMoleculeGraphIface
        Returns:
        number of R-groups
      • getRgroupMemberCount

        public int getRgroupMemberCount​(int i)
        Gets the number of R-group members.
        Specified by:
        getRgroupMemberCount in interface chemaxon.struc.RgMoleculeGraphIface
        Parameters:
        i - R-group index
        Returns:
        number of R-group members
      • getRgroupMember

        public Molecule getRgroupMember​(int i,
                                        int j)
        Gets an R-group member.
        Parameters:
        i - R-group index
        j - member index
        Returns:
        the R-group member
      • getRgroupMemberG

        public final MoleculeGraph getRgroupMemberG​(int i,
                                                    int j)
        Gets an R-group member.
        Specified by:
        getRgroupMemberG in interface chemaxon.struc.RgMoleculeGraphIface
        Parameters:
        i - R-group index
        j - member index
        Returns:
        the R-group member
      • getRgroupId

        public int getRgroupId​(int i)
        Gets the ID of an R-group.
        Specified by:
        getRgroupId in interface chemaxon.struc.RgMoleculeGraphIface
        Parameters:
        i - R-group index
        Returns:
        number between 0 and MolAtom.RGROUP_MAX
      • findRgroupIndex

        public int findRgroupIndex​(int rgid)
        Finds the index of an R-group based on the R-group number.
        Specified by:
        findRgroupIndex in interface chemaxon.struc.RgMoleculeGraphIface
        Parameters:
        rgid - number between 0 and MolAtom.RGROUP_MAX
        Returns:
        R-group index, or -1 if not found
      • 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.
      • addRgroup

        public int addRgroup​(int rl,
                             Molecule m)
        Adds an R-group member.
        Parameters:
        rl - R-logic flags or an R-group ID number between 0 and MolAtom.RGROUP_MAX
        m - the R-group
        Returns:
        the Rgroup index
      • getRgroupIndex

        @Beta
        public int getRgroupIndex​(chemaxon.struc.RgroupBridgeId bridgeId)
        Returns the index of the ordinary R-group that actually represents the given R-group bridge.
        Parameters:
        bridgeId - R-group bridge ID
        Returns:
        the index of the ordinary R-group that actually represents the given R-group bridge or -1 if the given bridge is not defined in the structure
        Since:
        Marvin 14.10.13
        See Also:
        RgroupBridgeId
      • getRgroupId

        public int getRgroupId​(chemaxon.struc.RgroupBridgeId bridgeId)
        Specified by:
        getRgroupId in interface chemaxon.struc.RgMoleculeGraphIface
      • findRgroupBridgeId

        @Beta
        public chemaxon.struc.RgroupBridgeId findRgroupBridgeId​(int index)
        Finds the corresponding RgroupBridgeId for an R-group index.
        Parameters:
        index - the index of an R-group
        Returns:
        the corresponding RgroupBridgeId if the specified R-group is actually representing an R-group bridge, null otherwise
        Since:
        Marvin 14.10.13
        See Also:
        RgroupBridgeId
      • getRgroupBridgeCount

        @Beta
        public int getRgroupBridgeCount()
        Returns the number of R-group bridges defined in this structure.
        Returns:
        the number of R-group bridges
        Since:
        Marvin 14.10.13
        See Also:
        RgroupBridgeId
      • getRgroupBridgeIds

        @Beta
        public List<chemaxon.struc.RgroupBridgeId> getRgroupBridgeIds()
        Returns the list of R-group bridge IDs defined in this structure.
        Returns:
        the sorted list of R-group bridge IDs
        Since:
        Marvin 14.10.13
        See Also:
        RgroupBridgeId
      • getRgroupBridgeMemberCount

        @Beta
        public int getRgroupBridgeMemberCount​(chemaxon.struc.RgroupBridgeId bridgeId)
        Returns the number of definition members of the given R-group bridge.
        Parameters:
        bridgeId - R-group bridge ID
        Returns:
        the number of definition members of the given R-group bridge or 0 if the bridge is not defined in this structure
        Since:
        Marvin 14.10.13
        See Also:
        RgroupBridgeId
      • getRgroupBridgeMember

        @Beta
        public Molecule getRgroupBridgeMember​(chemaxon.struc.RgroupBridgeId bridgeId,
                                              int memberIndex)
        Returns a definition member of the given R-group bridge.
        Parameters:
        bridgeId - R-group bridge ID
        memberIndex - index of the definition member
        Returns:
        the definition member molecule
        Since:
        Marvin 14.10.13
        See Also:
        RgroupBridgeId
      • addRgroupBridgeMember

        @Beta
        public void addRgroupBridgeMember​(chemaxon.struc.RgroupBridgeId bridgeId,
                                          Molecule m)
        Adds a definition member to an R-group bridge.
        Parameters:
        bridgeId - R-group bridge ID
        m - the member molecule
        Since:
        Marvin 14.10.13
        See Also:
        RgroupBridgeId
      • removeRgroupMember

        public void removeRgroupMember​(int rgroupIndex,
                                       int memberIndex)
        Removes an R-group definition member. If it is the last member to be removed, then the whole R-group definition will be removed. Note: the R-group members are always indexed continuously starting with 0.
        Parameters:
        rgroupIndex - the index of the R-group definition
        memberIndex - the index of the member
        Throws:
        IndexOutOfBoundsException - If the definition index is not valid or if the member index is not valid
        Since:
        5.10 2012.05.10
      • removeRgroupBridgeMember

        @Beta
        public void removeRgroupBridgeMember​(chemaxon.struc.RgroupBridgeId bridgeId,
                                             int memberIndex)
        Removes a definition member of an R-group bridge. If it is the last member to be removed, then the whole R-group bridge will be removed. Note: the R-group bridge members are always indexed continuously starting with 0.
        Parameters:
        bridgeId - R-group bridge ID
        memberIndex - the index of the member
        Since:
        Marvin 14.10.13
        See Also:
        RgroupBridgeId
      • removeRgroupMembers

        public void removeRgroupMembers​(int rgroupIndex,
                                        int[] memberIndexes)
        Removes R-group members. If the last member is removed then the whole R-group definition will be removed. Note: the R-group members are always indexed continuously starting with 0.
        Parameters:
        rgroupIndex - the index of the R-group definition
        memberIndexes - the array of the member indexes
        Throws:
        IndexOutOfBoundsException - If the definition index is not valid or if a member index is not valid
        Since:
        5.10 2012.05.10
      • removeRgroup

        public void removeRgroup​(int rgroupIndex)
        Removes an R-group. Note: the R-group definitions are always indexed continuously starting with 0.
        Parameters:
        rgroupIndex - the index of the R-group definition
        Throws:
        IndexOutOfBoundsException - If the definition index is not valid
        Since:
        5.10 2012.05.10
      • removeRgroupBridge

        @Beta
        public void removeRgroupBridge​(chemaxon.struc.RgroupBridgeId bridgeId)
        Removes an R-group bridge.
        Parameters:
        bridgeId - R-group bridge ID
        Since:
        Marvin 14.10.13
        See Also:
        RgroupBridgeId
      • hasRgroupContainedBy

        public boolean hasRgroupContainedBy​(Set<?> set)
        Tests whether the molecule has an R-group that is a subset of the specified set of atoms.
        Parameters:
        set - set of atoms
        Since:
        5.0, 02/24/2007
      • unRgroupAtoms

        public int unRgroupAtoms​(Set<?> set)
        Ungroup R-groups consisting of the specified atoms and make them be part of root.
        Parameters:
        set - selected atoms
        Returns:
        the number of ungrouped R-group members
        Since:
        5.0, 02/24/2007
      • replaceAtomsWithNewRgroup

        public void replaceAtomsWithNewRgroup​(SelectionMolecule sel,
                                              int rgid)
        Replaces selected atoms with a new R-group.
        Parameters:
        sel - selected atoms
        rgid - R-group ID
        Since:
        4.0, 06/30/2005
      • getRlogic

        public int getRlogic​(int i)
        Gets R-logic flags.
        Specified by:
        getRlogic in interface chemaxon.struc.RgMoleculeGraphIface
        Parameters:
        i - R-group index
        Returns:
        R-logic flags
        See Also:
        RG_ID_MASK, RG_ID2_FLAG, RG_ID2_OFF, RG_ID2_MASK, RG_RESTH
      • getRlogicRange

        public String getRlogicRange​(int i)
        Gets R-logic occurrence range.
        Specified by:
        getRlogicRange in interface chemaxon.struc.RgMoleculeGraphIface
        Parameters:
        i - R-group index
        Returns:
        the occurrence range: By default it is an empty string which means "as drawn".
      • setRlogicRange

        public void setRlogicRange​(int index,
                                   String range)
                            throws IllegalArgumentException
        Sets R-logic occurrence range. If null is given as range, de R-logic range is set to default empty string.
        Parameters:
        index - R-group index
        range - range of occurrance.
        Throws:
        IllegalArgumentException - bad occurrence range
      • checkRlogicRange

        public String checkRlogicRange​(int index,
                                       String range)
                                throws IllegalArgumentException
        Checks an R-logic occurrence range string for syntax errors and returns a "normalized" string.
        Parameters:
        index - R-group index
        range - range of occurrence
        Returns:
        the normalized occurrence range string
        Throws:
        IllegalArgumentException - bad occurrence range
        Since:
        Marvin 3.4
      • setName

        public void setName​(String s)
        Sets the name of the root molecule.
        Overrides:
        setName in class Molecule
        Parameters:
        s - the molecule name, empty string or null (null is equivalent to empty string)
      • getName

        public String getName()
        Gets the name of the root molecule.
        Specified by:
        getName in interface Incomplecule
        Overrides:
        getName in class Molecule
        Returns:
        the molecule name or an empty string
      • setComment

        public void setComment​(String s)
        Sets the comment of the root molecule.
        Overrides:
        setComment in class Molecule
        Parameters:
        s - the comment, empty string or null (null is equivalent to empty string)
      • getComment

        public String getComment()
        Gets the comment of the root molecule.
        Overrides:
        getComment in class Molecule
        Returns:
        the comment or empty string
      • 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
      • reuseAtom

        public MolAtom reuseAtom​(int z,
                                 int i)
        Reuse an atom or create a new one. If an atom is reused, all its properties except the corners are initialized.
        Overrides:
        reuseAtom in class Molecule
        Parameters:
        z - atomic number
        i - atom index
        Returns:
        the new or old atom
      • endReuse

        public void endReuse​(int n)
        End reusing atoms.
        Overrides:
        endReuse in class Molecule
        Parameters:
        n - number of atoms
        Since:
        Marvin 2.6
      • getCtab

        public int[][] getCtab()
        Gets the connection table of the root structure. 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
      • getBondTable

        public BondTable getBondTable()
        Gets the bond table of the root structre. 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
      • rgroupIdOf

        public int rgroupIdOf​(MolAtom node)
        Finds the ID of the R-group (the number in R#) that contains the specified atom.
        Specified by:
        rgroupIdOf in interface chemaxon.struc.RgMoleculeGraphIface
        Parameters:
        node - the atom
        Returns:
        the R-group ID if found or -1 if not found
      • rgroupIndexOf

        public int rgroupIndexOf​(MolAtom node)
        Finds the index of the R-group (the number in R#) that contains the specified atom.
        Specified by:
        rgroupIndexOf in interface chemaxon.struc.RgMoleculeGraphIface
        Parameters:
        node - the atom
        Returns:
        the R-group index if found or -1 if not found
      • getRgroupMemberID

        public long getRgroupMemberID​(MolAtom node)
        Gets the unique identifier of the R-group member that contains the specified atom.
        Specified by:
        getRgroupMemberID in interface chemaxon.struc.RgMoleculeGraphIface
        Parameters:
        node - the atom
        Returns:
        the ID or -1
        Since:
        Marvin 4.1, 11/23/2005
      • getRgroupIndex

        public int getRgroupIndex​(long id)
        Gets the R-group index from the R-group member ID.
        Specified by:
        getRgroupIndex in interface chemaxon.struc.RgMoleculeGraphIface
        Parameters:
        id - the R-group member ID or -1
        Returns:
        the R-group ID or -1
        Since:
        Marvin 4.1, 11/23/2005
      • getRgroupMemberIndex

        public int getRgroupMemberIndex​(long id)
        Gets the R-group member index from the R-group member ID.
        Specified by:
        getRgroupMemberIndex in interface chemaxon.struc.RgMoleculeGraphIface
        Parameters:
        id - the R-group member ID or -1
        Returns:
        the R-group member index or -1
        Since:
        Marvin 4.1, 11/23/2005
      • setDim

        public void setDim​(int d)
        Sets the dimension of the root structure and the R-groups.
        Overrides:
        setDim in class Molecule
        Parameters:
        d - 0, 2 or 3
        See Also:
        MoleculeGraph.getFlags()
      • getFlags

        public int getFlags()
        Gets the dimension and chiral flags.
        Overrides:
        getFlags in class MoleculeGraph
        Returns:
        the flags
        Since:
        Marvin 5.0.1, 02/10/2008
      • setFlags

        protected void setFlags​(int f)
        Sets the dimension and chiral flags.
        Overrides:
        setFlags in class MoleculeGraph
        Parameters:
        f - the flags
        Since:
        Marvin 5.0.1, 02/10/2008
        See Also:
        MoleculeGraph.flags
      • setFlags

        protected void setFlags​(int f,
                                int mask)
        Sets specified bits in the flags.
        Overrides:
        setFlags in class MoleculeGraph
        Parameters:
        f - new value of the specified bits
        mask - bits to set
      • setAbsStereo

        public void setAbsStereo​(boolean c)
        Sets the absolute stereoconfiguration flag for the root structure and the R-groups.
        Overrides:
        setAbsStereo in class MoleculeGraph
        Parameters:
        c - the absolute stereoconfiguration flag
        See Also:
        MoleculeGraph.setFlags(int)
      • getAtomCount

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

        public int getAtomCount​(int atomicNumber)
        Gets the number of atoms with the given atomic number in the root structure. 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
      • getAtom

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

        public RgMolecule clone()
        Clone the markush structure. Document is not cloned!
        Overrides:
        clone in class Molecule
        Returns:
        deep clone of the markush structure
      • cloneMoleculeWithDocument

        public RgMolecule 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
      • add

        public void add​(MolAtom node)
        Adds an atom to the root structure.
        Overrides:
        add in class MoleculeGraph
        Parameters:
        node - the atom
      • addAtomToFragment

        protected void addAtomToFragment​(MolAtom atom)
        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:
        atom - the atom reference
      • insertNullAtoms

        protected void insertNullAtoms​(int i,
                                       int count)
        Insert nulls into the atom array.
        Overrides:
        insertNullAtoms in class MoleculeGraph
        Parameters:
        i - starting index
        count - number of new entries
        Since:
        Marvin 3.4
      • insertNullBonds

        protected void insertNullBonds​(int i,
                                       int count)
        Insert nulls into the bond array.
        Overrides:
        insertNullBonds in class MoleculeGraph
        Parameters:
        i - starting index
        count - number of new entries
        Since:
        Marvin 3.5.5
      • getBond

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

        public void add​(MolBond bond)
        Adds a bond to the root structure.
        Overrides:
        add in class Molecule
        Parameters:
        bond - the bond to add
      • 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
      • 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
        See Also:
        Object.equals(Object)
      • contains

        public boolean contains​(MolAtom node)
        Checks if the root structure or an R-group 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 the root structure or an R-group 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)
      • isEmpty

        public boolean isEmpty()
        Ask if the molecule is empty or not.
        Overrides:
        isEmpty in class Molecule
        Returns:
        true if the graph does not contain any nodes or edges.
      • isQuery

        public boolean isQuery()
        Indicates if the molecule has query features.
        Overrides:
        isQuery in class MoleculeGraph
        Returns:
        true if there are R-definitions for this molecule or the root has query features.
        Since:
        Marvin 4.1.2 08/30/2006
        See Also:
        MolAtom.isQuery(), MolBond.isQuery()
      • isAtom

        @Deprecated
        public boolean isAtom()
        Deprecated.
        As of Marvin 14.7.7, no replacement.
        Not supported feature.
        Determines whether the structure represents only one atom and an arbitrary number of bonds.
        Overrides:
        isAtom in class MoleculeGraph
        Returns:
        true the root structure represents an atom and there are no R-groups, false otherwise
      • isBond

        @Deprecated
        public boolean isBond()
        Deprecated.
        As of Marvin 14.7.7, no replacement.
        Not supported feature.
        Determines whether the structure represents only one bond and zero or two atoms. Determines whether the structure represents only one atom and an arbitrary number of bonds.
        Overrides:
        isBond in class MoleculeGraph
        Returns:
        true if the root structure represents a bond and there are no R-groups, false otherwise
      • isReaction

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

        public boolean canBeReactionComponent()
        Tests whether an object of this class can be a reaction component. This implementation returns false, an RgMolecule cannot be a reaction component.
        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
      • 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
      • getMostSimplifiedMolecule

        protected Molecule getMostSimplifiedMolecule()
        Gets the simplified molecule object even if there is a parent document with other objects.
        Overrides:
        getMostSimplifiedMolecule in class Molecule
        Returns:
        the root structure if there are no R-groups present, this otherwise
        Since:
        Marvin 4.1.13, 09/20/2007
      • addRgroupsTo

        public RgMolecule addRgroupsTo​(Molecule m)
        Creates an RgMolecule containing R-groups of this object from the 'simplified molecule' object made of 'm'.
        Parameters:
        m - the simple molecule object
        Returns:
        RgMolecule and the specified molecule as root
        Since:
        Marvin 3.1
      • cleanupRemovedRgroupMember

        public void cleanupRemovedRgroupMember​(MoleculeGraph m,
                                               int f)
        Clean-up after R-group removal.
        Specified by:
        cleanupRemovedRgroupMember in interface chemaxon.struc.RgMoleculeGraphIface
        Parameters:
        m - the removed R-group member
        f - clean-up flags
        Since:
        Marvin 4.1, 11/25/2005
      • removeAllBonds

        public void removeAllBonds()
        Remove all bonds from the root structure, and from all the R-groups.
        Overrides:
        removeAllBonds 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
      • isRealAtomParent

        protected boolean isRealAtomParent()
        R-group molecule objects cannot be real node parents.
        Overrides:
        isRealAtomParent in class MoleculeGraph
        Returns:
        false
        Since:
        Marvin 3.0
      • 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
      • 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
      • 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 location
        See Also:
        MoleculeGraph.orix
      • fuse

        public void fuse​(MoleculeGraph g,
                         boolean check)
        Add the atoms and bonds of another molecule.
        Overrides:
        fuse in class MoleculeGraph
        Parameters:
        g - 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
      • checkConsistency

        @Deprecated
        public void checkConsistency()
        Deprecated.
        As of Marvin 5.7, no replacement.
        Not intended for public use, it was intended only for internal debugging.
        Checks the internal consistency of the structure. Use this method for debugging.
        Overrides:
        checkConsistency in class Molecule
        Throws:
        RuntimeException - if inconsistency found
        Since:
        Marvin 5.0, 11/06/2007
      • fuse0

        protected void fuse0​(MoleculeGraph graph,
                             boolean check)
        Add those nodes and edges of a graph that are not already elements. If the graph is a reaction and the root structure is not a reaction then the root structure will become a reaction determined by the reaction arrow corresponding to the graph. For each connected component of the graph checks if it contains an atom connected to an R-group in this RgMolecule; if yes then also adds the component to that R-group, otherwise adds it to the root structure.
        Overrides:
        fuse0 in class Molecule
        Parameters:
        graph - the graph that will be fused into this 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
      • mergeAtoms

        @Deprecated
        public void mergeAtoms​(MolAtom that,
                               MolAtom a)
        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
        a - the other atom
      • setSgroupParent

        public void setSgroupParent​(MolAtom a,
                                    Sgroup sg,
                                    boolean set)
        Sets or unsets an S-group as a parent of an atom in the root structure or an R-group.
        Overrides:
        setSgroupParent in class Molecule
        Parameters:
        a - the atom
        sg - the S-group
        set - set (true) or unset (false)
        Throws:
        IllegalArgumentException - if neither root, nor any R-group contains the atom
        Since:
        Marvin 3.0
      • clonecopy

        public void clonecopy​(MoleculeGraph g)
        Make another molecule identical to this one. If the target molecule is not an RgMolecule, then only the root structure will be cloned.
        Overrides:
        clonecopy in class Molecule
        Parameters:
        g - the target molecule
      • clonecopy

        public void clonecopy​(int[] iatoms,
                              MoleculeGraph g)
        Copies the specified atoms of this graph to another one. The RgMolecule implementation of this method is incomplete, R-groups are not handled.
        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
      • isSelfReference

        public boolean isSelfReference​(MProp p)
        Tests whether the specified property is a self reference to the molecule.
        Overrides:
        isSelfReference in class MoleculeGraph
        Parameters:
        p - the property
        Since:
        Marvin 4.1.6, 02/11/2007
      • 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 molecule
      • getFormula

        public 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. Returns 0 if the molecule contains R-group or reaction
        Overrides:
        getMass in class MoleculeGraph
        Returns:
        the molecular weight
      • newInstance

        public MoleculeGraph newInstance()
        Creates a new RgMolecule object. The dimension and the origin coordinates will be the same as in the original molecule.
        Overrides:
        newInstance in class Molecule
        Returns:
        an RgMolecule object
      • newSelectionMolecule

        public SelectionMolecule newSelectionMolecule()
        Creates a new SelectionMolecule object appropriate for storing selection from this molecule.
        Overrides:
        newSelectionMolecule in class Molecule
        Returns:
        an empty selection molecule
        Since:
        Marvin 4.1, 11/24/2005
      • makeItSimilar

        protected void makeItSimilar​(MoleculeGraph g)
        Copies some properties of this molecule to the other one specified as argument. Copies properties in the root structures.
        Overrides:
        makeItSimilar in class Molecule
        Parameters:
        g - the molecule to change
      • 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 2.9
      • transform

        public void transform​(CTransform3D t,
                              boolean incg)
        Apply a transformation matrix to the atomic coordinates.
        Overrides:
        transform in class Molecule
        Parameters:
        t - the transformation matrix
        incg - increase grinvCC or not
      • 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
      • getLonePairCount

        public int getLonePairCount​(int i)
        Gets the number of lone pairs.
        Overrides:
        getLonePairCount in class MoleculeGraph
        Parameters:
        i - atom index
        Returns:
        the number of lone pairs
      • aromatize

        public void aromatize​(int method)
        Aromatizes molecule. Changes the bonds.
        Overrides:
        aromatize in class Molecule
        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:
        SecurityException - cannot load module because of a security problem (firewall)
        Since:
        Marvin 3.4, Marvin 4.1
        See Also:
        MoleculeGraph.AROM_BASIC, MoleculeGraph.AROM_GENERAL, Document about aromatization
      • aromatize

        public void aromatize​(int method,
                              boolean checkAmbiguity)
        Aromatizes molecule. Changes the bonds.
        Overrides:
        aromatize in class Molecule
        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
        checkAmbiguity - Specifies whether ANY bonds should be considered during aromatization.
        Throws:
        SecurityException - cannot load module because of a security problem (firewall)
        Since:
        Marvin 3.4, Marvin 4.1
        See Also:
        MoleculeGraph.AROM_BASIC, MoleculeGraph.AROM_GENERAL, Document about aromatization
      • 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
      • toString

        public String toString()
        Overrides Object.toString() to ease debugging.
        Overrides:
        toString in class MoleculeGraph
        Returns:
        a string representation of the object
        Since:
        4.1, 11/28/2005
      • createGearch

        protected chemaxon.struc.gearch.MoleculeGraphGearch createGearch()
        Overrides:
        createGearch in class Molecule
      • getMaxAttachmentPointOrder

        public int getMaxAttachmentPointOrder​(int rgroupID)
        Gets the maximal attachment point order of R-group definition molecules specified by an R-group ID. The attachment point order of an R-gruop definition molecule is the maximal attachment point order of its atoms.
        Parameters:
        rgroupID - the rgroup identifier to specify the R-group definition molecules.
        Returns:
        the maximal attachment point order of the definition molecules.
        Since:
        Marvin 5.4
      • clearObjects

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

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

        public void removeObject​(MObject mo)
        Specified by:
        removeObject in interface chemaxon.struc.MObjectContainer
        Overrides:
        removeObject in class Molecule
      • selectAllObjects

        public void selectAllObjects​(boolean s)
        Specified by:
        selectAllObjects in interface chemaxon.struc.MObjectContainer
        Overrides:
        selectAllObjects in class Molecule
      • getAllObjects

        public List<MObject> getAllObjects()
        Specified by:
        getAllObjects in interface chemaxon.struc.MObjectContainer
        Overrides:
        getAllObjects in class Molecule
      • 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()
      • 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. In case of ring bonds the ring sizes of the ring for the existence of CIS/TRANS specific bond should be checked before calling this method as ring sizes are not checked in this method.
        Overrides:
        canBeCT in class MoleculeGraph
        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 otherwise.
        Since:
        Marvin 4.0 1/23/2005
      • 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.
      • 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.
      • setRestH

        public void setRestH​(int rgroupIndex)
        Sets the restH condition on an R-group definition.
        Parameters:
        rgroupIndex - the index of the R-group definition
      • removeRestH

        public void removeRestH​(int rgroupIndex)
        Removes the restH condition from an R-group definition.
        Parameters:
        rgroupIndex - the index of the R-group definition
      • isRestH

        public boolean isRestH​(int rgroupIndex)
        Informs whether the restH condition is set to the referenced R-group definition.
        Parameters:
        rgroupIndex - the index of the R-group definition
        Returns:
        true if the restH condition is set false otherwise
      • setDependentRgroupDefinition

        public void setDependentRgroupDefinition​(int rgroupIndexIf,
                                                 int rgroupIndexThen)
        Sets the dependent R-group definition (rgroupIndexThen) for the referenced R-group definition (rgroupIndexIf).
        Parameters:
        rgroupIndexIf - the R-group definition on which the other one depends
        rgroupIndexThen - the R-group definition which depends on the other one
      • getDependentRgroupDefinition

        public int getDependentRgroupDefinition​(int rgroupIndex)
        Gets the R-group definition's index which depends on the referenced R-group definition.
        Parameters:
        rgroupIndex - the R-group definition index
        Returns:
        the index of the dependent R-group definition or -1 if none exists
      • removeDependentRgroupDefinition

        public void removeDependentRgroupDefinition​(int rgroupIndex)
        Removes the dependent R-group definition of the referenced R-group definition.
        Parameters:
        rgroupIndex - the R-group definition ID
      • getRgroupDisplayLabel

        public String getRgroupDisplayLabel​(int rgroupIndex)
        Specified by:
        getRgroupDisplayLabel in interface chemaxon.struc.RgMoleculeGraphIface