Class MoleculeGraph

java.lang.Object
chemaxon.struc.MoleculeGraph
All Implemented Interfaces:
MoleculeWithValence<MolAtom>, chemaxon.core.structure.MoleculeForBuilder, MTransformable, StereoConstants, Serializable
Direct Known Subclasses:
Molecule, SelectionMolecule

@PublicApi public class MoleculeGraph extends Object implements MoleculeWithValence<MolAtom>, MTransformable, StereoConstants, chemaxon.core.structure.MoleculeForBuilder, Serializable
A graph consisting of MolAtom nodes and MolBond edges.
Since:
Marvin 3.0, 10/11/2002
See Also:
  • Field Details

    • INITIAL_CAPACITY

      protected static final int INITIAL_CAPACITY
      Initial capacity of the atoms and bonds vectors.
      See Also:
    • AROM_BASIC

      public static final int AROM_BASIC
      Basic aromatization.
      Since:
      Marvin 4.1, 12/09/2005
      See Also:
    • AROM_GENERAL

      public static final int AROM_GENERAL
      General (Daylight conform) aromatization.
      Since:
      Marvin 4.1, 12/09/2005
      See Also:
    • AROM_LOOSE

      public static final int AROM_LOOSE
      Loose aromatization.
      Since:
      Marvin 5.2, 01/11/2008
      See Also:
    • AROM_SUBSTRUCTURE

      public static final int AROM_SUBSTRUCTURE
      Substructure aromatization. Used internally.
      Since:
      Marvin 5.3, 09/14/2009
      See Also:
    • AROM_AMBIGUOUS

      public static final int AROM_AMBIGUOUS
      Aromatization type for ambiguous 5-membered rings. This option of aromatization checks 5-membered rings with bond pattern similar to pyrrole and having A, AH, Q, QH, atom list (with ambiguous atom types) or not list at the N position (with the two single bonds). In that particular ring, the bonds are replaced by "single or aromatic" and "double or aromatic" bonds. Fusion with aromatic rings are tricky, the aromatic rings should be aromatized first.
      Since:
      Marvin 5.4, 08/14/2010
      See Also:
    • AROM_CHUCKEL

      public static final int AROM_CHUCKEL
      Huckel aromatization.
      Since:
      Marvin 16.12, 09/12/2016
      See Also:
    • DEAROM_GENERAL

      public static final int DEAROM_GENERAL
      General dearomatization.
      Since:
      Marvin 5.2.3, 06/29/2008
      See Also:
    • DEAROM_HUCKELCHECK

      public static final int DEAROM_HUCKELCHECK
      Dearomatize method which dearomatizes only that molecules which fullfills the Huckel's rule.
      Since:
      Marvin 5.2.3, 06/29/2008
      See Also:
    • DEAROM_HUCKELCHECK_EX

      public static final int DEAROM_HUCKELCHECK_EX
      Dearomatize method which dearomatizes only that molecules which fullfills the Huckel's rule. The same as DEAROM_HUCKELCHECK but throws exception if dearomatization fails.
      Since:
      Marvin 5.2.3, 06/29/2008
      See Also:
    • INVALID_LINKNODE_MESSAGE

      public static final String INVALID_LINKNODE_MESSAGE
      See Also:
    • DIM_MASK

      protected static final int DIM_MASK
      Dimension bits in flags.
      See Also:
    • AUTO_UNGROUP

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) protected static final int AUTO_UNGROUP
      Deprecated, for removal: This API element is subject to removal in a future version.
      Automatic ungroup bit in flags. Specified changes will result in an automatic ungroup of the affected S-groups. Changes causing ungroup:
      • changes in atom type
      • changes in bond type
      See Also:
    • VALENCE_CHECK

      protected static final int VALENCE_CHECK
      Valence check calculation bit in flags. Valence check will be called according to this flag.
      Since:
      Marvin 5.4
      See Also:
    • VALENCE_CHECK_AMBIGUOUS

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) protected static final int VALENCE_CHECK_AMBIGUOUS
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.0, replaced by ValenceCheckOptions.
      Valence check calculation bit in flags for checking ambiguous aromatic atoms requiring . Valence check of ambiguous atoms will be called according to this flag.
      Since:
      Marvin 5.9
      See Also:
    • RMCLEANUP_NONE

      public static final int RMCLEANUP_NONE
      Do not perform any clean-up methods when removing an atom or a bond.
      Since:
      Marvin 3.1
      See Also:
    • RMCLEANUP_EDGES

      public static final int RMCLEANUP_EDGES
      When removing an atom or a bond, also remove the bond(s) from the atom object(s).
      Since:
      Marvin 3.1
      See Also:
    • CACHE_REMOVE_ALL

      public static final int CACHE_REMOVE_ALL
      Cache removal option for clearing all cached info.
      See Also:
    • CACHE_REMOVE_CACHEMEMORY

      public static final int CACHE_REMOVE_CACHEMEMORY
      Cache removal option for cacheMemory.
      See Also:
    • RMCLEANUP_STEREO

      public static final int RMCLEANUP_STEREO
      When removing a H atom, keep stereo information unchanged.
      Since:
      Marvin 3.1
      See Also:
    • RMCLEANUP_MOBJECT

      public static final int RMCLEANUP_MOBJECT
      Remove graphics objects containing the removed atom.
      Since:
      Marvin 4.1, 03/07/2006
      See Also:
    • RMCLEANUP_FIXCOMPONENT

      protected static final int RMCLEANUP_FIXCOMPONENT
      Remove called from RxnMolecule.fixComponent. For internal use only.
      Since:
      Marvin 4.1.3, 11/16/2006
      See Also:
    • RMCLEANUP_PARENTDOC

      public static final int RMCLEANUP_PARENTDOC
      Remove atom from parent document.
      Since:
      Marvin 4.1.13, 09/06/2007
      See Also:
    • RMCLEANUP_ALL

      public static final int RMCLEANUP_ALL
      Perform all clean-up methods when removing an atom or a bond.
      Since:
      Marvin 3.1
      See Also:
    • GRINV_NOHYDROGEN

      public static final int GRINV_NOHYDROGEN
      Graph invariant option for ignoring explicit hydrogens.
      See Also:
    • GRINV_STEREO

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

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

      public static final int GRINV_USEMAPS
      Graph invariant option for calculating graph invariants considering atom maps also.
      See Also:
    • GRINV_VALUE_OPTIONS

      public static final int GRINV_VALUE_OPTIONS
      Unified mask of graph invariant options affecting grinv value. But see values below that are not included into this value when introducing a new one to avoid undesired side-effects.
      See Also:
    • GRINV_DONT_STORE

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

      public static final int CACHE_REMOVE_GRINVMODULE
      Cache removal option for remove module used in graph invariant calculation.
      See Also:
    • CACHE_REMOVE_PARITYMODULE

      public static final int CACHE_REMOVE_PARITYMODULE
      Cache removal option for remove module used in parity calculation.
      See Also:
    • CACHE_REMOVE_AROMATAMODULE

      public static final int CACHE_REMOVE_AROMATAMODULE
      Cache removal option for remove module used in aromatization.
      See Also:
    • CACHE_REMOVE_SSSRMODULE

      public static final int CACHE_REMOVE_SSSRMODULE
      Cache removal option for remove module used in sssr.
      See Also:
    • CACHE_REMOVE_TABS

      public static final int CACHE_REMOVE_TABS
      Cache remove option to clear ctab and btab.
      See Also:
    • MIN_RING_SIZE_FOR_TRANS_DB

      public static final int MIN_RING_SIZE_FOR_TRANS_DB
      The minimal size of the ring for the existence of TRANS double bond.
      See Also:
    • OMIT_POSTCLEAN

      public static final int OMIT_POSTCLEAN
      Omit arranging process after the hydrogen addition.
      See Also:
      • chemaxon.calculations.hydrogenize.Hydrogenize#convertImplicitHToExplicit(MoleculeGraph, int)
      • Constant Field Values
    • FRAG_BASIC

      public static final int FRAG_BASIC
      Basic fragmentation, only atom - atom connections (bond) are considered.
      See Also:
    • FRAG_KEEPING_MULTICENTERS

      public static final int FRAG_KEEPING_MULTICENTERS
      Fragmentation without breaking multicenter S-groups.
      See Also:
    • FRAG_KEEPING_SGROUPS

      public static final int FRAG_KEEPING_SGROUPS
      Fragmentation without breaking S-groups.
      See Also:
    • FRAG_TYPE_COUNT

      public static final int FRAG_TYPE_COUNT
      Number of fragmentation types.
      See Also:
    • superGraph

      protected transient MoleculeGraph superGraph
      Parent of all parents.
    • parentGraph

      protected transient MoleculeGraph parentGraph
      The structure that contains this molecule graph as a substructure.
    • theAtoms

      protected transient MolAtom[] theAtoms
      The atoms (nodes).
    • atomCount

      protected transient int atomCount
      The number of atoms.
    • theBonds

      protected transient MolBond[] theBonds
      The bonds (edges).
    • bondCount

      protected transient int bondCount
      The number of bonds.
    • orix

      protected transient double orix
      Origin x.
    • oriy

      protected transient double oriy
      Origin y.
    • oriz

      protected transient double oriz
      Origin z.
    • grinvCC

      protected transient long grinvCC
      Graph invariant change count. The number of times the molecule (and the corresponding graph invariants) may have changed since the creation of the molecule.
      See Also:
    • cacheMemory

      protected transient List<Object[]> cacheMemory
    • ctab

      protected transient int[][] ctab
      Connection table.
    • btab

      protected transient BondTable btab
      Bond table.
    • gearch

      public transient chemaxon.struc.gearch.MoleculeGraphGearch gearch
    • propertyContainer

      protected transient MPropertyContainer propertyContainer
    • useOnlyFirstAtomInStereoCalculation

      protected transient boolean useOnlyFirstAtomInStereoCalculation
  • Constructor Details

    • MoleculeGraph

      public MoleculeGraph(MoleculeGraph p, int na, int nb)
      Construct a molecule or fragment with the specified number of atoms and bonds.
      Parameters:
      p - the molecule that contains the created fragment
      na - no reallocation needed until the number of atoms is less than this value
      nb - no reallocation needed until the number of bonds is less than this value
    • MoleculeGraph

      public MoleculeGraph()
      Construct a 2 dimensional molecule.
  • Method Details

    • getParent

      public final MoleculeGraph getParent()
      Gets the parent graph that contains this substructure.
      Returns:
      the parent, or null if this is the supergraph
      Since:
      Marvin 2.6
    • getForefather

      public final MoleculeGraph getForefather()
      Gets the first parent.
      Returns:
      parent of all parents
      Since:
      Marvin 2.9.11
    • getLock

      public final Object getLock()
      Gets the lock object for synchronization. The lock object is the top parent.
      Returns:
      the lock object
      Since:
      Marvin 2.6
    • add

      public void add(MolAtom atom)
      Adds an atom to the molecule.
      Parameters:
      atom - the atom object
    • add

      public void add(MolBond bond)
      Adds a bond to the molecule. If the molecule graph is a superGraph, the bond is also added to its endpoints (two MolAtom objects).
      Parameters:
      bond - the bond object
    • add

      public void add(MolBond bond, boolean checkParallel)
      Add a bond to the molecule. If the second parameter is true, there an exception thrown when there is already a bond between the given MolAtoms. There is no checking if either is SgroupAtom. If the molecule graph is a superGraph, the bond is also added to its endpoints (two MolAtom objects).
      Parameters:
      bond - the bond object
    • addAtom0

      protected void addAtom0(MolAtom atom)
      Adds an atom.
      Parameters:
      atom - the atom reference
    • addAtomWithoutChangingIt

      protected int addAtomWithoutChangingIt(MolAtom atom)
      Adds an atom without setting its parentGraph and index fields.
      Parameters:
      atom - the atom reference
      Returns:
      the new atom index
    • addSimpleAtomWithoutChangingIt

      protected int addSimpleAtomWithoutChangingIt(MolAtom atom)
      Adds a non-SgroupAtom atom without setting its parentGraph and index fields.
      Parameters:
      atom - the atom reference
      Returns:
      the new atom index
    • addAtomToFragment

      protected void addAtomToFragment(MolAtom atom)
      Adds an atom to a fragment.
      Parameters:
      atom - the atom reference
    • addBond0

      protected void addBond0(MolBond bond)
      Adds a bond.
      Parameters:
      bond - the bond reference
    • addBondWithoutChangingIt

      protected final int addBondWithoutChangingIt(MolBond bond)
      Adds a bond without setting its parentGraph and index fields.
      Parameters:
      bond - the bond reference
      Returns:
      the new bond index
    • pack

      public void pack()
      Reduce memory usage.
    • removeAtom

      public void removeAtom(MolAtom atom)
      Removes an atom and its bonds by reference.
      Parameters:
      atom - the atom
      Since:
      Marvin 5.3, 04/30/2009
    • removeAtom

      public void removeAtom(int i)
      Removes an atom and its bonds by index.
      Parameters:
      i - the atom index
      Since:
      Marvin 5.3, 04/30/2009
    • removeBond

      public void removeBond(MolBond bond)
      Removes a bond by reference.
      Parameters:
      bond - the bond
      Since:
      Marvin 5.3, 04/30/2009
    • removeBond

      public void removeBond(int i)
      Removes a bond by index.
      Parameters:
      i - the bond index
      Since:
      Marvin 5.3, 04/30/2009
    • removeAllBonds

      public void removeAllBonds()
      Removes all bonds.
      Since:
      Marvin 5.3, 04/30/2009
    • removeAll

      public void removeAll()
      Removes all the atoms and bonds.
    • getDocument

      public MDocument getDocument()
      Gets the document object.
      Returns:
      a Marvin document object
      Since:
      Marvin 3.3
    • getParentDocument

      protected MDocument getParentDocument()
      Gets the document or the document of the parent graph. Moved to separate method because R-groups in RgMolecule should not have a normal document parent. If two R-groups would have a common document parent, then their bounds would be determined incorrectly because the graphics objects are common.
      Returns:
      the parent document
      Since:
      Marvin 4.1.1, 08/23/2006
    • getDocumentForChild

      protected MDocument getDocumentForChild(MoleculeGraph g)
      Gets the parent document for a child molecule graph.
      Parameters:
      g - the child graph or this
      Returns:
      the parent document
      Since:
      Marvin 4.1.1, 08/23/2006
    • smol

      public final Smolecule smol()
      Gets a Smolecule representation of this molecule.
      Returns:
      the Smolecule implementation
      Since:
      Marvin 5.2.2, 04/24/2009
    • createSmolecule

      protected final Smolecule createSmolecule()
      Creates a Smolecule represenation of this molecule.
      Returns:
      the new Smolecule
      Since:
      Marvin 5.2.2, 04/24/2009
    • setDim

      public void setDim(int d)
      Sets the dimension. If the molecule is in 0D and set to 2D or 3D then stereo information is removed.
      Parameters:
      d - 0, 2, or 3
      See Also:
    • getDim

      public int getDim()
      Gets the dimension.
      Returns:
      0, 2, or 3
      See Also:
    • getFlags

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

      protected void setFlags(int f)
      Sets the flags of the molecule.
      Parameters:
      f - the flags
      Since:
      Marvin 5.0.1, 02/10/2008
      See Also:
      • flags
    • isAbsStereo

      public boolean isAbsStereo()
      Gets the absolute stereoconfiguration flag. "Chiral flag" in MDL molfiles.
      Returns:
      true for absolute, false for relative configuration
      See Also:
    • setAbsStereo

      public void setAbsStereo(boolean c)
      Sets the absolute stereoconfiguration flag.
      Parameters:
      c - the absolute stereoconfiguration flag
      See Also:
    • clear

      public void clear()
      Clears the molecule. Does the same as clearForImport() but also clears the atoms vector.
      See Also:
    • clearForImport

      public void clearForImport(String format)
      Clears the bonds vector, the properties, the flags, and sets the origin coordinates to 0. The molecule dimension is set to 2.
      Parameters:
      format - input file format, neglected
      See Also:
    • removeAtom

      public void removeAtom(MolAtom atom, int cleanupFlags)
      Removes an atom and its bonds with extra clean-up options. This method is for internal use only. Use removeAtom(MolAtom) instead unless you are sure what you are doing.
      Parameters:
      atom - the atom
      cleanupFlags - extra clean-up methods
      Since:
      Marvin 5.3, 04/30/2009
      See Also:
    • removeAtom

      public void removeAtom(int i, int cleanupFlags)
      Removes an atom and its bonds with extra clean-up options. This method is for internal use only. Use removeAtom(int) instead unless you are sure what you are doing.
      Parameters:
      i - the atom index
      cleanupFlags - extra clean-up methods
      Since:
      Marvin 5.3, 04/30/2009
      See Also:
    • setAtom0

      protected void setAtom0(int i, MolAtom atom)
      Sets the atom at the specified index.
      Parameters:
      i - atom index
      atom - new atom reference
    • setBond

      @Deprecated public void setBond(int i, MolBond b)
      Deprecated.
      as of Marvin 6.2, may construct inconsistent MoleculeGraph. Use removeBond(MolBond) for bond removal and add(MolBond) for adding a new bond to the molecule.
      Sets the bond at the specified index.
      Parameters:
      i - bond index
      b - the bond reference
    • replaceBond

      @Deprecated public void replaceBond(MolBond oldb, MolBond newb)
      Deprecated.
      as of Marvin 6.2, may construct inconsistent MoleculeGraph. Use removeBond(MolBond) for removal and add(MolBond) for adding a new bond to the molecule.
      Replaces an bond by another one.
      Parameters:
      oldb - the old bond
      newb - the new bond
      Since:
      Marvin 5.3, 04/30/2009
    • setAtomSetSeqs

      public final void setAtomSetSeqs(int id)
      Sets the set sequence number of all atoms.
      Parameters:
      id - the set sequence number
      Since:
      Marvin 4.0
    • setBondSetSeqs

      public final void setBondSetSeqs(int id)
      Sets the set sequence number of all bonds.
      Parameters:
      id - the set sequence number
      Since:
      Marvin 4.0
    • getGrinv

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

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

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

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public int getGrinv(int[] gi, boolean uniqueFlag)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 4.0, replaced by getGrinv(int[], int).
      Usage:
                   getGrinv(gi, uniqueFlag ? GRINV_OLDSTEREO : 0);
                   
      Gets the graph invariants (canonical labels). Same like the former method but if the boolean flag is true, chiral info is also added to invariants (needed for unique SMILES).
      Parameters:
      gi - output array, its length must be equal to the number of atoms
      uniqueFlag - boolean flag
      Returns:
      the number of different graph invariants
      Throws:
      SecurityException - the GraphInvariants module cannot be loaded because of security reasons (firewall)
      Since:
      Marvin 3.3
      See Also:
    • getGrinv

      public int getGrinv(int[] gi, int options)
      Gets the graph invariants (canonical labels). Optionally, chiral info can be added to the invariants and hydrogens can be ignored. Graph invariants are copied into the specified array, that must have the same length as the number of atoms in the molecule.

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

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

      public int calcDehydrogenizedGrinv(int[] gi)
      Calculates the graph invariants with the assumption that hydrogens are removed. Entries corresponding to hydrogens are filled with -1 values in the output array. Only normal Hydrogen atoms are removed, isotopes (Deuterium and Tricium) are not.
      Parameters:
      gi - output array, its length must be equal to the number of atoms
      Returns:
      the number of different graph invariants
      Throws:
      SecurityException - the GraphInvariants module cannot be loaded because of security reasons (firewall)
      Since:
      Marvin 3.1
      See Also:
    • createDehydrogenizedReadOnlyGraph

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

      protected int[] getGrinv()
      Gets the graph invariants array. This array is cached, so clone it if you plan to modify it.
      Returns:
      the grinv field
      Since:
      Marvin 3.0
      See Also:
    • getGrinvCC

      public final long getGrinvCC()
      Gets the graph invariant change count. Returns the number of times the graph invariants may have changed since the creation of the molecule.
      Returns:
      graph invariant change count
      See Also:
    • setGrinvCC

      protected final void setGrinvCC(long g)
      Sets the graph invariant change count.
      Parameters:
      g - graph invariant change count
      Since:
      Marvin 3.4
      See Also:
    • incGrinvCC

      protected final void incGrinvCC()
      Increases the graph invariant change count and sets grinv to null. Incremented in the following cases:
      • atom, bond addition, removal, property change
      • atomic coordinate change
      • dimension change
      Since:
      Marvin 3.5
      See Also:
    • incGrinvCC

      protected final void incGrinvCC(boolean isSSSRReset)
    • incGrinvCCOnly

      public final void incGrinvCCOnly()
      Increases the graph invariant change count, but does not change grinv. Handle with care, it may force certain data to be recalculated!
      Since:
      Marvin 4.0 5/07/2005
      See Also:
    • resetCtab

      protected void resetCtab()
      An operation performed that changed the connection table and the graph invariants.
      Since:
      Marvin 2.6
    • resetGrinvInParents

      protected final void resetGrinvInParents()
      Graph invariants must be recalculated for this graph and all parent graphs.
    • regenCtab

      protected void regenCtab()
      Regenerates the connection table. See getCtab().
      Since:
      Marvin 16.6.6
    • regenBtab

      protected void regenBtab()
      Regenerates the bond table. See #getBtab().
      Since:
      Marvin 16.6.6
    • addExplicitHydrogens

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean addExplicitHydrogens(int f)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.7, replaced by Hydrogenize.convertImplicitHToExplicit(MoleculeGraph, MolAtom[], int).
      Usage:
                   Hydrogenize.convertImplicitHToExplicit(molecule, null, f);
                   
      Adds explicit H atoms instead of the current implicit ones.
      Parameters:
      f - flags specifying special features, otherwise if f is 0, then the result equals with hydrogenize(true).
      Returns:
      true for success, false if an error occurred
      Throws:
      SecurityException - cannot load module because of a security problem (firewall)
      Since:
      Marvin 4.1.3, 02/11/2006
      See Also:
    • addExplicitHydrogens

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean addExplicitHydrogens(int f, MolAtom[] atoms)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.7, replaced by Hydrogenize.convertImplicitHToExplicit(MoleculeGraph, MolAtom[], int).
      Usage:
                   Hydrogenize.convertImplicitHToExplicit(molecule, atoms, f);
                   
      Adds explicit H atoms instead of the current implicit ones.
      Parameters:
      f - flags specifying special features, otherwise if f is 0, then the result equals with hydrogenize(true).
      atoms - add hydrogens to these atoms only
      Returns:
      true for success, false if an error occurred
      Throws:
      SecurityException - cannot load module because of a security problem (firewall)
      Since:
      Marvin 5.0, 02/23/2007
      See Also:
    • hydrogenize

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean hydrogenize(boolean add)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Implicit/explicit Hydrogen conversion. Adds explicit H atoms instead of the current implicit ones, or removes explicit H atoms and increases the number of implicit hydrogens.
      Parameters:
      add - add explicit H atoms if true, remove if false
      Returns:
      true for success, false if an error occurred
      Throws:
      SecurityException - cannot load module because of a security problem (firewall)
    • addExplicitLonePairs

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void addExplicitLonePairs()
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.7, replaced by Hydrogenize.convertImplicitLonePairsToExplicit(MoleculeGraph, MolAtom[]).
      Usage:
                   Hydrogenize.convertImplicitLonePairsToExplicit(molecule, null);
                   
      Adds explicit lone pairs.
      Throws:
      SecurityException - cannot load module because of a security problem (firewall)
      Since:
      Marvin 3.5, 07/06/2004
    • removeExplicitLonePairs

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void removeExplicitLonePairs()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Removes explicit lone pairs.
      Throws:
      SecurityException - cannot load module because of a security problem (firewall)
      Since:
      Marvin 3.5, 07/06/2004
    • implicitizeHydrogens

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public final void implicitizeHydrogens(int f)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.7, replaced by Hydrogenize.convertExplicitHToImplicit(MoleculeGraph, int).
      Usage:
                   Hydrogenize.convertExplicitHToImplicit(molecule, f);
                   
      Removes explicit bound Hydrogens from the molecule graph and converts them to implicit.
      Parameters:
      f - flags specifying special H atom types to include
      Since:
      Marvin 3.1
    • implicitizeHydrogens

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void implicitizeHydrogens(int f, MolAtom[] atoms)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.7, replaced by Hydrogenize.convertExplicitHToImplicit(MoleculeGraph, MolAtom[], int).
      Usage:
                   Hydrogenize.convertExplicitHToImplicit(mol, atoms, f);
                   
      Removes explicit bound Hydrogens from the molecule graph and converts them to implicit.
      Parameters:
      f - flags specifying special H atom types to include
      atoms - the subset of H atoms to include or null for all
      Since:
      Marvin 4.1.3, 11/09/2006
    • implicitizeHydrogens

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void implicitizeHydrogens(int f, MolAtom[] atoms, boolean check)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.7, replaced by Hydrogenize.convertExplicitHToImplicit(MoleculeGraph, MolAtom[], int, boolean).
      Usage:
                   Hydrogenize.convertExplicitHToImplicit(mol, atoms, f, check);
                   
      Removes explicit bound Hydrogens from the molecule graph and converts them to implicit.
      Parameters:
      f - flags specifying special H atom types to include
      atoms - the subset of H atoms to include or null for all
      check - false if H atoms not belonging to the molecule should be skipped, true if such atoms should generate a RuntimeException
      Since:
      Marvin 5.0, 06/29/2007
    • implicitizeHydrogens0

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) protected boolean implicitizeHydrogens0(int f, MolAtom[] atoms, boolean check)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.7, replaced by Hydrogenize.convertExplicitHToImplicit(MoleculeGraph, MolAtom[], int, boolean).
      Usage:
                   Hydrogenize.convertExplicitHToImplicit(mol, atoms, f, check);
                   
      Returns:
      true if success else false
    • fuse

      public void fuse(MoleculeGraph graph, boolean check)
      Adds atoms and bonds of another molecule to this one. If the other molecule is in 2D and this molecule in 0D then stereo information is removed from this molecule.
      Parameters:
      graph - the other molecule graph
      check - true if a containment check should be performed to ensure that only those atoms and bonds are added that are not already elements - false if the molecule is known to be disjoint from this one and this check can be safely skipped
      Since:
      Marvin 5.0
    • fuse

      public final void fuse(MoleculeGraph graph)
      Adds those atoms and bonds of another molecule to this one that are not already elements. Made final in Marvin 5.0. From Marvin 5.0, subclasses should implement fuse(chemaxon.struc.MoleculeGraph, boolean) instead.
      Parameters:
      graph - the other molecule graph
    • fuse0

      protected void fuse0(MoleculeGraph g, boolean check)
      Adds the atoms and bonds of another molecule to this one.
      Parameters:
      g - the other molecule
      check - true if a containment check should be performed to ensure that only those atoms and bonds are added that are not already elements - false if the molecule is known to be disjoint from this one and this check can be safely skipped
      Since:
      Marvin 5.0
    • checkConsistency

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void checkConsistency()
      Deprecated, for removal: This API element is subject to removal in a future version.
      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.
      Throws:
      RuntimeException - if inconsistency found
      Since:
      Marvin 5.0, 11/06/2007
    • checkBondConsistency

      protected void checkBondConsistency()
    • updateDim

      protected final void updateDim(MoleculeGraph m)
      Updates the dimensions when fusing two structures.
      Parameters:
      m - the other molecule
      Since:
      Marvin 4.0.2, 08/26/2005
    • mergeAtoms

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void mergeAtoms(MolAtom replacementAtom, MolAtom origAtom)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.2, use MergeUtil.mergeAtoms(MolAtom, MolAtom, boolean) instead.
      Merges the bonds of an atom with another atom, then adds the atom to the molecule.
      Parameters:
      replacementAtom - the atom which will take place in the molecule after the merge
      origAtom - the original atom which's bonds will be added to the new atom
    • hasValenceError

      public boolean hasValenceError()
      Determines if this molecule has a valence error on any of its atoms.
      Returns:
      true if there is an atom with valence error, false if there is no valence error
      Since:
      Marvin 4.1
      See Also:
    • valenceCheck

      public void valenceCheck()
      Check valence and query property errors for atoms. During this check implicit hydrogens are calculated and the valence error flag is set in case of error. It can be set by a previous call of setValenceCheckOptions(ValenceCheckOptions); which atoms are checked.
      See Also:
    • valenceCheck

      public void valenceCheck(List<MolAtom> v)
      Check valence and query property errors. Check all the atoms if the argument is null. During this check implicit hydrogens are calculated and the valence error flag is set in case of error.
      Parameters:
      v - contains the atoms to check
      See Also:
    • qpropCheck

      public void qpropCheck(List<MolAtom> v)
      Check for query property errors. Check all the atoms if the argument is null.
      Parameters:
      v - contains the atoms to check
      See Also:
    • isSimilarTo

      public boolean isSimilarTo(MoleculeGraph g)
      Tests if the molecule graph is similar to another graph. Two graphs are similar if:
      1. they have the same number of atoms and bonds,
      2. for each atom ai in the first graph, there is a corresponding atom aj in the other graph, with the same graph invariant, "equal properties" and "similar bonds".
      Parameters:
      g - the molecule graph
      Returns:
      true if the graphs are similar, false otherwise
      Since:
      Marvin 3.4.1, 07/21/2004
      See Also:
    • isAtom

      @Deprecated @SubjectToRemoval(date=JUL_01_2025) 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. Note: a one-atom structure has bonds only if it is a fragment.
      Returns:
      true if the number of atoms is one
    • isBond

      @Deprecated @SubjectToRemoval(date=JUL_01_2025) 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 Carbon or MolAtom.EMPTY atoms.
      Returns:
      true if the structure is the representation of a bond
    • isRing

      @Deprecated @SubjectToRemoval(date=JUL_01_2025) public boolean isRing()
      Deprecated.
      As of Marvin 14.7.7, no replacement.
      Not supported feature.
      Tests whether the molecule graph represents a ring.
      Returns:
      true if the graph is a ring, false otherwise
      Since:
      Marvin 4.1, 01/27/2006
    • isSymmetric

      public boolean isSymmetric()
      Tests whether the molecule graph is symmetric. The graph is symmetric if each atom has the same graph invariant value.
      Returns:
      true if the graph is a symmetric, false otherwise
      Since:
      Marvin 4.1, 01/27/2006
    • getName

      public String getName()
      Gets the molecule title/name. It returns an empty string in this basic implementation.
      Returns:
      empty string
      Since:
      Marvin 4.1, 05/28/2006
    • properties

      public MPropertyContainer properties()
      Gets the property container.
      Returns:
      the property container
      Since:
      Marvin 4.1, 05/28/2006
    • revalidateCoordDependentProps

      public void revalidateCoordDependentProps()
      Revalidate coordinate dependent properties. This method should be called at molecule import, after all atomic coordinates and bonds are parsed.
      Since:
      Marvin 4.1, 08/03/2006
    • getAtomCount

      public int getAtomCount()
      Gets the number of atoms.
      Returns:
      the number of atoms
    • getAtomCount

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

      public int getBondCount()
      Gets the number of bonds.
      Returns:
      number of bonds
    • getFormalCharge

      public int getFormalCharge()
      Gets the (total) formal charge of the molecule.
      Returns:
      the formal charge of the molecule
      Since:
      Marvin 5.1.3
    • getTotalCharge

      public int getTotalCharge()
      Gets the total (formal) charge of the molecule. Does the same as the getFormalCharge() method.
      Returns:
      the total charge of the molecule
      Since:
      Marvin 4.1.10
    • isRealAtomParent

      protected boolean isRealAtomParent()
      Can it be a real atom parent?
      Returns:
      true
      Since:
      Marvin 3.0
    • getAtom

      public MolAtom getAtom(int n)
      Gets the nth atom.
      Parameters:
      n - the atom index
      Returns:
      the atom object
    • getBond

      public MolBond getBond(int n)
      Gets the nth bond.
      Parameters:
      n - the bond index
      Returns:
      the bond object
    • setAtom

      @Deprecated public void setAtom(int i, MolAtom atom)
      Deprecated.
      as of Marvin 6.2, may construct inconsistent MoleculeGraph. Use removeAtom(int) for atom removal and add(MolAtom) for adding new atoms.
      Sets the atom at the specified index.
      Parameters:
      i - atom index
      atom - new atom reference
      Since:
      Marvin 5.3, 04/30/2009
    • insertAtom

      @Deprecated public final void insertAtom(int i, MolAtom atom)
      Deprecated.
      as of Marvin 6.2, may construct inconsistent MoleculeGraph. Similar functionality is performed by add(MolAtom).
      Inserts the atom at the specified index.
      Parameters:
      i - atom index
      atom - new atom reference
      Since:
      Marvin 5.3, 04/30/2009
    • insertNullAtoms

      protected void insertNullAtoms(int i, int count)
      Insert nulls into the atom array.
      Parameters:
      i - starting index
      count - number of new entries
      Since:
      Marvin 5.3, 04/30/2009
    • insertBond

      @Deprecated public final void insertBond(int i, MolBond bond)
      Deprecated.
      as of Marvin 6.2, may construct inconsistent MoleculeGraph. Similar functionality is performed by add(MolBond).
      Inserts the bond at the specified index.
      Parameters:
      i - bond index
      bond - new bond reference
      Since:
      Marvin 5.3, 04/30/2009
    • insertBondInOrder

      public void insertBondInOrder(MolBond e, MolBond[] order)
      Insert a bond in the order specified as the second argument.
      Parameters:
      e - the bond to insert
      order - array of bonds defining the order
      Since:
      Marvin 5.3, 04/30/2009
    • insertNullBonds

      protected void insertNullBonds(int i, int count)
      Insert nulls into the bond array.
      Parameters:
      i - starting index
      count - number of new entries
      Since:
      Marvin 5.3, 04/30/2009
    • sortBondsAccordingTo

      public void sortBondsAccordingTo(MolBond[] order)
      Sorts bonds in the same order as they appear in another chemical graph.
      Parameters:
      order - the bonds in the other chemical graph
      Since:
      Marvin 5.3, 04/30/2009
    • getAtomArray

      public MolAtom[] getAtomArray()
      Creates an array of atoms.
      Returns:
      array of atom objects
      Since:
      Marvin 2.6
    • getBondArray

      public MolBond[] getBondArray()
      Creates an array of bonds.
      Returns:
      array of bond objects
      Since:
      Marvin 3.5, 09/02/2004
    • calcCenter

      public void calcCenter(DPoint3 p)
      Calculates the geometrical center.
      Parameters:
      p - reference to the object that will hold the result
      Since:
      Marvin 2.7
    • calcOutRect

      public DPoint3 calcOutRect()
      Calculates the outer rectangle.
      Returns:
      the outer rectangle (x, y, and z direction width of the outer rectangle)
      Since:
      Marvin 4.1
    • calcOutRect

      public void calcOutRect(DPoint3 p)
      Calculates the outer rectangle.
      Parameters:
      p - reference to the object that will hold the result (x, y, and z direction width of the outer rectangle)
      Since:
      Marvin 4.1
    • calcOutRectCenter

      public DPoint3 calcOutRectCenter()
      Calculates the center of the outer rectangle.
      Returns:
      the center
      Since:
      Marvin 4.1
    • calcOutRectCenter

      public void calcOutRectCenter(DPoint3 p)
      Calculates the center of the outer rectangle.
      Parameters:
      p - reference to the object that will hold the result
    • calcCenter

      public DPoint3 calcCenter()
      Calculates the geometrical center.
      Returns:
      center point
    • calcWidth

      public double calcWidth()
      Calculates the molecule width.
      Returns:
      the molecule width
      Since:
      Marvin 3.0
    • calcHeight

      public double calcHeight()
      Calculates the molecule height.
      Returns:
      the molecule height
      Since:
      Marvin 3.0
    • getDesiredLength

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public double getDesiredLength(int atno1, int atno2, int type)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.11, replaced by MolBond.desiredLength(int, int, int, int) and getDim().
      Usage:
                   MolBond.desiredLength(atno1, atno2, type, getDim());
                   
      Gets the ideal bond length in Angstroms.
      Parameters:
      atno1 - atomic number of first molecule
      atno2 - atomic number of second molecule
      type - bond type
      Returns:
      the ideal bond length
    • getDesiredLength

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public double getDesiredLength(MolBond b)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.11, replaced by MolBond.desiredLength(int, int, int, int), MolBond.getType() and getDim().
      Usage:
                   MolBond.desiredLength(atno1, atno2, b.getType, getDim());
                   
      Gets the ideal bond length in Angstroms.
      Parameters:
      b - the bond
      Returns:
      the ideal bond length
      Since:
      Marvin 2.7
    • bondlength

      public double bondlength()
      Calculates the regular bond length.
      Returns:
      the calculated length in Angstroms, or MolBond.CCLENGTH if the molecule has no bonds
    • getLocation

      public DPoint3 getLocation()
      Gets the origin of the molecule.
      Returns:
      the origin
      Since:
      Marvin 2.7
      See Also:
    • setLocation

      public void setLocation(DPoint3 o)
      Set the origin of the molecule.
      Parameters:
      o - the origin
      Since:
      Marvin 2.7
      See Also:
    • moveTo

      public void moveTo(DPoint3 o)
      Move the molecule.
      Parameters:
      o - the new origin
      Since:
      Marvin 2.7
      See Also:
    • transform

      public void transform(CTransform3D t)
      Apply a transformation matrix to the atomic coordinates.
      Specified by:
      transform in interface MTransformable
      Parameters:
      t - the transformation matrix
      Since:
      Marvin 2.7
    • transform

      public void transform(CTransform3D t, boolean incg)
      Apply a transformation matrix to the atomic coordinates.
      Parameters:
      t - the transformation matrix
      incg - graph invariants are changed (true) or not (false)
      Since:
      Marvin 3.0
    • getPoints

      public DPoint3[] getPoints()
      Gets an array containing the atom coordinates.
      Returns:
      atom coordinates array
      Since:
      Marvin 2.9.1
    • getEnclosingCube

      public DPoint3[] getEnclosingCube()
      Gets the cube that encloses the atoms of molecule graph.
      Returns:
      Array of the two corners of the cube: bottom left and top right
      Since:
      Marvin 5.3.2
    • clonecopy

      public void clonecopy(MoleculeGraph m)
      Make another molecule identical to this one.
      Parameters:
      m - the target molecule
    • clonecopy

      public void clonecopy(int[] iatoms, MoleculeGraph g)
      Copies the specified atoms of this molecule graph to another one.
      Parameters:
      iatoms - array of atom indices to copy or null
      g - the target molecule graph
      Since:
      Marvin 5.0.2, 03/11/2008
    • clonecopyMoleculeGraphWithoutSgroups

      protected boolean clonecopyMoleculeGraphWithoutSgroups(int[] cnodes, MolBond[] cedges, int nb, MoleculeGraph graph)
      Copies the specified atoms and bonds of this molecule graph to another one.
      Parameters:
      cnodes - array of atom indices to copy or null
      cedges - array of bonds to copy or null to copy bonds in cnodes only
      nb - number of bonds
      graph - the target molecule graph
      Returns:
      false if the atoms array contains all bond end points, true if there is at least one external bond
      Since:
      Marvin 5.0.2, 03/07/2008
    • cloneAtoms

      protected int cloneAtoms(int[] cnodes, MoleculeGraph graph)
      Copies the specified atoms.
      Parameters:
      cnodes - array of atom indices to copy or null
      graph - the target molecule graph
      Returns:
      the atom count
      Since:
      Marvin 6.0, 2013.02.25.
    • getBonds

      protected MolBond[] getBonds(MolAtom atom)
      Returns the bonds attached to the given atom in this molecule graph. By default, returns the bond array stored in the atom.
      Parameters:
      atom - the atom
      Returns:
      the bonds attached to the given atom in this molecule graph
      Since:
      Marvin 5.5
    • findInArray

      protected static int findInArray(Object[] array, int[] indices, int n, Object o)
      Finds an object in an array.
      Parameters:
      array - the array
      indices - array indices or null
      n - the number of elements
      Returns:
      the object index or -1 if not found
      Since:
      Marvin 5.0.2, 03/07/2008
    • clonelesscopy

      @Deprecated public void clonelesscopy(MoleculeGraph graph)
      Deprecated.
      as of Marvin 6.3.
      Not supported feature.
      Copy to selection. Copies without cloning. Make another molecule identical to this one, but do not clone atoms, bonds, and the properties.
      Parameters:
      graph - the target molecule graph (the selection)
    • hasSelfReferringProperty

      public final boolean hasSelfReferringProperty()
      Tests whether the property list contains the molecule.
      Returns:
      true if the property list contains the molecule, false otherwise
      Since:
      Marvin 4.1.6, 02/11/2007
    • isSelfReference

      public boolean isSelfReference(MProp p)
      Tests whether the specified property is a self reference to the molecule.
      Parameters:
      p - the property
      Since:
      Marvin 4.1.6, 02/11/2007
    • fixSelfReferringProperty

      protected boolean fixSelfReferringProperty(MProp prop)
      Fix a property containing reference to the molecule. Called from clonelesscopy().
      Parameters:
      prop - the property
      Since:
      Marvin 4.1.6, 02/14/2007
      See Also:
    • toString

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

      public MoleculeGraph clone()
      Make an identical copy of the molecule. The clone is deep clone including atom and bond cloning.
      Overrides:
      clone in class Object
      Returns:
      the copy
    • getParityType

      public int getParityType(int idx)
      Gets parity type. Currently tetrahedral and allene type parity supported. Only basic parity conditions are checked so return value not 0 does not mean that the atom has parity value different from 0.
      Parameters:
      idx - the index of the atom whose parity type is to be determined
      Returns:
      PARITY_ALLENE type for atoms having two double bond, and PARITY_TETRAHEDRAL for atoms having 3 or 4 bonds, else 0.
      See Also:
    • getParity

      public int getParity(int i)
      Computes the parity of an atom of the Molecule instance based on both the coordinates of the neighboring atoms and the stereo information of the bonds to those. Leaves the imported parity unchanged.
      Parity for tetrahedral center is defined as follows:
      Number the atoms surrounding the stereo center with 1, 2, 3, and 4 in order of increasing atom number (position in the atom block) (a hydrogen atom should be considered the highest numbered atom, in this case atom 4). View the center from a position such that the bond connecting the highest-numbered atom (4) projects behind the plane formed by atoms 1, 2, and 3. Sighting towards atom number 4 through the plane (123), you see that the three remaining atoms can be arranged in either a clockwise or counterclockwise direction in ascending numerical order. Parity value of ODD is for a clockwise arrangement at the stereo center and EVEN for counterclockwise.
      Allene like parity is defined as follows:
      The two pair of atoms which connects to the central atom through one single and odd number of double bond connections defines a tetrahedron. Number the tetrahedron atoms with 1, 2, 3, and 4 in order of increasing atom number (position in the atom block). Hydrogen atom should be considered the highest numbered atom, in this case atom 4. We may have two Hydrogen atoms for allene like parity type. So the two Hydrogen atoms are differentiated by the atom indexes connected to the central atom with double bond. The Hydrogen atom which is on the same side of the double bond connecting to the central atom with higher atom index's ligand gets the smaller value (3). View the center from a position such that the bond connecting the highest-numbered atom (4) projects behind the plane formed by atoms 1, 2, and 3. Sighting towards atom number 4 through the plane (123), you see that the three remaining atoms can be arranged in either a clockwise or counterclockwise direction in ascending numerical order. Parity value ODD is assigned for a clockwise arrangement at the stereo center and EVEN for counterclockwise.
      Parameters:
      i - the index of the atom whose parity is to be determined
      Returns:
      0 for nonchiral, PARITY_ODD or PARITY_EVEN for atoms of odd or even parity, PARITY_ODD|PARITY_EVEN for atoms whose parity is unspecified or cannot be assigned -as they are defined in MolAtom
      Throws:
      SecurityException - the Parity module cannot be loaded because of security reasons (firewall)
      See Also:
    • getLocalParity

      public int getLocalParity(int i)
      Computes the local parity of an atom of the Molecule instance based on both the coordinates of the neighboring atoms and the stereo information of the bonds to those. The molecule symmetry is not checked, so even an atom with same ligands can have parity. Leaves the imported parity unchanged. Contracted sgroups must be expanded to achieve consistent result.
      Parameters:
      i - the index of the atom whose parity is to be determined
      Returns:
      PARITY_ODD or PARITY_EVEN for atoms of odd or even parity, PARITY_EITHER for atoms with wiggly bond 0 for atoms whose parity is unspecified or not known. Corresponding PARITY_UNSPEC flag is also returned if set.
      Throws:
      SecurityException - the Parity module cannot be loaded because of security reasons (firewall)
      See Also:
    • setParity

      public boolean setParity(int i, int p)
      Change the bonds flag (UP/DOWN) connected to the given atom to achieve the specified parity. If all atom parities will be set then setParity(int[] p) is more efficient.
      Parameters:
      i - the index of the atom whose parity is to be set
      p - parity to be set (PARITY_ODD,PARITY_EVEN)
      Returns:
      true if successful
      Throws:
      SecurityException - the Parity module cannot be loaded because of security reasons (firewall)
      See Also:
    • setParity

      public boolean setParity(int[] p)
      Change the bonds flag (UP/DOWN) connected to the whole molecule to achieve the specified parity array. Take care of expanding the molecule if necessary. In 2D, use actual wedge setup and change it if necessary.
      Parameters:
      p - the parity for each atom in the molecule
      Returns:
      true if successful
      See Also:
    • setParity

      public boolean setParity(int[] p, boolean useActualWedges)
      Change the bonds flag (UP/DOWN) connected to the whole molecule to achieve the specified parity array. Take care of expanding the molecule if necessary.
      Parameters:
      p - the parity for each atom in the molecule
      useActualWedges - if true use actual wedge setup and change it if necessary, otherwise remove the wedges and set them again
      Returns:
      true if successful
      Since:
      Marvin 3.5, 12/18/2004
      See Also:
    • setLocalParity

      public boolean setLocalParity(int[] p, boolean useActualWedges)
      In case of 2D molecule change the bonds flag (UP/DOWN), in case of 0D molecule set the atom flags to achieve the specified parity array. Parity setting is allowed for non-stereogenic center. (This means that the central carbon of an isobutane can get parity value.) The molecule is not expanded. Parity calculation use only the narrow end of a wedge in case of 2D molecules (useOnlyFirstAtomInStereoCalculation = true). If useOnlyFirstAtomInStereoCalculation is false then the function returns false.
      Parameters:
      p - the parity for each atom in the molecule
      useActualWedges - if true use actual wedge setup and change it if necessary, otherwise remove the wedges and set them again
      Returns:
      true if successful
      Since:
      Marvin 5.0.1, 01/18/2008
      See Also:
    • setLocalParity

      public boolean setLocalParity(int[] idxes, int[] p, boolean useActualWedges)
      Set given local parity for the given atomic indexes. In case of 2D molecule change the bonds flag (UP/DOWN), in case of 0D molecule set the atom flags to achieve the specified parity array. Parity setting is allowed for non-stereogenic center. (This means that the central carbon of an isobutane can get parity value.) The molecule is not expanded. Parity calculation use only the narrow end of a wedge in case of 2D molecules (useOnlyFirstAtomInStereoCalculation = true). If useOnlyFirstAtomInStereoCalculation is false then the function returns false.
      Parameters:
      idxes - atom indexes to set the local parity for
      p - the corresponding local parity information
      useActualWedges - if true use actual wedge setup and change it if necessary, otherwise remove the wedges and set them again
      Returns:
      true if successful
      Since:
      Marvin 5.3.6, 06/30/2010
      See Also:
    • getChirality

      public int getChirality(int i)
      Computes the chirality of an atom of the Molecule instance based on both the coordinates of the neighboring atoms and the stereo information of the bonds to those. Leaves the imported configuration unchanged. Contracted sgroups are expanded for calculation purposes. Though this method works only for valid atom indices.
      Parameters:
      i - the index of the atom whose chirality is to be determined
      Returns:
      0 for nonchiral, CHIRALITY_R, CHIRALITY_S, CHIRALITY_r, CHIRALITY_s, CHIRALITY_M, CHIRALITY_P for atoms of R, S or r, s or M, P configuration, PARITY_EITHER for atoms whose configuration is unspecified or cannot be assigned -as they are defined in MolAtom
      Throws:
      SecurityException - the Parity module cannot be loaded because of security reasons (firewall)
      See Also:
    • setChirality

      public boolean setChirality(Map<Integer,Integer> chiralities)
      Sets the chiralities of atoms. Using this method, R, S, r, s chirality values can be set. Use StereoConstants.CHIRALITY_R, StereoConstants.CHIRALITY_S, StereoConstants.CHIRALITY_r, and StereoConstants.CHIRALITY_s to define chirality. If chirality settings on at least on atom was not successful, chirality values on all atoms are reverted back to their original state.
      Parameters:
      chiralities - Map of integers, where the key is the atom index, value is the chirality value.
      Returns:
      true, if setting chirality on all atom was successful; false otherwise.
      Since:
      version 14.7.7.
    • setChirality

      public boolean setChirality(int i, int c)
      Set chirality of an atom of the Molecule instance based on both the coordinates of the neighboring atoms and the stereo information of the bonds to those. Take care of expanding the molecule if necessary.
      Possible chirality values to set:
      CHIRALITY_R
      set the stereocenter to R chirality value
      CHIRALITY_S
      set the stereocenter to S chirality value
      CHIRALITY_R|CHIRALITY_S, PARITY_EITHER or 0
      remove chirality value
      Parameters:
      i - the index of the atom whose chirality is to be set
      c - chirality to be set (CHIRALITY_R,CHIRALITY_S. 0 or (CHIRALITY_R|CHIRALITY_S) to remove chirality)
      Returns:
      true if successful
      Throws:
      SecurityException - the Parity module cannot be loaded because of security reasons (firewall)
      See Also:
    • getStereo2

      public int getStereo2(int i1, int i2, int i3, int i4)
      Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration. Calculates the stereo information if the molecule is 2D or 3D, reports previously set information if it is 0D. Not checking atom equivalences using graph invariants. Not checking if the bond is in small ring (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.

      See getStereo2(chemaxon.struc.MolAtom, int, int, chemaxon.struc.MolAtom) for detailed examples.

      Parameters:
      i1 - index of atom A1
      i2 - index of atom A2
      i3 - index of atom A3
      i4 - index of atom A4
      Returns:
      the cis/trans information, or 0 if A2 and A3 are not connected
      See Also:
    • getStereo2

      public int getStereo2(MolAtom a1, int i2, int i3, MolAtom a4)
      Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration. Calculates the stereo information if the molecule is 2D or 3D, reports previously set information if it is 0D. Not checking atom equivalences using graph invariants. Not checking if the bond is in small ring (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.
      Parameters:
      a1 - atom A1
      i2 - index of atom A2
      i3 - index of atom A3
      a4 - atom A4
      Returns:
      the cis/trans information, or 0 if A2 and A3 are not connected

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

      Dihedral Returned flags Remark
      CIS TRANS CTUNSPEC
      SMARTS bonds:
      C/C=C/C - 1 -
      C/C=C\C 1 - -
      CC=CC 1 1 -
      C/?C=C/C - 1 1
      C/?C=C\C 1 - 1
      ISIS bonds:
      C-C=C-C 1 1 - 180 degrees
      C-C X C-C 1 1 - "Cis" or "Trans" bond
      C/C="C/T?"=C/C - 1 1 "Not Cis" bond
      C/C="C/T?"=C\C 1 - 1 "Not trans" bond
      C-C="C/T?"=C-C 1 1 1 180 degrees
      See Also:
    • getStereo2

      public int getStereo2(MolBond b, MolAtom a1, MolAtom a4)
      Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration. Calculates the stereo information if the molecule is 2D or 3D, reports previously set information if it is 0D. Atoms A2 and A3 are atom1 and atom2 of the specified bond. Both (A2, A3) = (atom1, atom2) and (A2, A3) = (atom2, atom1) works. Not checking atom equivalences using graph invariants. Not checking if the bond is in small ring (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.

      See getStereo2(chemaxon.struc.MolAtom, int, int, chemaxon.struc.MolAtom) for detailed examples.

      Parameters:
      b - the bond
      a1 - atom A1
      a4 - atom A4
      Returns:
      the stereo flags
      See Also:
    • getStereo2

      public int getStereo2(MolBond b, MolAtom a1, MolAtom a4, boolean grcheck)
      Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration. Calculates the stereo information if the molecule is 2D or 3D, reports previously set information if it is 0D. Atoms A2 and A3 are 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 (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.

      See getStereo2(chemaxon.struc.MolAtom, int, int, chemaxon.struc.MolAtom) for detailed examples.

      Parameters:
      b - the bond
      a1 - atom A1
      a4 - atom A4
      grcheck - true if check atom equivalences using graph invariants
      Returns:
      the stereo flags
      See Also:
    • getEZStereo

      public EZConfiguration getEZStereo(MolBond bond)
      Gets E/Z stereo information for the given double bond. The calculation considers the following:
      • If the bond is in a small ring (size<8) then EZConfiguration.NONE is returned
      • If the molecule is zero dimensional then no calculation is performed but the values stored in the bond's flags are taken into consideration
      • The CIP (Cahn-Ingold-Prelog) rules are used to determine the highest priority ligands around the double bond
      • No graph invariant checking is performed
      Furthermore a little clarification of the connection between CIS/TRANS stereoisomerism and E/Z stereo by giving an insight into the algorithm calculating the result:
      Parameters:
      bond - the bond for which the E/Z stereo will be calculated
      Returns:
      the E/Z stereo value that is specified by the given bond
      See Also:
    • getStereo2

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

      See getStereo2(chemaxon.struc.MolAtom, int, int, chemaxon.struc.MolAtom) for detailed examples. See getEZStereo(MolBond) for a similar method with different return values.

      Parameters:
      b - the bond
      Returns:
      CIP stereo values for the given bond: CIS for Z stereo configuration, TRANS for E stereo configuration, CIS|TRANS for E/Z stereo configuration or 0
      See Also:
    • getStereo2

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

      See getStereo2(chemaxon.struc.MolAtom, int, int, chemaxon.struc.MolAtom) for detailed examples.

      Parameters:
      b - the bond
      a1 - atom A1
      i2 - index of atom A2
      i3 - index of atom A3
      a4 - atom A4
      Returns:
      the stereo flags
      See Also:
    • getStereo2

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

      See getStereo2(chemaxon.struc.MolAtom, int, int, chemaxon.struc.MolAtom) for detailed examples.

      Parameters:
      b - the bond
      a1 - atom A1
      i2 - index of atom A2
      i3 - index of atom A3
      a4 - atom A4
      grcheck - true if check atom equivalences using graph invariants
      Returns:
      the stereo flags
      See Also:
    • removeBond

      protected void removeBond(MolBond bond, int cleanupFlags)
      Removes a bond by reference.
      Parameters:
      bond - the bond
      cleanupFlags - extra clean-up methods
      Since:
      Marvin 3.1
      See Also:
    • removeBond

      protected void removeBond(int i, int cleanupFlags)
      Removes a bond by index.
      Parameters:
      i - the bond index
      cleanupFlags - extra clean-up methods
      Since:
      Marvin 3.1
      See Also:
    • regenBonds

      public void regenBonds()
      Regenerates the bond vector: remove its elements, then put the bond objects from the atoms into it.
    • isolate

      protected void isolate(MolAtom node)
      Isolates atom: a more efficient way of removing an atom than removeAtom(chemaxon.struc.MolAtom), especially for large molecule graphs. Removes the atom but instead of shifting the atoms array, simply sets the corresponding entry to null. After isolating some atoms, call removeIsolatedAtoms() to get a valid molecule graph.
      Parameters:
      node - the atom
      Since:
      Marvin 5.0
    • isolate

      protected void isolate(MolBond edge)
      Isolates bond: a more efficient way of removing a bond than removeBond(chemaxon.struc.MolBond), especially for large molecule graphs. Removes the bond but instead of shifting the bonds array, simply sets the corresponding entry to null. After isolating some bonds, call removeIsolatedBonds() to get a valid molecule graph.
      Parameters:
      edge - the bond
      Since:
      Marvin 5.0
    • removeIsolatedAtoms

      protected void removeIsolatedAtoms()
      Removes the null atom entries in the atoms array and sets the index fields appropriately. Clean-up method after calling isolate(chemaxon.struc.MolAtom) for some atoms.
      Since:
      Marvin 5.0
    • removeIsolatedBonds

      protected void removeIsolatedBonds()
      Removes the null bond entries in the bonds array and sets the index fields appropriately. Clean-up method after calling isolate(chemaxon.struc.MolBond) for some bonds.
      Since:
      Marvin 5.0
    • canBeCT

      public boolean canBeCT(int i2, int i3)
      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.
      Parameters:
      i2 - index of the first atom
      i3 - index of the second atom
      Returns:
      true if this is a double bond that can be either CIS, TRANS or EITHER, false otherwise.
    • 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.
      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
    • canBeCT

      public boolean canBeCT(MolBond bond)
      Determines whether the given bond 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.
      Parameters:
      bond - the bond to check
      Returns:
      true if this is a double bond that can be either CIS, TRANS or EITHER, false otherwise.
      Since:
      Marvin 5.5
    • getLonePairCount

      @Deprecated public int getLonePairCount(int i)
      Deprecated.
      Gets the number of lone pair atoms.
      Parameters:
      i - atom index
      Returns:
      the number of lone pair atoms connected to this atoms
      Since:
      Marvin 3.5, 09/29/2004
    • getExplicitLonePairCount

      @Deprecated public int getExplicitLonePairCount(int i)
      Deprecated.
      For internal use only.
      Gets the explicit lone pair count of the submitted atom.
      Parameters:
      i - atom index
      Returns:
      the number of the explicit lone pairs
      Since:
      Marvin 4.1.2, 10/06/2005
    • aromatize

      public void aromatize(boolean a) throws SecurityException
      Aromatize (using the default general aromatization method) or dearomatize molecule.
      Parameters:
      a - aromatize (true) or dearomatize (false)
      Throws:
      SecurityException - cannot load module because of a security problem (firewall)
      Since:
      Marvin 2.8
      See Also:
    • aromatize

      public final void aromatize()
      Aromatize molecule using the default general aromatization method. Only single or double bonds are changed to aromatic, aromatic bonds are not changed.
      Throws:
      SecurityException - cannot load module because of a security problem (firewall)
      Since:
      Marvin 3.4, 05/10/2004
      See Also:
    • dearomatize

      public boolean dearomatize()
      Dearomatize molecule.
      Returns:
      true if success, else false.
      Throws:
      SecurityException - cannot load module because of a security problem (firewall)
      Since:
      Marvin 5.0.1, 01/05/2008
    • dearomatize

      public boolean dearomatize(int method)
      Dearomatize molecule.
      Parameters:
      method - Specifies the algorithm for dearomatization. Possible values:
      • DEAROM_GENERAL - General dearomatization
      • DEAROM_HUCKELCHECK - Check Huckel rule during dearomatization.
      • DEAROM_HUCKELCHECK_EX - The same as DEAROM_HUCKELCHECK but throw exception if dearomatization is not successful.
      Returns:
      true if success, else false.
      Throws:
      SecurityException - cannot load module because of a security problem (firewall)
      RuntimeException - the molecule cannot be dearomatized with method DEAROM_HUCKELCHECK_EX
      Since:
      Marvin 5.2.3, 06/29/2008
    • aromatize

      public void aromatize(int method)
      Aromatizes molecule. Only single or double bonds are changed to aromatic, aromatic bonds are not changed. For query molecules if the molecule contains ANY bond, then the aromaticity is checked as if the ANY bonds were aromatic bonds. If a ring or a ring system found to be aromatic then the single bonds are changed to SINGLE_OR_AROMATIC and the double bonds to DOUBLE_OR_AROMATIC type.
      Parameters:
      method - Specifies the algorithm for aromatization. Possible values:
      • AROM_BASIC - Basic aromatization
      • AROM_GENERAL - General (Daylight compatible) aromatization
      • AROM_LOOSE - Loose 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
      See Also:
    • aromatize

      public void aromatize(int method, boolean checkAmbiguity)
      Aromatizes molecule. Only single or double bonds are changed to aromatic, aromatic bonds are not changed. For query molecules if checkAmbiguity set to true and the molecule contains ANY bond, then the aromaticity is checked as if the ANY bonds were aromatic bonds. If a ring or a ring system found to be aromatic then the single bonds are changed to SINGLE_OR_AROMATIC and the double bonds to DOUBLE_OR_AROMATIC type. Otherwise if checkAmbiguity is set to false a bond containing ANY bond cannot be aromatic.
      Parameters:
      method - Specifies the algorithm for aromatization. Possible values:
      • AROM_BASIC - Basic aromatization
      • AROM_GENERAL - General (Daylight compatible) aromatization
      • AROM_LOOSE - Loose 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
      See Also:
    • calcHybridization

      public void calcHybridization()
      Calculates and sets hybridazation state for each atom. The calculation is based on simple rules that cannot be customized in the present implementation. However, setHybridizationState( int ) can be called to set the appropriate value directly. This sp-hybridization state reflects the spatial configuration of the C,N and O atoms rather than the sp-hybridization of the electron bands. It doesn't cover all the mixed orbitals of Si,S and P atoms.

      For hydrogens the "s" MolAtom.HS_S state, for atoms with query bonds the unknown state MolAtom.HS_UNKNOWN is set. If the atom has aromatic bonds the sp2 state is set. Otherwise the sp-hybridization state is determined based on the number of double and tripple bonds. If the atom has a tripple bond or two double bonds the sp state is set. If the atom has one double bond the sp2 state is set. If the atom has more then one tripple bond or more than two double bonds the unknown state is set. If a heavy atom has only single bonds the sp3 state is set.

      Since:
      Marvin 3.5
      See Also:
      • LonePairCounter
    • getFormula

      public String getFormula()
      Gets the molecular formula.
      Returns:
      the formula
    • getMass

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

      public double getExactMass()
      Calculates the molecular weight of the molecule using the mass of the most frequent natural isotope of the atoms. Returns a double value.
      Returns:
      the molecular exact weight
    • makeItSimilar

      protected void makeItSimilar(MoleculeGraph g)
      Copies some properties of this molecule to the other one specified as argument. Copies the flags and the origin coordinates.
      Parameters:
      g - the molecule to change
    • newInstance

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

      public MoleculeGraph getGraphUnion()
      Gets a molecule graph containing all the atoms and bonds.
      Returns:
      this object (in the default implementation)
      Since:
      Marvin 3.0, 11/11/2002
    • indexOf

      public int indexOf(MolAtom atom)
      Gets the index of the specified atom.
      Parameters:
      atom - the atom
      Returns:
      the index, or -1 if not found
      Since:
      Marvin 2.7
    • indexOf

      public int indexOf(MolBond bond)
      Gets the index of the specified bond. This method uses MolBond.equals() for the bond comparison.
      Parameters:
      bond - the bond
      Returns:
      the index, or -1 if not found
      Since:
      Marvin 2.7
      See Also:
    • findAtom

      protected final int findAtom(MolAtom atom)
      Finds an atom in the atoms array.
      Returns:
      the atom index or -1 if not found
    • findBond

      protected final int findBond(MolBond bond)
      Finds a bond in the bonds array.
      Returns:
      the bond index or -1 if not found
    • contains

      public boolean contains(MolAtom atom)
      Checks if the molecule graph contains the specified atom.
      Parameters:
      atom - the atom object
      Returns:
      true if the graph contains the object, false otherwise
    • contains

      public boolean contains(MolBond bond)
      Checks if the molecule graph contains the specified bond, or a bond which is equals with the given bond.
      Parameters:
      bond - the bond object
      Returns:
      true if the graph contains the object, false otherwise
      See Also:
    • contains

      public boolean contains(MoleculeGraph graph)
      Does the molecule graph contain the specified fragment?
      Parameters:
      graph - the fragment
      Returns:
      true if it contains the graph, false if not
    • isEmpty

      public boolean isEmpty()
      Tests whether the molecule graph is empty.
      Returns:
      true if the graph does not contain any atoms or bonds, false otherwise
    • getSubGraphs

      public final MoleculeGraph[] getSubGraphs()
      Gets all "submolecules".
      Since:
      Marvin 4.1.2
      See Also:
    • getSubGraphCount

      protected int getSubGraphCount()
      Gets the number of all "submolecules". Submolecules are R-groups and the root structure in case of an RgMolecule, reactants, products and agents of an RxnMolecule etc.
      Returns:
      the number of submolecules
      Since:
      Marvin 4.1.2
      See Also:
    • getSubGraphs

      protected void getSubGraphs(MoleculeGraph[] m, int off)
      Gets all "submolecules".
      Parameters:
      m - the output array
      off - offset
      Since:
      Marvin 4.1.2
      See Also:
    • addAtomsAndBondsTo

      protected void addAtomsAndBondsTo(MoleculeGraph s)
      Adds all atoms and bonds to the specified molecule.
      Parameters:
      s - the selection molecule
      Since:
      Marvin 4.1, 11/25/2005
    • hasExplicitLonePairs

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean hasExplicitLonePairs()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Tests whether the molecule has explicit lone pair atoms.
      Returns:
      true if it has lone pair atoms, false otherwise
      Since:
      3.5.1, 11/24/2004
    • hasImplicitH

      public boolean hasImplicitH()
      Tests whether the molecule has implicit hydrogen atoms.
      Returns:
      true, if the molecule has at least one implicit hydrogen atom
      Since:
      Marvin 3.3, 01/14/2004
    • hasAtomSet

      public boolean hasAtomSet()
      Tests whether the molecule graph has atom sets.
      Returns:
      true if there are atom sets, false otherwise
      Since:
      Marvin 4.0, 03/02/2005
    • hasBondSet

      public boolean hasBondSet()
      Tests whether the molecule graph has atom sets.
      Returns:
      true if there are atom sets, false otherwise
      Since:
      Marvin 4.0, 03/02/2005
    • hasExtraLabelSet

      public boolean hasExtraLabelSet()
    • clean

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean clean(int dim, String opts)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.7, replaced by Cleaner.clean(MoleculeGraph, int, String).
      Calculates atom coordinates.
      Parameters:
      dim - dimensions
      opts - cleaning options
      Returns:
      true for success, false if an error occurred
      Throws:
      SecurityException - cannot load module because of a security problem (firewall)
    • partialClean

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean partialClean(Molecule[] template, String opts)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Calculates atom coordinates by using the given template molecule array. Works only in 2D. Set the x and y coordinates for the substructure of this molecule which first match a molecule from template molecule array. Partially clean the rest atoms. Remark, that only the first matching template molecule is used despite any later match in the template molecules. If the template has no wedges, try to keep the wedges of the original molecule. Otherwise try to keep the template wedge settings.
      Parameters:
      template - template molecule array (substructure of the target)
      opts - cleaning options
      Returns:
      true for success, false if no template match found or an error occurred
      Throws:
      SecurityException - cannot load module because of a security problem (firewall)
      Since:
      Marvin 5.4, 02/23/2010
    • partialClean

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean partialClean(MoleculeGraph template, int[] map, String opts)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Calculates atom coordinates by using the given template molecule. Works only in 2D. Set the x and y coordinates of the molecule from the given template using the given mapping. Partially clean the rest atoms. Map length should be equal the atomcount of the template. If the template has no wedges, try to keep the wedges of the original molecule. Otherwise try to keep the template wedge settings.
      Parameters:
      template - template molecule (substructure of the target)
      map - hit list which describes the atom mapping (the size equals to the number of atoms in the template, contains target atom indexes or -1 to exclude)
      opts - cleaning options
      Returns:
      true for success, false if an error occurred
      Throws:
      SecurityException - cannot load module because of a security problem (firewall)
      Since:
      Marvin 5.0, 09/09/2007
    • partialClean

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean partialClean(int dim, int[] fixed, String opts)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Calculates atom coordinates by using fixed atoms. Internal use only. Works only in 2D. Store the needed stereo information in the atomflags!
      Parameters:
      dim - dimensions
      fixed - atom indexes to be fixed
      opts - cleaning options
      Returns:
      true for success, false if an error occurred
      Throws:
      SecurityException - cannot load module because of a security problem (firewall)
      Since:
      Marvin 3.5.2, 01/01/2005
    • clean

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean clean(int dim, String opts, MProgressMonitor pmon)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Calculates atom coordinates. In a 3D it works only for Molecules (not for MoleculeGraphs).
      Parameters:
      dim - dimensions
      opts - cleaning options
      pmon - progress monitor or null
      Returns:
      true for success, false if an error occurred (for example 3D case for MoleculeGraphs).
      Throws:
      SecurityException - cannot load module because of a security problem (firewall)
      Since:
      Marvin 3.4, 05/06/2004
      See Also:
    • 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 necessary. Only rings smaller then 19 atoms are examined.
      Returns:
      true if successful
    • isGrinvCCValid

      protected boolean isGrinvCCValid()
      Tests whether the graph invariant change count is valid.
      Returns:
      true
      Since:
      Marvin 5.0, 11/30/2007
    • getAromaticAndAliphaticRings

      public int[][][] getAromaticAndAliphaticRings(int aromatizationType, boolean onlyAromrings, boolean aromatize, int maxRingSize, int ringsLimit)
      Returns the aromatic and or aliphatic ring atom indexes.
      Note: This method does not aromatize the already aromatized rings. Use first the dearomatize() or dearomatize(int) methods to convert the molecule to Kekule form.
      Handle maxRingSize, ringsLimit parameters with care, otherwise the calculation can take extremly long time or result in OutOfMemoryError. Suggested values are 18 for maxRingSize and 1000 for ringsLimit parameter.
      Parameters:
      aromatizationType - use aromatization:
      • 0 - No aromatization. The molecule is used as it is.
      • AROM_BASIC - basic aromatization
      • AROM_GENERAL - general aromatization
      onlyAromrings - get only the aromatic rings (Aromatic ring detection is faster than calculating Aliphatic and Aromatic rings in case of BASIC aromatization, in case of GENERAL aromatization there is no difference in the speed),
      aromatize - whether to set the bonds to aromatic (true), or keep the original form (false),
      maxRingSize - the maximum ring size during ring detection (0: no limit)
      ringsLimit - limit of the number of rings (0: no limit)
      Returns:
      the aromatic ring atom indexes in the array 0th position, the aliphatic ring atom indexes in the array 1st position
      Since:
      Marvin 4.1
      See Also:
    • getSSSR

      public final int[][] getSSSR()
      Gets the Smallest Set of Smallest Ring atom indexes array. It follows all kind of bonds including MolBond.ANY, MolBond.COORDINATE, MolBond.HYDROGEN. If the SSSR array is not calculated for the molecule, then create it. sssr[i][j] is the j-th atom index at the i-th SSSR ring in the molecule. This array is cached, so clone it if you plan to modify it.
      Returns:
      the sssr atom index arrays
      Since:
      Marvin 3.0
      See Also:
    • getCSSR

      public final int[][] getCSSR()
      Gets the Complete Set of Smallest Ring atom indexes array. CSSR is generated by adding the ring to CSSR which are xor of the SSSR but size smaller then 14 and also size not larger then the largest ring in the SSSR. If the CSSR array is not calculated for the molecule, then create it. cssr[i][j] is the j-th atom index at the i-th CSSR ring in the molecule. This array is cached, so clone it if you plan to modify it.
      Returns:
      the cssr atom index arrays
      Since:
      Marvin 5.0
      See Also:
    • getSSSRBonds

      public final int[][] getSSSRBonds()
      Gets the Smallest Set of Smallest Ring bond indexes array. Values are recalculated each time from the array of BitSets. The bond indexes are not in connection order. Use TopologyUtil.convertSSSRBondSetsToConnectedBondIndexArray(BitSet[], MoleculeGraph) to get bond indexes with connection order. WARNING! Using getSSSRBondsAsBitSet() may be more efficient and requires less memory usage.
      Returns:
      the sssr bond index arrays
      Since:
      Marvin 5.1.2
      See Also:
    • getSSSRIdxesForAtoms

      public int[][] getSSSRIdxesForAtoms()
      Get the sssr ring indexes in which the atom (specified with it's index) can be located. This array is cached, so clone it if you plan to modify it.
      Returns:
      sssr ring indexes for each atom index.
      Since:
      Marvin 4.1.8 4/17/2007
      See Also:
    • getCSSRIdxesForAtoms

      public int[][] getCSSRIdxesForAtoms()
      Get the cssr ring indexes in which the atom (specified with it's index) can be located.
      Returns:
      cssr ring indexes for each atom index.
      Since:
      Marvin 16.11.7.0
      See Also:
    • getSSSRBondSet

      public BitSet getSSSRBondSet()
      Get SSSR bond index bitset. Values are not recalculated but the result of a previous calculation returned. If no previous calculation result found the values are calculated.
      Returns:
      the SSSR ring bond indexes in bitset.
      Since:
      Marvin 5.10
    • getSSSRBondsAsBitSet

      public final BitSet[] getSSSRBondsAsBitSet()
      Gets the Smallest Set of Smallest Ring edges as an array of BitSets, one BitSet for each ring. Values are cached.
      Returns:
      the sssr bonds as an array of BitSets, one BitSet for each ring
    • getSSSRBondSetInLong

      @Deprecated public long[] getSSSRBondSetInLong()
      Deprecated.
      as of 15.09.2014, use getSSSRBondSet() instead
      Get SSSR bond bitsets in long array. To get if the given 'n' bond is in the sssr long array 'r', use the following code:
       static boolean get(int n, long[] r) {
          return (r[n/64] & (((long)1) << (63-(n % 64)))) != 0 ;
      }
      Returns:
      the SSSR ring bond indexes in long array.
      Since:
      Marvin 4.1
      See Also:
    • getSmallestRingSizeForIdx

      public int[] getSmallestRingSizeForIdx()
      Get the smallest ring size in which the atom (specified with it's index) can be located. This array is cached, so clone it if you plan to modify it.
      Returns:
      smallest ring size for each atom index.
      Since:
      Marvin 4.1 4/13/2006
      See Also:
    • isRingBond

      public boolean isRingBond(int idx)
      Is this bond in ring?
      Parameters:
      idx - the bond index
      Returns:
      true if the bond is in ring else false.
    • getImplicitHcount

      public int getImplicitHcount()
      Gets the total number of implicit hydrogens attached to the molecule.
      Returns:
      the implicit hydrogen count or the number of query hydrogens
    • getExplicitHcount

      public int getExplicitHcount()
      Gets the total number of explicit hydrogens attached to the molecule.
      Returns:
      the explicit hydrogen count
      Since:
      Marvin 3.4
    • findAtomClone

      public MolAtom findAtomClone(MolAtom a)
      Finds the clone of an atom.
      Parameters:
      a - the original atom
      Returns:
      the clone or null if not found
      Since:
      Marvin 3.4.1, 07/06/2004
    • isValidLinkNode

      public boolean isValidLinkNode(int linkAtomIdx, int outer1, int outer2)
      Checks whether the specified link atom is valid or not. Invalid link atoms are those where repetition is impossible due to rings.
      Parameters:
      linkAtomIdx - atom index to be set to link atom.
      outer1 - outer bond to be set by setLinkNodeOuterAtom(0)
      outer2 - outer bond to be set by setLinkNodeOuterAtom(1)
      Returns:
      whether repetition is possible on the given atom and outer bonds.
      Since:
      Marvin 4.0 12/29/2004
    • setLinkNodeDefaultOuters

      public void setLinkNodeDefaultOuters(MolAtom atom)
      Sets link node outer atoms to default values, if they are not set yet; making sure that the resulting link node configuration is valid.
      Parameters:
      atom - Atom to set to link node.
      Throws:
      IllegalArgumentException - if it is an invalid link node configuration.
      Since:
      Marvin 4.0 12/29/2004
      See Also:
    • getVisibleCoords

      public double[] getVisibleCoords(MolAtom ma)
      Returns the coordinates of the given atom (contained in the molecule).
      Parameters:
      ma - The atom to be queried.
      Returns:
      The coordinates of ma.
      Since:
      Marvin 4.0 8/07/2005
    • saveCache

      protected Object[] saveCache(int n)
      Saves caches like connection table, bond table, etc.
      Since:
      Marvin 3.4
    • restoreCache

      protected Object[] restoreCache(int n)
      Restores caches like connection table, bond table, etc.
      Since:
      Marvin 3.4
    • isMultiChiral

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

      public void adjustMultiChiralFlag()
      Checks whether the molecule has multiple chiral centres
      Since:
      Marvin 3.3
    • isMolecule

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean isMolecule()
      Deprecated, for removal: This API element is subject to removal in a future version.
      as of Marvin 14.7.7, no replacement.
      Usage:
       use myObject instanceof Molecule instead
                   
      Checks if the object is an instance of Molecule or not.

      x.isMolecule() is equivalent to x instanceof Molecule, only faster.

      Returns:
      false
      Since:
      Marvin 5.2
    • isQuery

      public boolean isQuery()
      Indicates if the molecule has query features: query atoms or query bonds.
      Returns:
      true if the molecule has query features
      Since:
      Marvin 4.0 04/02/2005
      See Also:
    • clearCachedInfo

      public void clearCachedInfo(int options)
      Deletes the cached information depending on the given options.
      Parameters:
      options - options for the cache clearing
      Since:
      Marvin 4.0.2 09/20/2005
      See Also:
    • arrangeComponents

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public boolean arrangeComponents()
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.7, replaced by CleanUtil.arrangeComponents(MoleculeGraph, boolean, boolean).
      Usage:
                   CleanUtil.arrangeComponents(molecule, true, true);
                   
      Arranges molecule components (fragments, reactants, agents, products, R-group definitions) nicely. Also arranges molecule fragments in root / main molecule, attached data and Sgroup brackets.
      Returns:
      true if coordinates changed, false if unchanged
      Since:
      Marvin 4.1
    • setGrinvOptions

      public void setGrinvOptions(int opt)
      Sets graph invariant calculation options passed to the module.
      Parameters:
      opt - the graph invariant calculation option
      Since:
      Marvin 4.1.6
      See Also:
    • getGrinvOptions

      public int getGrinvOptions()
      Gets graph invariant calculation options passed to the module.
      Returns:
      the graph invariant calculation option
      Since:
      Marvin 4.1.6
      See Also:
    • useOnlyFirstAtomInStereoCalculation

      public void useOnlyFirstAtomInStereoCalculation(boolean f)
      Set how parity module should interpret wedes. The difference between the two ideas wheter to interpret both (narrow and wide) endpoints of the wedge as chiral center or just the first atom (which is the narrow end of the MDL wedge).
      Parameters:
      f - wheter to use only the first atom of the wedge for calculations
      Since:
      Marvin 5.0
    • isOnlyFirstAtomInStereoCalculation

      public boolean isOnlyFirstAtomInStereoCalculation()
      Get how parity module interpret wedges. The difference between the two ideas whether to interpret both (narrow and wide) endpoints of the wedge as chiral center (return false) or just the first atom (which is the narrow end of the MDL wedge) (return true).
      Returns:
      true if just the first atom of the bond is considered as chiral center, else false.
      Since:
      Marvin 5.0
    • sumConservedQuantities

      protected void sumConservedQuantities(MolAtom a, int[] atoms, int sign)
      For internal use only.
      Since:
      Marvin 4.1.13, 09/19/2007
      See Also:
    • getCtab

      public int[][] getCtab()
      Gets the connection table. If there is no connection table for the molecule graph, then creates it. ctab[i][j] will be the index of the j-th neighbor of the i-th atom. This array is cached, so clone it if you plan to modify it.
      Returns:
      the ctab array
      Since:
      Marvin 2.6
    • getBondTable

      public BondTable getBondTable()
      Gets the bond (edge) table. If there is no bond table for the molecule, then creates it. btab.elementOf(i, j) will be the index of the bond between atoms i and j, or -1 if there is no bond. This array is cached, so clone it if you plan to modify it.
      Returns:
      the BondTable of this molecule graph.
      Since:
      Marvin 5.4
    • findFrags

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public <C extends MoleculeGraph> C[] findFrags(Class<C> cl)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.6, replaced by findFrags(Class, int) and FRAG_KEEPING_MULTICENTERS.
      Usage:
                   mol.findFrags(cl, MoleculeGraph.FRAG_KEEPING_MULTICENTERS);
                   
      Determines the disconnected fragments and puts them into an array. Multicenter groups are kept in the same fragment. Atoms are removed from the original molecule object unless the fragment class is SelectionMolecule.class.

      The original atom order is preserved in the returned fragments. Fragment order is also determined by the original atom order. The first fragment is the one containing atom 0, the second fragment is the one containing the smallest indexed atom not in the first fragment, etc.

      Type Parameters:
      C - the class of the fragments
      Parameters:
      cl - create fragment objects of this class
      Returns:
      array of fragments
      Since:
      Marvin 3.0
      See Also:
    • findFrags

      public <C extends MoleculeGraph> C[] findFrags(Class<C> cl, int fragmentationType)
      Determines the disconnected fragments and puts them into an array. Atoms are removed from the original molecule object unless the fragment class is SelectionMolecule.class.

      The original atom order is preserved in the returned fragments. Fragment order is also determined by the original atom order. The first fragment is the one containing atom 0, the second fragment is the one containing the smallest indexed atom not in the first fragment, etc.

      Fragmentation is performed depending on fragmentation type:

      Type Parameters:
      C - the class of the fragments
      Parameters:
      cl - create fragment objects of this class
      fragmentationType - determines the type of fragmentation
      Returns:
      array of fragments
      Since:
      Marvin 5.6
      See Also:
    • findComponentIds

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public final int[] findComponentIds()
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.0, replaced by getFragIds(int) and FRAG_BASIC.
      Usage:
                   mol.getFragIds(MoleculeGraph.FRAG_BASIC);
                   
      Assigns a component ID to each connected component. S-groups are ignored. Do not modify the result array!
      Returns:
      the component ID array (the i-th ID is the component ID for atom i)
      Since:
      Marvin 4.0
    • findComponentIds

      public final int[] findComponentIds(int[] inds)
      Assigns a component ID to each connected component formed by the specified atom indexes. S-groups are ignored. Do not modify the result array!
      Parameters:
      inds - atom index array, null means all atoms
      Returns:
      the corresponding component ID array (the i-th ID is the component ID for atom inds[i] or atom i if the atom index array is null)
      Since:
      Marvin 4.0
    • getFragCount

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public final int getFragCount()
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.6, replaced by getFragCount(int) and FRAG_KEEPING_MULTICENTERS.
      Usage:
                   mol.getFragCount(MoleculeGraph.FRAG_KEEPING_MULTICENTERS);
                   
      Returns the number of fragments for fragmentation keeping multicenters.
      Returns:
      the number of fragments
      Since:
      Marvin 3.01
      See Also:
    • getFragCount

      public final int getFragCount(int fragmentationType)
      Returns the number of fragments for the given fragmentation type.
      Parameters:
      fragmentationType - type of fragmentation
      Returns:
      the number of fragments
      Since:
      Marvin 5.6
      See Also:
    • getFragIds

      public final int[] getFragIds(int fragmentationType)
      Gets an array containing the fragment id for each atom for the given fragmentation type. This array is cached, so clone it if you plan to modify it.
      Parameters:
      fragmentationType - type of fragmentation
      Returns:
      array of fragment identifiers
      Since:
      Marvin 5.6
      See Also:
    • regenGearch

      protected final void regenGearch()
      Recreate graph search results object.
    • findFrag

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public final void findFrag(int i, MoleculeGraph frag)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.6, replaced by findFrag(int, int, MoleculeGraph) and FRAG_KEEPING_MULTICENTERS.
      Usage:
                   mol.findFrag(i, MoleculeGraph.FRAG_KEEPING_MULTICENTERS, frag);
                   
      Determines the subgraph connected to the specified atom, considering multicenter S-groups as one fragment. Subsequent calls with different atom (i) argument are possible because only those atoms and bonds are added that are still not elements of frag. Atoms are removed from the original molecule graph unless the frag is a SelectionMolecule.
      Parameters:
      i - atom index
      frag - add the atoms and bonds to this MoleculeGraph
      Since:
      Marvin 2.6
      See Also:
    • findFrag

      public final void findFrag(int i, int fragmentationType, MoleculeGraph frag)
      Determines the subgraph connected to the specified atom. Subsequent calls with different atom (i) argument are possible because only those atoms and bonds are added that are still not elements of frag. Atoms are removed from the original molecule graph unless the frag is a SelectionMolecule.
      Parameters:
      i - atom index
      fragmentationType - type of fragmentation
      frag - add the atoms and bonds to this MoleculeGraph
      Since:
      Marvin 5.6
      See Also:
    • findFragById

      public final void findFragById(int fragId, int fragmentationType, MoleculeGraph frag)
      Determines the subgraph corresponding to the specific fragment ID. Atoms are removed from the original molecule graph unless the frag is a SelectionMolecule.
      Parameters:
      fragId - fragment ID
      fragmentationType - type of fragmentation
      frag - add the atoms and bonds to this MoleculeGraph
      Since:
      Marvin 5.6
      See Also:
    • findBasicFrags

      public final <C extends MoleculeGraph> C[] findBasicFrags(Class<C> cl)
      Determines the disconnected fragments and puts them into an array. Atoms are removed from the original molecule object unless the fragment class is SelectionMolecule.class.

      The original atom order is preserved in the returned fragments. Fragment order is also determined by the original atom order. The first fragment is the one containing atom 0, the second fragment is the one containing the smallest indexed atom not in the first fragment, etc.

      This method provides the basic fragmentation that relies on classical graph theory and is not overwritten by successor class. DO NOT USE WITH OTHER FRAGMENTATION RELATED METHODS like getFragCount()! The length of the returned array and the returned value of getFragCount() might be different in successor classes.

      Parameters:
      cl - create fragment objects of this class
      Returns:
      array of fragments
      Since:
      Marvin 5.0
    • createGearch

      protected chemaxon.struc.gearch.MoleculeGraphGearch createGearch()
    • getMaxRgroupAttachmentPointOrder

      public int getMaxRgroupAttachmentPointOrder()
      Returns the maximal attachment point order of R-group attachment point atoms in this molecule graph.
      Returns:
      the maximal attachment point order
      Since:
      Marvin 5.4
      See Also:
    • mergeFrags

      public int mergeFrags(int id1, int id2, int fragmentationType)
      Merges two connected components of the given fragmentation type.
      Parameters:
      id1 - index of first atom to be merged into one fragment
      id2 - index of second atom to be merged into one fragment
      fragmentationType - determines the type of fragmentation
      Returns:
      the new ID of the merged connected components
      See Also:
    • setFlags

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

      public void setValenceCheckEnabled(boolean b)
      Enables or disables valence check on this molecule graph, depending on the value of the parameter b. Enabled valence check means that the valence check is called for all atoms in this molecule graph when needed.

      Valence check is enabled initially by default. To configure the options of the valence check see setValenceCheckOptions(ValenceCheckOptions)

      Parameters:
      b - - If true, the valence check is enabled on this molecule graph; otherwise valence check is disabled
      Since:
      Marvin 5.4
      See Also:
    • isValenceCheckEnabled

      public boolean isValenceCheckEnabled()
      Determines whether valence check is enabled on this molecule graph. Enabled valence check means that the valence check is called for all atoms in this molecule graph when needed. Disabling means that valence check is not called anywhere. Valence check may be enabled or disabled by calling the setValenceCheckEnabled method.

      To configure the options of the valence check see setValenceCheckOptions(ValenceCheckOptions)

      Returns:
      true if the valence check is enabled, false otherwise
      Since:
      Marvin 5.4
      See Also:
    • setValenceCheckState

      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.0, replaced by setValenceCheckOptions(ValenceCheckOptions) and setValenceCheckEnabled(boolean).
      Usage:
                   // Same as setValenceCheckState(ValenceCheckState.OFF):
                   setValenceCheckEnabled(false);
                   // Same as setValenceCheckState(ValenceCheckState.AMBIGUOUS_AROMATIC_ATOMS_IGNORED):
                   setValenceCheckOptions(ValenceCheckOptions.DEFAULT);
                   // Same as setValenceCheckState(ValenceCheckState.FULL):
                   setValenceCheckOptions(ValenceCheckOptions.GLOBAL);
                   
      Enables or disables valence check on atoms of the molecule graph, depending on the value of the parameter state. Full valence check means that the valence check is called for all atoms in this molecule graph when needed. When ambiguous aromatic atoms are ignored then these kind of atoms are not checked, their implicit Hydrogen count is not set, they remain untouched.

      The possibility to ignore Nitrogen-like aromatic atoms is added for speedup reasons because for these atoms implicit Hydrogens can be stored (e.g. in cxsmiles format).

      Valence check is enabled initially by default.

      Parameters:
      state - determines which atoms will be checked in the following calls of valenceCheck()
      Since:
      Marvin 5.9
      See Also:
    • getValenceCheckState

      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.0, replaced by getValenceCheckOptions() and isValenceCheckEnabled().
      Usage:
       // Same as getValenceCheckState() == ValenceCheckState.OFF:
       isValenceCheckEnabled() == true;
       // Same as getValenceCheckState() == ValenceCheckState.AMBIGUOUS_AROMATIC_ATOMS_IGNORED:
       getValenceCheckOptions.isLocalAromatic() == true;
       // Same as getValenceCheckState() == ValenceCheckState.FULL:
       getValenceCheckOptions.isLocalAromatic() == false;
                   
      Returns:
      the valence check state
    • setValenceCheckOptions

      public void setValenceCheckOptions(ValenceCheckOptions options)
      Sets the options for valence checking. To just enable/disable valence check in the molecule use setValenceCheckEnabled(boolean). Calling this function with a not null parameter automatically enables the valence check.
      Parameters:
      options - the new valence check options
      Since:
      Marvin 6.0
      See Also:
    • getValenceCheckOptions

      public ValenceCheckOptions getValenceCheckOptions()
      Returns the options for valence checking. To see if the valence check is enabled on the molecule use isValenceCheckEnabled()
      Returns:
      the valence check options
      Since:
      Marvin 6.0
      See Also:
    • isLargeMolecule

      public boolean isLargeMolecule()
      Returns true if large molecule (number of atoms exceeds 1000).
      Returns:
      true if large molecule
    • getFreeAttachmentPoints

      public int getFreeAttachmentPoints(MolAtom atom)
      Returns the number of the free attachment points for the given atom.
      Specified by:
      getFreeAttachmentPoints in interface MoleculeWithValence<MolAtom>
      Parameters:
      atom - the atom
      Returns:
      the number of the free attachment points or 0 if the atom is not located in any SuperatomSgroup
      Since:
      Marvin 5.11
    • getPossibleAttachmentPoints

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) protected int getPossibleAttachmentPoints(MolAtom molAtom)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.0, replaced by SuperatomSgroup.getAttachmentPointOrders(MolAtom) and MolAtom.getAttachParentSgroup().
      Usage:
       SuperatomSgroup group = (SuperatomSgroup)molAtom.getAttachParentSgroup());
       List&ltInteger&gt orders = group.getAttachmentPointOrders(molAtom);
                   
      Calculates the possible attachment point value for an atom based on the attachment point settings of the atom.
      Parameters:
      molAtom - the atom to calculate the possible attachment point value for
      Returns:
      the calculated attachment point value
      Since:
      Marvin 5.10
      See Also:
    • getAtomReferenceList

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public List<MolAtom> getAtomReferenceList()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use atoms() instead.
      Since:
      Marvin 5.11
    • getLigandCount

      public int getLigandCount(MolAtom atom)
      Gets the number of ligands of the given atom.
      Specified by:
      getLigandCount in interface MoleculeWithValence<MolAtom>
      Parameters:
      atom - the atom
      Returns:
      number of ligands
      Since:
      Marvin 5.11
    • getLigand

      public MolAtom getLigand(MolAtom atom, int n)
      Gets the n-th ligand of the given atom.
      Specified by:
      getLigand in interface MoleculeWithValence<MolAtom>
      Parameters:
      atom - the atom
      n - index
      Returns:
      the n-th ligand
      Since:
      Marvin 5.11
    • getLigandBondType

      public BondType getLigandBondType(MolAtom atom, int i)
      Gets the type of the n-th ligand bond of the given atom.
      Specified by:
      getLigandBondType in interface MoleculeWithValence<MolAtom>
      Parameters:
      atom - the atom
      i - index
      Returns:
      the bond type
      Since:
      Marvin 5.11
    • getLigandAtno

      public int getLigandAtno(MolAtom atom, int n)
      Gets the atomic number of the n-th ligand of the given atom.
      Specified by:
      getLigandAtno in interface MoleculeWithValence<MolAtom>
      Parameters:
      atom - the atom
      n - index
      Returns:
      the atomic number
      Since:
      Marvin 5.11
    • getCharge

      public int getCharge(MolAtom atom)
      Gets the charge of the given atom.
      Specified by:
      getCharge in interface MoleculeWithValence<MolAtom>
      Parameters:
      atom - the atom
      Returns:
      the charge
      Since:
      Marvin 5.11
    • getAtomicNumber

      public int getAtomicNumber(MolAtom atom)
      Gets the atomic number of the given atom.
      Specified by:
      getAtomicNumber in interface MoleculeWithValence<MolAtom>
      Parameters:
      atom - the atom
      Returns:
      the atomic number
      Since:
      Marvin 5.11
    • getRadicalCount

      public int getRadicalCount(MolAtom atom)
      Gets the number of free electrons of the given atom.
      Specified by:
      getRadicalCount in interface MoleculeWithValence<MolAtom>
      Parameters:
      atom - the atom
      Returns:
      the number of free electrons
      Since:
      Marvin 5.11
    • getValenceProperty

      public int getValenceProperty(MolAtom atom)
      Gets the valence property of the given atom.
      Specified by:
      getValenceProperty in interface MoleculeWithValence<MolAtom>
      Parameters:
      atom - the atom
      Returns:
      the valence or -1 if not set
      Since:
      Marvin 5.11
    • getImplicitHCount

      public int getImplicitHCount(MolAtom atom)
      Gets the number of implicit hydrogens attached to the given atom.
      Specified by:
      getImplicitHCount in interface MoleculeWithValence<MolAtom>
      Parameters:
      atom - the atom
      Returns:
      the number of implicit hydrogens
      Since:
      Marvin 5.11
    • isAtomInRing

      public boolean isAtomInRing(MolAtom atom)
      Checks whether the atom is in ring.
      Specified by:
      isAtomInRing in interface MoleculeWithValence<MolAtom>
      Parameters:
      atom - the atom reference
      Returns:
      true if the atom is in ring, false otherwise
      Since:
      Marvin 5.11
    • isAcceptedSpecialLigand

      public boolean isAcceptedSpecialLigand(MolAtom atom)
      Check if the ligand is a special atom which changes the ring atom column number with -1
      Specified by:
      isAcceptedSpecialLigand in interface MoleculeWithValence<MolAtom>
      Parameters:
      atom - ligand
      Returns:
      true if the ligand modifies the reference atom column number with -1 else false.
      Since:
      Marvin 5.11
    • isBondParallelWith

      protected boolean isBondParallelWith(MolBond b)
      Checks if there is a bond parallel (having same endpoints) with the given bond in this MoleculeGraph.
      Parameters:
      b - bond
      Returns:
      true if there is a bond parallel with the given bond else false
    • replaceAtom

      public void replaceAtom(int i, MolAtom newAtom)
      Replaces the atom on the given index with the parameter atom and removes the parameter atom from its original parent molecule if needed.
      Parameters:
      i - the index of the original atom
      newAtom - the atom which will replace the original
    • connectOriginalBondsToNewAtom

      protected void connectOriginalBondsToNewAtom(MolAtom newAtom, MolAtom orig, MolBond[] bonds)
      Sets the original connections to the new atom.
      Parameters:
      newAtom - the atom which replace the original
      orig - the original atom
      bonds - the original atoms bonds (before any modification)
    • getAtomIterator

      public IteratorFactory.AtomIterator getAtomIterator()
      Returns an iterator over the atoms in this molecule in proper sequence.
      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.
      Returns:
      an iterator over the bonds in this molecule in proper sequence
      Since:
      Marvin 6.2, 2013.09.09.
    • setSupergraph

      protected void setSupergraph(MoleculeGraph molecule)
      Sets the given molecule as the supergraph of this graph.
      Parameters:
      molecule - the molecule
      Since:
      Marvin 14.7.7, Jul 2, 2014
    • atoms

      public final List<MolAtom> atoms()
      Provides an unmodifiable list view of the atoms in the molecule. It is a dynamic view, which follows every change of the molecule structure. However, you must not add or remove atoms and bonds during iteration.
      Specified by:
      atoms in interface MoleculeWithValence<MolAtom>
      Returns:
      a dynamic list view of the atoms
    • bonds

      public final List<MolBond> bonds()
      Provides an unmodifiable list view of the bonds in the molecule. It is a dynamic view, which follows every change of the molecule structure. However, you must not add or remove atoms and bonds during iteration.
      Returns:
      a dynamic list view of the bonds
    • fixProperties

      public void fixProperties()
      Delegates to tracker's fixProperties().