chemaxon.struc
Class MoleculeGraph

java.lang.Object
  extended by chemaxon.struc.MoleculeGraph
All Implemented Interfaces:
chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>, Incomplecule, chemaxon.struc.MoleculeForBuilder, MTransformable, StereoConstants, java.io.Serializable
Direct Known Subclasses:
Molecule, SelectionMolecule

public class MoleculeGraph
extends java.lang.Object
implements chemaxon.struc.MoleculeForBuilder, Incomplecule, MTransformable, StereoConstants, java.io.Serializable, chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>

A graph consisting of MolAtom nodes and MolBond edges.

Since:
Marvin 3.0, 10/11/2002
Version:
5.3, 10/06/2009
Author:
Peter Csizmadia, Ferenc Csizmadia, Andras Volford, Gyorgy Pirok, Szilveszter Juhos, Szabolcs Csepregi, Erika Biro, Janos Kendi
See Also:
MolAtom, MolBond, Serialized Form

Nested Class Summary
static class MoleculeGraph.ValenceCheckState
          Possible states of valence check: off: no check for all atoms ambiguousAromaticAtomsIgnored: no check for aromatic Nitrogen-like atoms atoms full: all atoms of the molecule are checked
 
Field Summary
static int AROM_AMBIGUOUS
          Aromatization type for ambiguous 5-membered rings.
static int AROM_BASIC
          Basic aromatization.
static int AROM_CHEMAXON
          Deprecated. please use AROM_BASIC instead. Chemaxon aromatization.
static int AROM_DAYLIGHT
          Deprecated. please use AROM_GENERAL instead. Daylight aromatization (modified Huckel rule).
static int AROM_GENERAL
          General (Daylight conform) aromatization.
static int AROM_LOOSE
          Loose aromatization.
static int AROM_SUBSTRUCTURE
          Substructure aromatization.
protected  int atomCount
          The number of atoms.
protected static int AUTO_UNGROUP
          Automatic ungroup bit in flags.
protected  int bondCount
          The number of bonds.
protected  chemaxon.core.util.BondTable btab
          Bond table.
static int CACHE_REMOVE_ALL
          Cache removal option for clearing all cached info.
static int CACHE_REMOVE_AROMATAMODULE
          Cache removal option for remove module used in aromatization.
static int CACHE_REMOVE_CACHEMEMORY
          Cache removal option for cacheMemory.
static int CACHE_REMOVE_GRINVMODULE
          Cache removal option for remove module used in graph invariant calculation.
static int CACHE_REMOVE_PARITYMODULE
          Cache removal option for remove module used in parity calculation.
static int CACHE_REMOVE_SSSRMODULE
          Cache removal option for remove module used in sssr.
static int CACHE_REMOVE_TABS
          Cache remove option to clear ctab and btab.
protected  java.util.List<java.lang.Object[]> cacheMemory
           
protected  int[][] ctab
          Connection table.
static int DEAROM_GENERAL
          General dearomatization.
static int DEAROM_HUCKELCHECK
          Dearomatize method which dearomatizes only that molecules which fullfills the Huckel's rule.
static int DEAROM_HUCKELCHECK_EX
          Dearomatize method which dearomatizes only that molecules which fullfills the Huckel's rule.
protected static int DIM_MASK
          Dimension bits in flags.
static int FRAG_BASIC
          Basic fragmentation, only atom - atom connections (bond) are considered.
static int FRAG_KEEPING_MULTICENTERS
          Fragmentation without breaking multicenter S-groups.
static int FRAG_KEEPING_SGROUPS
          Fragmentation without breaking S-groups.
static int FRAG_TYPE_COUNT
          Number of fragmentation types.
protected  chemaxon.struc.gearch.MoleculeGraphGearch gearch
           
static int GRINV_DONT_STORE
          Graph invariant option to instruct that the graph invariant should not be stored in MoleculeGraph.
static int GRINV_NOHYDROGEN
          Graph invariant option for ignoring explicit hydrogens.
static int GRINV_OLDSTEREO
          Graph invariant option for calculating graph invariants using the old stereo method.
static int GRINV_STEREO
          Graph invariant option for calculating graph invariants using stereo information.
static int GRINV_USEMAPS
          Graph invariant option for calculating graph invariants considering atom maps also.
static int GRINV_VALUE_OPTIONS
          Unified mask of graph invariant options affecting grinv value.
protected  long grinvCC
          Graph invariant change count.
protected static int INITIAL_CAPACITY
          Initial capacity of the atoms and bonds vectors.
static java.lang.String INVALID_LINKNODE_MESSAGE
           
static int MIN_RING_SIZE_FOR_TRANS_DB
          The minimal size of the ring for the existence of TRANS double bond.
static int OMIT_POSTCLEAN
          Omit arranging process after the hydrogen addition.
protected  double orix
          Origin x.
protected  double oriy
          Origin y.
protected  double oriz
          Origin z.
protected  MoleculeGraph parentGraph
          The structure that contains this molecule graph as a substructure.
protected  MPropertyContainer propertyContainer
           
static int RMCLEANUP_ALL
          Perform all clean-up methods when removing an atom or a bond.
static int RMCLEANUP_EDGES
          When removing an atom or a bond, also remove the bond(s) from the atom object(s).
protected static int RMCLEANUP_FIXCOMPONENT
          Remove called from RxnMolecule.fixComponent.
static int RMCLEANUP_MOBJECT
          Remove graphics objects containing the removed atom.
static int RMCLEANUP_NONE
          Do not perform any clean-up methods when removing an atom or a bond.
static int RMCLEANUP_PARENTDOC
          Remove atom from parent document.
static int RMCLEANUP_STEREO
          When removing a H atom, keep stereo information unchanged.
protected  MoleculeGraph superGraph
          Parent of all parents.
protected  MolAtom[] theAtoms
          The atoms (nodes).
protected  MolBond[] theBonds
          The bonds (edges).
protected  boolean useOnlyFirstAtomInStereoCalculation
           
protected static int VALENCE_CHECK
          Valence check calculation bit in flags.
protected static int VALENCE_CHECK_AMBIGUOUS
          Valence check calculation bit in flags for checking ambiguous aromatic atoms requiring .
 
Fields inherited from interface chemaxon.struc.StereoConstants
ANTI, ATOMSTEREO_EITHER, ATOMSTEREO_MASK, ATOMSTEREO_NONE, ATOMSTEREO_SPECIFIC, CHIRALITY_M, CHIRALITY_MASK, CHIRALITY_P, CHIRALITY_r, CHIRALITY_R, CHIRALITY_s, CHIRALITY_S, CHIRALITYSUPPORT_ALL, CHIRALITYSUPPORT_NONE, CHIRALITYSUPPORT_SELECTED, CIS, CTUMASK, CTUNKNOWN, CTUNSPEC, DBS_ALL, DBS_MARKED, DBS_NONE, ENDO, EXO, PARITY_ALLENE, PARITY_EITHER, PARITY_EVEN, PARITY_MASK, PARITY_ODD, PARITY_TETRAHEDRAL, PARITY_UNSPEC, STGRP_ABS, STGRP_AND, STGRP_NONE, STGRP_OR, SYN, TRANS
 
Constructor Summary
MoleculeGraph()
          Construct a 2 dimensional molecule.
MoleculeGraph(MoleculeGraph p, int na, int nb)
          Construct a molecule or fragment with the specified number of atoms and bonds.
 
Method Summary
 void add(MolAtom atom)
          Adds an atom to the molecule.
 void add(MolBond bond)
          Adds a bond to the molecule.
protected  void addAtom0(MolAtom atom)
          Adds an atom.
protected  void addAtomsAndBondsTo(MoleculeGraph s)
          Adds all atoms and bonds to the specified molecule.
protected  void addAtomToFragment(MolAtom atom)
          Adds an atom to a fragment.
protected  int addAtomWithoutChangingIt(MolAtom atom)
          Adds an atom without setting its parentGraph and index fields.
protected  void addBond0(MolBond bond)
          Adds a bond.
protected  int addBondWithoutChangingIt(MolBond bond)
          Adds a bond without setting its parentGraph and index fields.
 boolean addExplicitHydrogens(int f)
          Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertImplicitHToExplicit(MoleculeGraph, MolAtom[], int)
 boolean addExplicitHydrogens(int f, MolAtom[] atoms)
          Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertImplicitHToExplicit(MoleculeGraph, MolAtom[], int)
 void addExplicitLonePairs()
          Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertImplicitLonePairsToExplicit(MoleculeGraph, MolAtom[])
 void adjustMultiChiralFlag()
          Checks whether the molecule has multiple chiral centres
 void aromatize()
          Aromatize molecule using the default general aromatization method.
 void aromatize(boolean a)
          Aromatize (using the default general aromatization method) or dearomatize molecule.
 void aromatize(int method)
          Aromatizes molecule.
 void aromatize(int method, boolean checkAmbiguity)
          Aromatizes molecule.
 boolean arrangeComponents()
          Deprecated. as of Marvin 5.7 replaced by CleanUtil.arrangeComponents(MoleculeGraph, boolean, boolean)
To keep the same functionality use with TRUE boolean parameters.
 double bondlength()
          Calculates the regular bond length.
 DPoint3 calcCenter()
          Calculates the geometrical center.
 void calcCenter(DPoint3 p)
          Calculates the geometrical center.
 int calcDehydrogenizedGrinv(int[] gi)
          Calculates the graph invariants with the assumption that hydrogens are removed.
 double calcHeight()
          Calculates the molecule height.
 void calcHybridization()
          Calculates and sets hybridazation state for each atom.
 DPoint3 calcOutRect()
          Calculates the outer rectangle.
 void calcOutRect(DPoint3 p)
          Calculates the outer rectangle.
 DPoint3 calcOutRectCenter()
          Calculates the center of the outer rectangle.
 void calcOutRectCenter(DPoint3 p)
           
 double calcWidth()
          Calculates the molecule width.
 boolean canBeCT(int i2, int i3)
          Determines whether the bond between the specified atoms can be a CIS/TRANS or not.
 boolean canBeCT(int i2, int i3, boolean grcheck)
          Determines whether the bond between the specified atoms can be a CIS/TRANS or not.
 boolean canBeCT(MolBond bond)
          Determines whether the given bond can be a CIS/TRANS or not.
protected  void checkBondConsistency()
           
 void checkConsistency()
          Deprecated.  
 boolean clean(int dim, java.lang.String opts)
          Deprecated. as of Marvin 5.7 replaced by Cleaner.clean(MoleculeGraph, int, String)
 boolean clean(int dim, java.lang.String opts, chemaxon.common.util.MProgressMonitor pmon)
          Deprecated. as of Marvin 5.7 replaced by Cleaner.clean(MoleculeGraph, int, String, MProgressMonitor)
 void clear()
          Clears the molecule.
 void clearCachedInfo(int options)
          Deletes the cached information depending on the given options.
 void clearForImport(java.lang.String format)
          Clears the bonds vector, the properties, the flags, and sets the origin coordinates to 0.
 java.lang.Object clone()
          Make an identical copy of the molecule.
 void clonecopy(int[] iatoms, MoleculeGraph g)
          Copies the specified atoms of this molecule graph to another one.
 void clonecopy(MoleculeGraph m)
          Make another molecule identical to this one.
protected  boolean clonecopyMoleculeGraphWithoutSgroups(int[] cnodes, MolBond[] cedges, int nb, MoleculeGraph graph)
          Copies the specified atoms and bonds of this molecule graph to another one.
 void clonelesscopy(MoleculeGraph graph)
          Copy to selection.
 boolean contains(MolAtom atom)
          Checks if the molecule graph contains the specified atom.
 boolean contains(MolBond bond)
          Checks if the molecule graph contains the specified bond.
 boolean contains(MoleculeGraph graph)
          Does the molecule graph contain the specified fragment?
 int[][] createBHtab()
          Creates the bond table extended with implicit hydrogen atoms.
 int[][] createCHtab()
          Creates the connection table extended with implicit hydrogen atoms.
protected  MoleculeGraph createDehydrogenizedReadOnlyGraph()
          Creates a dehydrogenized version of the molecule.
protected  chemaxon.struc.gearch.MoleculeGraphGearch createGearch()
           
protected  Smolecule createSmolecule()
          Creates a Smolecule represenation of this molecule.
 boolean dearomatize()
          Dearomatize molecule.
 boolean dearomatize(int method)
          Dearomatize molecule.
protected  int findAtom(MolAtom atom)
          Finds an atom in the atoms array.
 MolAtom findAtomClone(MolAtom a)
          Finds the clone of an atom.
<C extends MoleculeGraph>
C[]
findBasicFrags(java.lang.Class<C> cl)
          Determines the disconnected fragments and puts them into an array.
protected  int findBond(MolBond bond)
          Finds a bond in the bonds array.
 int[] findComponentIds()
          Assigns a component ID to each connected component.
 int[] findComponentIds(int[] inds)
          Assigns a component ID to each connected component formed by the specified atom indexes.
 void findFrag(int i, int fragmentationType, MoleculeGraph frag)
          Determines the subgraph connected to the specified atom.
 void findFrag(int i, MoleculeGraph frag)
          Deprecated. since 5.6, replaced by findFrag(int, int, MoleculeGraph), to keep the same functionality, use value FRAG_KEEPING_MULTICENTERS for parameter fragmentationType, e.g.:
 mol.findFrag(i, MoleculeGraph.FRAG_KEEPING_MULTICENTERS, frag);
 
 void findFragById(int fragId, int fragmentationType, MoleculeGraph frag)
          Determines the subgraph corresponding to the specific fragment ID.
 void findFragById(int fragId, MoleculeGraph frag)
          Deprecated. since 5.6, replaced by findFragById(int, int, MoleculeGraph), to keep the same functionality, use value FRAG_KEEPING_MULTICENTERS for parameter fragmentationType, e.g.:
 mol.findFragById(fragId, MoleculeGraph.FRAG_KEEPING_MULTICENTERS, frag);
 
<C extends MoleculeGraph>
C[]
findFrags(java.lang.Class<C> cl)
          Deprecated. since 5.6, replaced by findFrags(Class, int), to keep the same functionality, use value FRAG_KEEPING_MULTICENTERS for parameter fragmentationType, e.g.:
 mol.findFrags(cl, MoleculeGraph.FRAG_KEEPING_MULTICENTERS);
 
<C extends MoleculeGraph>
C[]
findFrags(java.lang.Class<C> cl, int fragmentationType)
          Determines the disconnected fragments and puts them into an array.
protected static int findInArray(java.lang.Object[] array, int[] indices, int n, java.lang.Object o)
          Finds an object in an array.
protected  boolean fixSelfReferringProperty(MProp prop)
          Fix a property containing reference to the molecule.
 void fuse(MoleculeGraph graph)
          Adds those atoms and bonds of another molecule to this one that are not already elements.
 void fuse(MoleculeGraph graph, boolean check)
          Adds atoms and bonds of another molecule to this one.
protected  void fuse0(MoleculeGraph g, boolean check)
          Adds the atoms and bonds of another molecule to this one.
 int[][][] getAromaticAndAliphaticRings(int aromatizationType, boolean onlyAromrings, boolean aromatize, int maxRingSize, int ringsLimit)
          Get aromatic and or aliphatic ring atom indexes.
 int[][] getAromrings()
          Deprecated. please use getAromaticAndAliphaticRings instead.
 int[][] getAromrings(int size)
          Deprecated. please use getAromaticAndAliphaticRings instead.
 MolAtom getAtom(int n)
          Gets the nth atom.
 MolAtom[] getAtomArray()
          Creates an array of atoms.
 int getAtomCount()
          Gets the number of atoms.
 int getAtomCount(int atomicNumber)
          Gets the number of atoms with the given atomic number.
 int getAtomicNumber(MolAtom atom)
          
 java.util.List<MolAtom> getAtomReferenceList()
          
 MolBond getBond(int n)
          Gets the nth bond.
 MolBond[] getBondArray()
          Creates an array of bonds.
 int getBondCount()
          Gets the number of bonds.
protected  MolBond[] getBonds(MolAtom atom)
          Returns the bonds attached to the given atom in this molecule graph.
 chemaxon.core.util.BondTable getBondTable()
          Gets the bond (edge) table.
 int[][] getBtab()
          Deprecated. as of Marvin 5.4, please use getBondTable() instead
 int getCharge(MolAtom atom)
          
 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.
 int[][] getCSSR()
          Gets the Complete Set of Smallest Ring atom indexes array.
 int[][] getCtab()
          Gets the connection table.
 double getDesiredLength(int atno1, int atno2, int type)
          Deprecated. since Marin 5.11 use MolBond.desiredLength(int, int, int, int) instead.
 double getDesiredLength(MolBond b)
          Deprecated. since Marvin 5.11 use MolBond.desiredLength(int, int, int, int) instead.
 int getDim()
          Gets the dimension.
 MDocument getDocument()
          Gets the document object.
protected  MDocument getDocumentForChild(MoleculeGraph g)
          Gets the parent document for a child molecule graph.
 MolBond getEdge(int i)
          Deprecated. As of Marvin 5.3, replaced by getBond(int).
 MolBond[] getEdgeArray()
          Deprecated. As of Marvin 5.3, replaced by getBondArray().
 int getEdgeCount()
          Deprecated. As of Marvin 5.3, replaced by getBondCount().
 java.util.Vector<MolBond> getEdgeVector()
          Deprecated. As of Marvin 5.3, replaced by Arrays.asList(getAtomArray()).
 DPoint3[] getEnclosingCube()
          Gets the cube that encloses the atoms of molecule graph.
 double getExactMass()
          Calculates the molecular exact weight of the molecule.
 int getExplicitHcount()
          Gets the total number of explicit hydrogens attached to the molecule.
 int getExplicitLonePairCount(int i)
           
 int getFlags()
          Gets the dimension and chiral flags.
 MoleculeGraph getForefather()
          Gets the first parent.
 int getFormalCharge()
          Gets the (total) formal charge of the molecule.
 java.lang.String getFormula()
          Gets the molecular formula.
 int getFragCount()
          Deprecated. since 5.6, replaced by getFragCount(int), to keep the same functionality, use value FRAG_KEEPING_MULTICENTERS for parameter fragmentationType, e.g.:
 mol.getFragCount(MoleculeGraph.FRAG_KEEPING_MULTICENTERS);
 
 int getFragCount(int fragmentationType)
          Returns the number of fragments for the given fragmentation type.
 int[] getFragIds()
          Deprecated. since 5.6, replaced by getFragIds(int), to keep the same functionality, use value FRAG_KEEPING_MULTICENTERS for parameter fragmentationType, e.g.:
 mol.getFragIds(MoleculeGraph.FRAG_KEEPING_MULTICENTERS);
 
 int[] getFragIds(int fragmentationType)
          Gets an array containing the fragment id for each atom for the given fragmentation type.
 int getFreeAttachmentPoints(MolAtom atom)
          
 MoleculeGraph getGraphUnion()
          Gets a molecule graph containing all the atoms and bonds.
protected  int[] getGrinv()
          Gets the graph invariants array.
 int getGrinv(int[] gi)
          Gets the graph invariants.
 int getGrinv(int[] gi, boolean uniqueFlag)
          Deprecated. Please use getGrinv(int[], int) instead.
 int getGrinv(int[] gi, int options)
          Gets the graph invariants (canonical labels).
 long getGrinvCC()
          Gets the graph invariant change count.
 int getGrinvOptions()
          Gets graph invariant calculation options passed to the module.
 int getImplicitHcount()
          Gets the total number of implicit hydrogens attached to the molecule.
 int getImplicitHCount(MolAtom atom)
          
 MolAtom getLigand(MolAtom atom, int n)
          
 int getLigandAtno(MolAtom atom, int n)
          
 chemaxon.struc.BondType getLigandBondType(MolAtom atom, int i)
          
 int getLigandCount(MolAtom atom)
          
 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.
 DPoint3 getLocation()
          Gets the origin of the molecule.
 java.lang.Object getLock()
          Gets the lock object for synchronization.
 int getLonePairCount(int i)
          Gets the number of lone pairs.
 double getMass()
          Calculates the molecular weight of the molecule.
 int getMaxRgroupAttachmentPointOrder()
          Returns the maximal attachment point order of R-group attachment point atoms in this molecule graph.
 java.lang.String getName()
          Gets the molecule name.
 MolAtom getNode(int i)
          Deprecated. As of Marvin 5.3, replaced by getAtom(int).
 int getNodeCount()
          Deprecated. As of Marvin 5.3, replaced by getAtomCount().
 java.util.Vector<MolAtom> getNodeVector()
          Deprecated. As of Marvin 5.3, replaced by Arrays.asList(getAtomArray()).
 int[][] getNonAromrings()
          Deprecated. please use getAromaticAndAliphaticRings instead.
 int[][] getNonAromrings(int size)
          Deprecated. please use getAromaticAndAliphaticRings instead.
 MoleculeGraph getParent()
          Gets the parent graph that contains this substructure.
protected  MDocument getParentDocument()
          Gets the document or the document of the parent graph.
 int getParity(int i)
          Computes the parity of an atom of the Molecule instance based on both the coordinates of the neighboring atoms and the stereo information of the bonds to those.
 int getParityType(int idx)
          Gets parity type.
 DPoint3[] getPoints()
          Gets an array containing the atom coordinates.
protected  int getPossibleAttachmentPoints(MolAtom molAtom)
          Calculates the possible attachment point value for an atom based on the attachment point settings of the atom.
 int getRadicalCount(MolAtom atom)
          
 int[] getSmallestRingSizeForIdx()
          Get the smallest ring size in which the atom (specified with it's index) can be located.
 int[][] getSSSR()
          Gets the Smallest Set of Smallest Ring atom indexes array.
 int[][] getSSSRBonds()
          Gets the Smallest Set of Smallest Ring bond indexes array.
 java.util.BitSet getSSSRBondSet()
          Get SSSR bond index bitset.
 long[] getSSSRBondSetInLong()
          Get SSSR bond bitsets in long array.
 int[][] getSSSRIdxesForAtoms()
          Get the sssr ring indexes in which the atom (specified with it's index) can be located.
 int getStereo2(int i1, int i2, int i3, int i4)
          Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration.
 int getStereo2(MolAtom a1, int i2, int i3, MolAtom a4)
          Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration.
 int getStereo2(MolBond b)
          Gets cis/trans (Z/E) stereo information for the given bond.
protected  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.
protected  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.
 int getStereo2(MolBond b, MolAtom a1, MolAtom a4)
          Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration.
 int getStereo2(MolBond b, MolAtom a1, MolAtom a4, boolean grcheck)
          Gets cis/trans stereo information for an A1-A2=A3-A4 atom configuration.
protected  int getSubGraphCount()
          Gets the number of all "submolecules".
 MoleculeGraph[] getSubGraphs()
          Gets all "submolecules".
protected  void getSubGraphs(MoleculeGraph[] m, int off)
          Gets all "submolecules".
 int getTotalCharge()
          Gets the total (formal) charge of the molecule.
 MoleculeGraph.ValenceCheckState getValenceCheckState()
           
 int getValenceProperty(MolAtom atom)
          
 double[] getVisibleCoords(MolAtom ma)
          Returns the coordinates of the given atom (contained in the molecule).
 boolean hasAtomSet()
          Tests whether the molecule graph has atom sets.
 boolean hasBondSet()
          Tests whether the molecule graph has atom sets.
 boolean hasExplicitLonePairs()
          Tests whether the molecule has explicit lone pair atoms.
 boolean hasExtraLabelSet()
           
 boolean hasImplicitH()
          Tests whether the molecule has implicit hydrogen atoms.
 boolean hasSelfReferringProperty()
          Tests whether the property list contains the molecule.
 boolean hasValenceError()
          Determines if this molecule has a valence error on any of its atoms.
 boolean hydrogenize(boolean add)
          Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertImplicitHToExplicit(MoleculeGraph) and Hydrogenize.convertExplicitHToImplicit(MoleculeGraph)
 void implicitizeHydrogens(int f)
          Deprecated. as of Marvin 5.7 replaced by chemaxon.calculations.hydrogenize.Hydrogenize#convertExplicitHToImplicit(MoleculeGraph)(MoleculeGraph, int), the following usage will give the same results:
 chemaxon.calculations.hydrogenize.Hydrogenize.convertExplicitHToImplicit(mol, f);
 
 void implicitizeHydrogens(int f, MolAtom[] atoms)
          Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertExplicitHToImplicit(MoleculeGraph, MolAtom[], int), the following usage will give the same results:
 chemaxon.calculations.hydrogenize.Hydrogenize.convertExplicitHToImplicit(mol, atoms, f);
 
 void implicitizeHydrogens(int f, MolAtom[] atoms, boolean check)
          Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertExplicitHToImplicit(MoleculeGraph, MolAtom[], int, boolean) the following usage will give the same results:
 chemaxon.calculations.hydrogenize.Hydrogenize.convertExplicitHToImplicit(mol, atoms, f, check);
 
protected  boolean implicitizeHydrogens0(int f, MolAtom[] atoms, boolean check)
          Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertExplicitHToImplicit(MoleculeGraph, MolAtom[], int, boolean)
protected  void incGrinvCC()
          Increases the graph invariant change count and sets grinv to null.
 void incGrinvCCOnly()
          Increases the graph invariant change count, but does not change grinv.
 int indexOf(MolAtom atom)
          Gets the index of the specified atom.
 int indexOf(MolBond bond)
          Gets the index of the specified bond.
 void insertAtom(int i, MolAtom atom)
          Inserts the atom at the specified index.
 void insertBond(int i, MolBond bond)
          Inserts the bond at the specified index.
 void insertBondInOrder(MolBond e, MolBond[] order)
          Insert a bond in the order specified as the second argument.
 void insertEdge(int i, MolBond edge)
          Deprecated. As of Marvin 5.3, replaced by insertBond(int, MolBond).
 void insertEdgeInOrder(MolBond e, MolBond[] order)
          Deprecated. As of Marvin 5.3, replaced by insertBondInOrder(MolBond, MolBond[]).
 void insertNode(int i, MolAtom node)
          Deprecated. As of Marvin 5.3, replaced by insertAtom(int, MolAtom).
protected  void insertNullAtoms(int i, int count)
          Insert nulls into the atom array.
protected  void insertNullBonds(int i, int count)
          Insert nulls into the bond array.
 boolean isAbsStereo()
          Gets the absolute stereoconfiguration flag.
 boolean isAcceptedSpecialLigand(MolAtom atom)
          
 boolean isAtom()
          Determines whether the structure represents only one atom and an arbitrary number of bonds.
 boolean isAtomInRing(MolAtom atom)
          
 boolean isBond()
          Determines whether the structure represents only one bond and zero or two atoms.
 boolean isEmpty()
          Tests whether the molecule graph is empty.
protected  boolean isGrinvCCValid()
          Tests whether the graph invariant change count is valid.
 boolean isLargeMolecule()
          Returns true if large molecule (number of atoms exceeds 1000).
 boolean isMolecule()
          Checks if the object is an instance of Molecule or not.
 boolean isMultiChiral()
          Returns the multiple chirality flag.
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.
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.
 boolean isOnlyFirstAtomInStereoCalculation()
          Get how parity module interpret wedes.
 boolean isQuery()
          Indicates if the molecule has query features: query atoms or query bonds.
protected  boolean isRealAtomParent()
          Can it be a real atom parent?
 boolean isRing()
          Tests whether the molecule graph represents a ring.
 boolean isRingBond(int idx)
          Is this bond in ring?
 boolean isSelfReference(MProp p)
          Tests whether the specified property is a self reference to the molecule.
 boolean isSimilarTo(MoleculeGraph g)
          Tests if the molecule graph is similar to another graph.
 boolean isSymmetric()
          Tests whether the molecule graph is symmetric.
 boolean isValenceCheckEnabled()
          Deprecated. since Marvin 5.9, please use getValenceCheckState() instead
 boolean isValidLinkNode(int linkAtomIdx, int outer1, int outer2)
          Checks whether the specified link atom is valid or not.
protected  void makeItSimilar(MoleculeGraph g)
          Copies some properties of this molecule to the other one specified as argument.
 void mergeAtoms(MolAtom that, MolAtom a)
          Merges the bonds of an atom with another atom, then adds the atom to the molecule.
 void mergeFrags()
          Deprecated. since 5.6, it was an empty method in this class which is not required any more, it's usage can simply be deleted.
 int mergeFrags(int id1, int id2)
          Deprecated. since 5.6, replaced by mergeFrags(int, int, int), to keep the same functionality, use value FRAG_KEEPING_MULTICENTERS for parameter fragmentationType, e.g.:
 mol.mergeFrags(id1, id2, MoleculeGraph.FRAG_KEEPING_MULTICENTERS);
 
 int mergeFrags(int id1, int id2, int fragmentationType)
          Merges two connected components of the given fragmentation type.
 void mergeNodes(MolAtom that, MolAtom a)
          Deprecated. As of Marvin 5.3, replaced by mergeAtoms(MolAtom, MolAtom).
 void moveTo(DPoint3 o)
          Move the molecule.
 MoleculeGraph newInstance()
          Creates a new MoleculeGraph object.
 void pack()
          Reduce memory usage.
 boolean partialClean(int dim, int[] fixed, java.lang.String opts)
          Deprecated. as of Marvin 5.7 replaced by Cleaner.partialClean(MoleculeGraph, int, int[], String)
 boolean partialClean(Molecule[] template, java.lang.String opts)
          Deprecated. as of Marvin 5.7 replaced by Cleaner.partialClean(Molecule, Molecule[], String)
 boolean partialClean(MoleculeGraph template, int[] map, java.lang.String opts)
          Deprecated. as of Marvin 5.7 replaced by Cleaner.partialClean(MoleculeGraph, MoleculeGraph, int[], String)
 MPropertyContainer properties()
          Gets the property container.
 void qpropCheck(java.util.List<MolAtom> v)
          Check for query property errors.
 void regenBonds()
          Regenerates the bond vector: remove its elements, then put the bond objects from the atoms into it.
protected  void regenCtabs()
          Regenerates connection table and bond table.
 void regenEdges()
          Deprecated. As of Marvin 5.3, replaced by regenBonds().
protected  void regenGearch()
          Recreate graph search results object.
 void removeAll()
          Removes all the atoms and bonds.
 void removeAllBonds()
          Removes all bonds.
 void removeAllEdges()
          Deprecated. As of Marvin 5.3, replaced by removeAllBonds().
 void removeAtom(int i)
          Removes an atom and its bonds by index.
 void removeAtom(int i, int cleanupFlags)
          Removes an atom and its bonds with extra clean-up options.
 void removeAtom(MolAtom atom)
          Removes an atom and its bonds by reference.
 void removeAtom(MolAtom atom, int cleanupFlags)
          Removes an atom and its bonds with extra clean-up options.
 void removeBond(int i)
          Removes a bond by index.
protected  void removeBond(int i, int cleanupFlags)
          Removes a bond by index.
 void removeBond(MolBond bond)
          Removes a bond by reference.
protected  void removeBond(MolBond bond, int cleanupFlags)
          Removes a bond by reference.
 void removeEdge(int i)
          Deprecated. As of Marvin 5.3, replaced by removeBond(int).
 void removeEdge(MolBond edge)
          Deprecated. As of Marvin 5.3, replaced by removeBond(MolBond).
 void removeExplicitLonePairs()
          Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertExplicitLonePairsToImplicit(MoleculeGraph)
protected  void removeIsolatedAtoms()
          Removes the null atom entries in the atoms array and sets the index fields appropriately.
protected  void removeIsolatedBonds()
          Removes the null bond entries in the bonds array and sets the index fields appropriately.
 void removeNode(int i)
          Deprecated. As of Marvin 5.3, replaced by removeAtom(int).
 void removeNode(int i, int cleanupFlags)
          Deprecated. As of Marvin 5.3, replaced by removeAtom(int, int).
 void removeNode(MolAtom node)
          Deprecated. As of Marvin 5.3, replaced by removeAtom(MolAtom).
 void removeNode(MolAtom node, int cleanupFlags)
          Deprecated. As of Marvin 5.3, replaced by removeAtom(MolAtom, int).
 void replaceBond(MolBond oldb, MolBond newb)
          Replaces an bond by another one.
 void replaceEdge(MolBond olde, MolBond newe)
          Deprecated. As of Marvin 5.3, replaced by replaceBond(MolBond, MolBond).
protected  void resetCtab()
          An operation performed that changed the connection table and the graph invariants.
protected  void resetGrinvInParents()
          Graph invariants must be recalculated for this graph and all parent graphs.
protected  java.lang.Object[] restoreCache(int n)
          Restores caches like connection table, bond table, etc.
 void revalidateCoordDependentProps()
          Revalidate coordinate dependent properties.
protected  java.lang.Object[] saveCache(int n)
          Saves caches like connection table, bond table, etc.
 void setAbsStereo(boolean c)
          Sets the absolute stereoconfiguration flag.
 void setAtom(int i, MolAtom atom)
          Sets the atom at the specified index.
protected  void setAtom0(int i, MolAtom atom)
          Sets the atom at the specified index.
 void setAtomSetSeqs(int id)
          Sets the set sequence number of all atoms.
 void setBond(int i, MolBond b)
          Sets the bond at the specified index.
 void setBondSetSeqs(int id)
          Sets the set sequence number of all bonds.
 boolean setChirality(int i, int c)
          Set chirality of an atom of the Molecule instance based on both the coordinates of the neighboring atoms and the stereo information of the bonds to those.
 void setDim(int d)
          Sets the dimension.
 void setEdge(int i, MolBond edge)
          Deprecated. As of Marvin 5.3, replaced by setBond(int, MolBond).
protected  void setFlags(int f)
          Sets the flags of the molecule.
protected  void setFlags(int f, int mask)
          Sets specified bits in the flags.
protected  void setGrinvCC(long g)
          Sets the graph invariant change count.
 void setGrinvOptions(int opt)
          Sets graph invariant calculation options passed to the module.
 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.
 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.
 boolean setLocalParity(int[] idxes, int[] p, boolean useActualWedges)
          Set given local parity for the given atomic indexes.
 void setLocation(DPoint3 o)
          Set the origin of the molecule.
 void setNode(int i, MolAtom node)
          Deprecated. As of Marvin 5.3, replaced by setAtom(int, MolAtom).
 boolean setParity(int[] p)
          Change the bonds flag (UP/DOWN) connected to the whole molecule to achieve the specified parity array.
 boolean setParity(int[] p, boolean useActualWedges)
          Change the bonds flag (UP/DOWN) connected to the whole molecule to achieve the specified parity array.
 boolean setParity(int i, int p)
          Change the bonds flag (UP/DOWN) connected to the given atom to achieve the specified parity.
 void setSetSeqs(int id)
          Deprecated. as of Marvin 4.0, replaced by setAtomSetSeq
 void setValenceCheckEnabled(boolean b)
          Deprecated. since Marvin 5.9, please use setValenceCheckState(ValenceCheckState) instead
 void setValenceCheckState(MoleculeGraph.ValenceCheckState state)
          Enables or disables valence check on atoms of the molecule graph, depending on the value of the parameter state.
 Smolecule smol()
          Gets a Smolecule representation of this molecule.
 void sortBondsAccordingTo(MolBond[] order)
          Sorts bonds in the same order as they appear in another chemical graph.
 void sortEdgesAccordingTo(MolBond[] order)
          Deprecated. As of Marvin 5.3, replaced by sortBondsAccordingTo(MolBond[]).
 boolean stereoClean()
          Reset the wedges of the molecule, based on the actual parity information in 2D remove wedges in 3D.
protected  void sumConservedQuantities(MolAtom a, int[] atoms, int sign)
          For internal use only.
 java.lang.String toString()
          Overrides MoleculeGraph.toString() to ease debugging.
 void transform(CTransform3D t)
          Apply a transformation matrix to the atomic coordinates.
 void transform(CTransform3D t, boolean incg)
          Apply a transformation matrix to the atomic coordinates.
protected  void updateDim(MoleculeGraph m)
          Updates the dimensions when fusing two structures.
 void useOnlyFirstAtomInStereoCalculation(boolean f)
          Set how parity module should interpret wedes.
 void valenceCheck()
          Check valence and query property errors for atoms.
 void valenceCheck(java.util.List<MolAtom> v)
          Check valence and query property errors.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INITIAL_CAPACITY

protected static final int INITIAL_CAPACITY
Initial capacity of the atoms and bonds vectors.

See Also:
Constant Field Values

AROM_BASIC

public static final int AROM_BASIC
Basic aromatization.

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

AROM_CHEMAXON

public static final int AROM_CHEMAXON
Deprecated. please use AROM_BASIC instead. Chemaxon aromatization.
Since:
Marvin 3.4, 05/10/2004
See Also:
aromatize(int), Constant Field Values

AROM_GENERAL

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

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

AROM_DAYLIGHT

public static final int AROM_DAYLIGHT
Deprecated. please use AROM_GENERAL instead. Daylight aromatization (modified Huckel rule).
Since:
Marvin 3.4, 05/10/2004
See Also:
aromatize(int), Constant Field Values

AROM_LOOSE

public static final int AROM_LOOSE
Loose aromatization.

Since:
Marvin 5.2, 01/11/2008
See Also:
aromatize(int), Constant Field Values

AROM_SUBSTRUCTURE

public static final int AROM_SUBSTRUCTURE
Substructure aromatization. Used internally.

Since:
Marvin 5.3, 09/14/2009
See Also:
aromatize(int), Constant Field Values

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:
aromatize(int), Constant Field Values

DEAROM_GENERAL

public static final int DEAROM_GENERAL
General dearomatization.

Since:
Marvin 5.2.3, 06/29/2008
See Also:
dearomatize(int), Constant Field Values

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:
dearomatize(int), Constant Field Values

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:
dearomatize(int), Constant Field Values

INVALID_LINKNODE_MESSAGE

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

DIM_MASK

protected static final int DIM_MASK
Dimension bits in flags.

See Also:
getFlags(), Constant Field Values

AUTO_UNGROUP

protected static final int AUTO_UNGROUP
Automatic ungroup bit in flags. Specified changes will result in an automatic ungroup of the affected S-groups. Changes causing ungroup:

See Also:
Constant Field Values

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:
Constant Field Values

VALENCE_CHECK_AMBIGUOUS

protected static final int VALENCE_CHECK_AMBIGUOUS
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:
Constant Field Values

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:
removeAtom(MolAtom, int), removeAtom(int, int), removeBond(MolBond, int), removeBond(int, int), Constant Field Values

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_ALL, Constant Field Values

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:
removeAtom(MolAtom, int), removeAtom(int, int), removeBond(MolBond, int), removeBond(int, int), Constant Field Values

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:
removeAtom(MolAtom, int), removeAtom(int, int), removeBond(MolBond, int), removeBond(int, int), Constant Field Values

CACHE_REMOVE_ALL

public static final int CACHE_REMOVE_ALL
Cache removal option for clearing all cached info.

See Also:
clearCachedInfo(int), Constant Field Values

CACHE_REMOVE_CACHEMEMORY

public static final int CACHE_REMOVE_CACHEMEMORY
Cache removal option for cacheMemory.

See Also:
cacheMemory, clearCachedInfo(int), Constant Field Values

RMCLEANUP_STEREO

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

Since:
Marvin 3.1
See Also:
removeAtom(MolAtom, int), removeAtom(int, int), RMCLEANUP_ALL, Constant Field Values

RMCLEANUP_MOBJECT

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

Since:
Marvin 4.1, 03/07/2006
See Also:
removeAtom(MolAtom, int), removeAtom(int, int), RMCLEANUP_ALL, Constant Field Values

RMCLEANUP_PARENTDOC

public static final int RMCLEANUP_PARENTDOC
Remove atom from parent document.

Since:
Marvin 4.1.13, 09/06/2007
See Also:
removeAtom(MolAtom, int), removeAtom(int, int), RMCLEANUP_ALL, Constant Field Values

GRINV_NOHYDROGEN

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

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

GRINV_STEREO

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

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

GRINV_OLDSTEREO

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

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

GRINV_USEMAPS

public static final int GRINV_USEMAPS
Graph invariant option for calculating graph invariants considering atom maps also.

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

GRINV_VALUE_OPTIONS

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

See Also:
Constant Field Values

GRINV_DONT_STORE

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

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

CACHE_REMOVE_GRINVMODULE

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

See Also:
clearCachedInfo(int), Constant Field Values

CACHE_REMOVE_PARITYMODULE

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

See Also:
clearCachedInfo(int), Constant Field Values

CACHE_REMOVE_AROMATAMODULE

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

See Also:
clearCachedInfo(int), Constant Field Values

CACHE_REMOVE_SSSRMODULE

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

See Also:
clearCachedInfo(int), Constant Field Values

CACHE_REMOVE_TABS

public static final int CACHE_REMOVE_TABS
Cache remove option to clear ctab and btab.

See Also:
clearCachedInfo(int), Constant Field Values

MIN_RING_SIZE_FOR_TRANS_DB

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

See Also:
Constant Field Values

OMIT_POSTCLEAN

public static final int OMIT_POSTCLEAN
Omit arranging process after the hydrogen addition.

See Also:
addExplicitHydrogens(int), Constant Field Values

FRAG_BASIC

public static final int FRAG_BASIC
Basic fragmentation, only atom - atom connections (bond) are considered.

See Also:
Constant Field Values

FRAG_KEEPING_MULTICENTERS

public static final int FRAG_KEEPING_MULTICENTERS
Fragmentation without breaking multicenter S-groups.

See Also:
Constant Field Values

FRAG_KEEPING_SGROUPS

public static final int FRAG_KEEPING_SGROUPS
Fragmentation without breaking S-groups.

See Also:
Constant Field Values

FRAG_TYPE_COUNT

public static final int FRAG_TYPE_COUNT
Number of fragmentation types.

See Also:
Constant Field Values

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 structure (and the corresponding graph invariants) may have changed since the creation of the molecule.

See Also:
getGrinvCC(), incGrinvCC(), incGrinvCCOnly(), getGrinv(int[])

cacheMemory

protected transient java.util.List<java.lang.Object[]> cacheMemory

ctab

protected transient int[][] ctab
Connection table.


btab

protected transient chemaxon.core.util.BondTable btab
Bond table.


gearch

protected transient chemaxon.struc.gearch.MoleculeGraphGearch gearch

propertyContainer

protected transient MPropertyContainer propertyContainer

useOnlyFirstAtomInStereoCalculation

protected transient boolean useOnlyFirstAtomInStereoCalculation
Constructor Detail

MoleculeGraph

public MoleculeGraph(MoleculeGraph p,
                     int na,
                     int nb)
Construct a molecule or fragment with the specified number of atoms and bonds.

Parameters:
p - the molecule that contains the created fragment
na - no reallocation needed until the number of atoms is less than this value
nb - no reallocation needed until the number of bonds is less than this value

MoleculeGraph

public MoleculeGraph()
Construct a 2 dimensional molecule.

Method Detail

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 java.lang.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

addAtom0

protected void addAtom0(MolAtom atom)
Adds an atom.

Parameters:
atom - the atom reference

addAtomWithoutChangingIt

protected final int addAtomWithoutChangingIt(MolAtom atom)
Adds an 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.

Parameters:
d - 0, 2, or 3
See Also:
setFlags(int)

getDim

public int getDim()
Gets the dimension.

Returns:
0, 2, or 3
See Also:
getFlags()

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:
getFlags()

setAbsStereo

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

Parameters:
c - the absolute stereoconfiguration flag
See Also:
setFlags(int)

clear

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

See Also:
clearForImport(java.lang.String), theAtoms

clearForImport

public void clearForImport(java.lang.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:
theBonds, orix, oriy, oriz, setFlags(int)

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:
RMCLEANUP_NONE, RMCLEANUP_ALL, RMCLEANUP_EDGES

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:
RMCLEANUP_NONE, RMCLEANUP_ALL, RMCLEANUP_EDGES

setAtom0

protected void setAtom0(int i,
                        MolAtom atom)
Sets the atom at the specified index.

Parameters:
i - atom index
atom - new atom reference

setBond

public void setBond(int i,
                    MolBond b)
Sets the bond at the specified index.

Parameters:
i - bond index
b - the bond reference

replaceBond

public void replaceBond(MolBond oldb,
                        MolBond newb)
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

setSetSeqs

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

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

getGrinv

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

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

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

getGrinv

public int getGrinv(int[] gi,
                    boolean uniqueFlag)
Deprecated. Please use getGrinv(int[], int) instead.

Gets the graph invariants (canonical labels). Same like the former method but if the boolean flag is true chiral info is also added to invariants (needed for unique SMILES).

Parameters:
gi - output array, its length must be equal to the number of atoms
uniqueFlag - boolean flag
Returns:
the number of different graph invariants
Throws:
java.lang.SecurityException - the GraphInvariants module cannot be loaded because of security reasons (firewall)
Since:
Marvin 3.3
See Also:
getGrinv(int[], int)

getGrinv

public int getGrinv(int[] gi,
                    int options)
Gets the graph invariants (canonical labels). 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:
java.lang.SecurityException - the GraphInvariants module cannot be loaded because of security reasons (firewall)
Since:
Marvin 4.0 7/08/2005
See Also:
GRINV_NOHYDROGEN, GRINV_STEREO, GRINV_DONT_STORE

calcDehydrogenizedGrinv

public int calcDehydrogenizedGrinv(int[] gi)
Calculates the graph invariants with the assumption that hydrogens are removed. Entries corresponding to hydrogens are filled with -1 values in the output array. Only normal Hydrogen atoms are removed, isotopes (Deuterium and Tricium) are not.

Parameters:
gi - output array, its length must be equal to the number of atoms
Returns:
the number of different graph invariants
Throws:
java.lang.SecurityException - the GraphInvariants module cannot be loaded because of security reasons (firewall)
Since:
Marvin 3.1
See Also:
getGrinv(int[])

createDehydrogenizedReadOnlyGraph

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

Returns:
dehydrogenized structure
Since:
Marvin 3.1

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

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:
grinvCC, incGrinvCC(), incGrinvCCOnly(), getGrinv(int[])

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:
grinvCC, getGrinvCC()

incGrinvCC

protected final void incGrinvCC()
Increases the graph invariant change count and sets grinv to null. Incremented in the following cases:

Since:
Marvin 3.5
See Also:
incGrinvCCOnly(), grinvCC, getGrinvCC(), getGrinv(int[])

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:
incGrinvCC(), grinvCC, getGrinvCC(), getGrinv(int[])

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.


regenCtabs

protected void regenCtabs()
Regenerates connection table and bond table.

Since:
Marvin 2.6

addExplicitHydrogens

public boolean addExplicitHydrogens(int f)
Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertImplicitHToExplicit(MoleculeGraph, MolAtom[], int)

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 occured
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
Marvin 4.1.3, 02/11/2006
See Also:
OMIT_POSTCLEAN

addExplicitHydrogens

public boolean addExplicitHydrogens(int f,
                                    MolAtom[] atoms)
Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertImplicitHToExplicit(MoleculeGraph, MolAtom[], int)

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 occured
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
Marvin 5.0, 02/23/2007
See Also:
OMIT_POSTCLEAN

hydrogenize

public boolean hydrogenize(boolean add)
Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertImplicitHToExplicit(MoleculeGraph) and Hydrogenize.convertExplicitHToImplicit(MoleculeGraph)

Implicit/explicit Hydrogen conversion. Adds explicit H atoms instead of the current implicit ones, or removes explicit H atoms and increases the number of implicit hydrogens.

Parameters:
add - add explicit H atoms if true, remove if false
Returns:
true for success, false if an error occured
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)

addExplicitLonePairs

public void addExplicitLonePairs()
Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertImplicitLonePairsToExplicit(MoleculeGraph, MolAtom[])

Adds explicit lone pairs.

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

removeExplicitLonePairs

public void removeExplicitLonePairs()
Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertExplicitLonePairsToImplicit(MoleculeGraph)

Removes explicit lone pairs.

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

implicitizeHydrogens

@Deprecated
public final void implicitizeHydrogens(int f)
Deprecated. as of Marvin 5.7 replaced by chemaxon.calculations.hydrogenize.Hydrogenize#convertExplicitHToImplicit(MoleculeGraph)(MoleculeGraph, int), the following usage will give the same results:
 chemaxon.calculations.hydrogenize.Hydrogenize.convertExplicitHToImplicit(mol, 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

public void implicitizeHydrogens(int f,
                                 MolAtom[] atoms)
Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertExplicitHToImplicit(MoleculeGraph, MolAtom[], int), the following usage will give the same results:
 chemaxon.calculations.hydrogenize.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

public void implicitizeHydrogens(int f,
                                 MolAtom[] atoms,
                                 boolean check)
Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertExplicitHToImplicit(MoleculeGraph, MolAtom[], int, boolean) the following usage will give the same results:
 chemaxon.calculations.hydrogenize.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

protected boolean implicitizeHydrogens0(int f,
                                        MolAtom[] atoms,
                                        boolean check)
Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertExplicitHToImplicit(MoleculeGraph, MolAtom[], int, boolean)

Parameters:
f -
atoms -
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.

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

public void checkConsistency()
Deprecated. 

Checks the internal consistency of the structure. Use this method for debugging.

Throws:
java.lang.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

public void mergeAtoms(MolAtom that,
                       MolAtom a)
Merges the bonds of an atom with another atom, then adds the atom to the molecule.

Parameters:
that - the atom
a - the other 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(), MolAtom.hasValenceError()

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 setValenceCheckState(ValenceCheckState) which atoms are checked.

See Also:
MolAtom.valenceCheck(), MolAtom.getImplicitHcount(), hasValenceError(), setValenceCheckState(ValenceCheckState), getValenceCheckState()

valenceCheck

public void valenceCheck(java.util.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:
MolAtom.valenceCheck(), valenceCheck()

qpropCheck

public void qpropCheck(java.util.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:
MolAtom.qpropCheck()

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

Returns:
true if the graphs are similar, false otherwise
Since:
Marvin 3.4.1, 07/21/2004
See Also:
MolAtom.haveEqualProperties(MolAtom), MolAtom.haveSimilarBonds(MolAtom)

isAtom

public boolean isAtom()
Determines whether the structure represents only one atom and an arbitrary number of bonds. Note: a one-atom structure has bonds only if it is a fragment.

Returns:
true if the number of atoms is one

isBond

public boolean isBond()
Determines whether the structure represents only one bond and zero or two atoms.

Returns:
true if the structure is the representation of a bond

isRing

public boolean isRing()
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 java.lang.String getName()
Gets the molecule name. This method is implemented for the Incomplecule interface but it returns empty string in this basic implementation.

Specified by:
getName in interface Incomplecule
Returns:
empty string
Since:
Marvin 4.1, 05/28/2006

properties

public MPropertyContainer properties()
Gets the property container.

Specified by:
properties in interface Incomplecule
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.

Specified by:
getAtomCount in interface Incomplecule
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.

Specified by:
getBondCount in interface Incomplecule
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

public void setAtom(int i,
                    MolAtom atom)
Sets the atom at the specified index.

Parameters:
i - atom index
atom - new atom reference
Since:
Marvin 5.3, 04/30/2009

insertAtom

public final void insertAtom(int i,
                             MolAtom atom)
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

public final void insertBond(int i,
                             MolBond bond)
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)

calcCenter

public DPoint3 calcCenter()
Calculates the geometrical center.

Returns:
center point

calcWidth

public double calcWidth()
Calculates the molecule width.

Returns:
the molecule width
Since:
Marvin 3.0

calcHeight

public double calcHeight()
Calculates the molecule height.

Returns:
the molecule height
Since:
Marvin 3.0

getDesiredLength

public double getDesiredLength(int atno1,
                               int atno2,
                               int type)
Deprecated. since Marin 5.11 use MolBond.desiredLength(int, int, int, int) instead.

Gets the ideal bond length in Angstroms.

Parameters:
atno1 - atomic number of first molecule
atno2 - atomic number of second molecule
type - bond type
Returns:
the ideal bond length

getDesiredLength

public double getDesiredLength(MolBond b)
Deprecated. since Marvin 5.11 use MolBond.desiredLength(int, int, int, int) instead.

Gets the ideal bond length in Angstroms.

Parameters:
b - the bond
Returns:
the ideal bond length
Since:
Marvin 2.7

bondlength

public double bondlength()
Calculates the regular bond length.

Returns:
the calculated length in Angstroms, or MolBond.CCLENGTH if the molecule has no bonds

getLocation

public DPoint3 getLocation()
Gets the origin of the molecule.

Returns:
the origin
Since:
Marvin 2.7
See Also:
orix

setLocation

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

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

moveTo

public void moveTo(DPoint3 o)
Move the molecule.

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

transform

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

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

transform

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

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

getPoints

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

Returns:
atom coordinates array
Since:
Marvin 2.9.1

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

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 final int findInArray(java.lang.Object[] array,
                                       int[] indices,
                                       int n,
                                       java.lang.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

public void clonelesscopy(MoleculeGraph graph)
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:
clonecopy(MoleculeGraph)

toString

public java.lang.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 java.lang.Object
Returns:
a string representation of the object

clone

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

Overrides:
clone in class java.lang.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:
StereoConstants.PARITY_ALLENE, StereoConstants.PARITY_TETRAHEDRAL

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:
java.lang.SecurityException - the Parity module cannot be loaded because of security reasons (firewall)
See Also:
StereoConstants.PARITY_ODD, StereoConstants.PARITY_EVEN, isAbsStereo(), setAbsStereo(boolean)

getLocalParity

public int getLocalParity(int i)
Computes the local parity of an atom of the Molecule instance based on both the coordinates of the 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.
Throws:
java.lang.SecurityException - the Parity module cannot be loaded because of security reasons (firewall)
See Also:
StereoConstants.PARITY_ODD, StereoConstants.PARITY_EVEN, StereoConstants.PARITY_EITHER, isAbsStereo(), setAbsStereo(boolean)

setParity

public boolean setParity(int i,
                         int p)
Change the bonds flag (UP/DOWN) connected to the given atom to achieve the specified parity. If all atom parities will be set then setParity(int[] p) is more efficient.

Parameters:
i - the index of the atom whose parity is to be set
p - parity to be set (PARITY_ODD,PARITY_EVEN)
Returns:
true if successful
Throws:
java.lang.SecurityException - the Parity module cannot be loaded because of security reasons (firewall)
See Also:
StereoConstants.PARITY_ODD, StereoConstants.PARITY_EVEN, MolBond.UP, MolBond.DOWN, setParity(int[] p), getParity(int i)

setParity

public boolean setParity(int[] p)
Change the bonds flag (UP/DOWN) connected to the whole molecule to achieve the specified parity array. Take care of expanding the molecule if neccessary. In 2D, use actual wedge setup and change it if neccessary.

Parameters:
p - the parity for each atom in the molecule
Returns:
true if successful
See Also:
StereoConstants.PARITY_ODD, StereoConstants.PARITY_EVEN, isAbsStereo(), setAbsStereo(boolean), MolBond.UP, MolBond.DOWN, getParity(int i)

setParity

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

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

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 neccessary, otherwise remove the wedges and set them again
Returns:
true if successful
Since:
Marvin 5.0.1, 01/18/2008
See Also:
StereoConstants.PARITY_ODD, StereoConstants.PARITY_EVEN, isAbsStereo(), setAbsStereo(boolean), useOnlyFirstAtomInStereoCalculation, MolBond.UP, MolBond.DOWN

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 neccessary, otherwise remove the wedges and set them again
Returns:
true if successful
Since:
Marvin 5.3.6, 06/30/2010
See Also:
StereoConstants.PARITY_ODD, StereoConstants.PARITY_EVEN, isAbsStereo(), setAbsStereo(boolean), useOnlyFirstAtomInStereoCalculation, MolBond.UP, MolBond.DOWN

getChirality

public int getChirality(int i)
Computes the chirality of an atom of the Molecule instance based on both the coordinates of the neighboring atoms and the stereo information of the bonds to those. Leaves the imported configuration unchanged.

Parameters:
i - the index of the atom whose chirality is to be determined
Returns:
0 for nonchiral, CHIRALITY_R, 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:
java.lang.SecurityException - the Parity module cannot be loaded because of security reasons (firewall)
See Also:
StereoConstants.CHIRALITY_R, StereoConstants.CHIRALITY_S, StereoConstants.CHIRALITY_r, StereoConstants.CHIRALITY_s, StereoConstants.CHIRALITY_M, StereoConstants.CHIRALITY_P

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

Parameters:
i - the index of the atom whose chirality is to be set
c - chirality to be set (CHIRALITY_R,CHIRALITY_S)
Returns:
true if successful
Throws:
java.lang.SecurityException - the Parity module cannot be loaded because of security reasons (firewall)
See Also:
StereoConstants.CHIRALITY_R, StereoConstants.CHIRALITY_S

getStereo2

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

Parameters:
i1 - index of atom A1
i2 - index of atom A2
i3 - index of atom A3
i4 - index of atom A4
Returns:
the cis/trans information, or 0 if A2 and A3 are not connected
See Also:
StereoConstants.CTUMASK, MolBond.calcStereo2(), for detailed examples.

getStereo2

public int getStereo2(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.

Parameters:
a1 - atom A1
i2 - index of atom A2
i3 - index of atom A3
a4 - atom A4
Returns:
the cis/trans information, or 0 if A2 and A3 are not connected

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

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

getStereo2

public int getStereo2(MolBond b,
                      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.

Parameters:
b - the bond
a1 - atom A1
a4 - atom A4
Returns:
the stereo flags
See Also:
StereoConstants.CTUMASK, MolBond.calcStereo2(), for detailed examples.

getStereo2

public int getStereo2(MolBond b,
                      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.

Parameters:
b - the bond
a1 - atom A1
a4 - atom A4
grcheck - true if check atom equivalences using graph invariants
Returns:
the stereo flags
See Also:
StereoConstants.CTUMASK, MolBond.calcStereo2(), for detailed examples.

getStereo2

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

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

getStereo2

protected final int getStereo2(MolBond b,
                               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.

Parameters:
b - the bond
a1 - atom A1
i2 - index of atom A2
i3 - index of atom A3
a4 - atom A4
Returns:
the stereo flags
See Also:
StereoConstants.CTUMASK, MolBond.calcStereo2(), for detailed examples.

getStereo2

protected final int getStereo2(MolBond b,
                               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.

Parameters:
b - the bond
a1 - atom A1
i2 - index of atom A2
i3 - index of atom A3
a4 - atom A4
grcheck - true if check atom equivalences using graph invariants
Returns:
the stereo flags
See Also:
StereoConstants.CTUMASK, MolBond.calcStereo2(), for detailed examples.

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:
RMCLEANUP_NONE, RMCLEANUP_ALL, RMCLEANUP_EDGES

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:
RMCLEANUP_NONE, RMCLEANUP_ALL, RMCLEANUP_EDGES

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

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

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

getExplicitLonePairCount

public int getExplicitLonePairCount(int i)

aromatize

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

Parameters:
a - aromatize (true) or dearomatize (false)
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
Marvin 2.8
See Also:
AROM_GENERAL, Document about aromatization

aromatize

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

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

dearomatize

public boolean dearomatize()
Dearomatize molecule.

Returns:
true if success, else false.
Throws:
java.lang.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:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
java.lang.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:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
Marvin 3.4
See Also:
AROM_BASIC, AROM_GENERAL, AROM_LOOSE, Document about aromatization

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:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
Marvin 3.4
See Also:
AROM_BASIC, AROM_GENERAL, AROM_LOOSE, Document about aromatization

calcHybridization

public void calcHybridization()
Calculates and sets hybridazation state for each atom. The calculation is based on simple rules that cannot be customized in the present implementation. However, setHybridizationState( int ) can be called to set the appropriate value directly. 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 java.lang.String getFormula()
Gets the molecular formula.

Returns:
the formula

getMass

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

Returns:
the molecular weight

getExactMass

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

Returns:
the molecular exact weight

makeItSimilar

protected void makeItSimilar(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.

Parameters:
bond - the bond
Returns:
the index, or -1 if not found
Since:
Marvin 2.7

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.

Parameters:
bond - the bond object
Returns:
true if the graph contains the object, false otherwise

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

getSubGraphCount

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

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

getSubGraphs

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

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

addAtomsAndBondsTo

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

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

hasExplicitLonePairs

public boolean hasExplicitLonePairs()
Tests whether the molecule has explicit lone pair atoms.

Returns:
true if it has lone pairs, 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

public boolean clean(int dim,
                     java.lang.String opts)
Deprecated. 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 occured
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)

partialClean

public boolean partialClean(Molecule[] template,
                            java.lang.String opts)
Deprecated. as of Marvin 5.7 replaced by Cleaner.partialClean(Molecule, Molecule[], String)

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 occured
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
Marvin 5.4, 02/23/2010

partialClean

public boolean partialClean(MoleculeGraph template,
                            int[] map,
                            java.lang.String opts)
Deprecated. as of Marvin 5.7 replaced by Cleaner.partialClean(MoleculeGraph, MoleculeGraph, int[], String)

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 occured
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
Marvin 5.0, 09/09/2007

partialClean

public boolean partialClean(int dim,
                            int[] fixed,
                            java.lang.String opts)
Deprecated. as of Marvin 5.7 replaced by Cleaner.partialClean(MoleculeGraph, int, int[], String)

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 occured
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
Marvin 3.5.2, 01/01/2005

clean

public boolean clean(int dim,
                     java.lang.String opts,
                     chemaxon.common.util.MProgressMonitor pmon)
Deprecated. as of Marvin 5.7 replaced by Cleaner.clean(MoleculeGraph, int, String, MProgressMonitor)

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 occured (for example 3D case for MoleculeGraphs).
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
Since:
Marvin 3.4, 05/06/2004
See Also:
clean(int, java.lang.String)

stereoClean

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

Returns:
true if succesful

isGrinvCCValid

protected boolean isGrinvCCValid()
Tests whether the graph invariant change count is valid.

Returns:
true
Since:
Marvin 5.0, 11/30/2007

getAromrings

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

Get aromatic ring atom indexes from basic aromatization. Only rings smaller then 19 atoms are examined. Note: If you want to get the aliphatic rings also, get first them by using getNonAromrings and then the aromatic ones.

Returns:
the aromatic ring atom indexes.

getNonAromrings

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

Get alpihatic ring atom indexes from basic aromatization. Only rings smaller then 19 atoms are examined. Getting the aliphatic rings is much slower then the aromatic ones.

Returns:
the nonaromatic ring atom indexes.

getAromrings

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

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

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

getNonAromrings

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

Get alpihatic ring atom indexes from basic aromatization. Only rings smaller then the given size are examined. Getting the aliphatic rings is much slower then the aromatic ones.

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

getAromaticAndAliphaticRings

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

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

getSSSR

public final int[][] getSSSR()
Gets the Smallest Set of Smallest Ring atom indexes array. 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:
grinvCC

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

getSSSRBonds

public final int[][] getSSSRBonds()
Gets the Smallest Set of Smallest Ring bond indexes array. Values are recalculated each time.

Returns:
the sssr bond index arrays
Since:
Marvin 5.1.2
See Also:
grinvCC

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

getSSSRBondSet

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

getSSSRBondSetInLong

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

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

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

isRingBond

public boolean isRingBond(int idx)
Is this bond in ring?

Parameters:
idx - the bond index
Returns:
true if the bond is in ring else false.

createCHtab

public int[][] createCHtab()
Creates the connection table extended with implicit hydrogen atoms. The implicit H atoms are indexed by free index numbers starting from the atom count and proceeding one-by-one from there. The current implementation always creates the table, the molecule does not store its extended connection table. chtab[i][j] will be the index of the j-th neighbor of the i-th atom, where atom indices greater than or equal to the atom count mean implicit hydrogen atoms.

Returns:
the chtab array
Since:
Marvin 3.0

createBHtab

public int[][] createBHtab()
Creates the bond table extended with implicit hydrogen atoms. The implicit H atoms are indexed by free index numbers starting from the atom count and proceeding one-by-one from there. The current implementation always creates the table, the molecule does not store its extended connection table. bhtab[i][j] will be the index of the bond between atoms i and j, or -1 if there is no bond, -2 if it is an atom-implicitH bond where atom indices greater than or equal to the atom count mean implicit hydrogen atoms.

Returns:
the chtab array
Since:
Marvin 3.0

getImplicitHcount

public int getImplicitHcount()
Gets the total number of implicit hydrogens attached to the molecule.

Returns:
the implicit hydrogen count or the number of query hydrogens

getExplicitHcount

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

Returns:
the explicit hydrogen count
Since:
Marvin 3.4

findAtomClone

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

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

isValidLinkNode

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

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

setLinkNodeDefaultOuters

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

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

getVisibleCoords

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

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

saveCache

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

Since:
Marvin 3.4

restoreCache

protected java.lang.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

public boolean isMolecule()
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:
MolAtom.isQuery(), MolBond.isQuery()

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:
CACHE_REMOVE_GRINVMODULE, CACHE_REMOVE_PARITYMODULE, CACHE_REMOVE_AROMATAMODULE, CACHE_REMOVE_SSSRMODULE, CACHE_REMOVE_TABS, CACHE_REMOVE_ALL

arrangeComponents

public boolean arrangeComponents()
Deprecated. as of Marvin 5.7 replaced by CleanUtil.arrangeComponents(MoleculeGraph, boolean, boolean)
To keep the same functionality use with TRUE boolean parameters.

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:
GRINV_NOHYDROGEN, GRINV_DONT_STORE, GRINV_OLDSTEREO, GRINV_STEREO, GRINV_USEMAPS, GRINV_VALUE_OPTIONS

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:
GRINV_NOHYDROGEN, GRINV_DONT_STORE, GRINV_OLDSTEREO, GRINV_STEREO, GRINV_USEMAPS, GRINV_VALUE_OPTIONS

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 wedes. The difference between the two ideas wheter 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:
RxnMolecule.isIncompleteReaction()

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

getBtab

public int[][] getBtab()
Deprecated. as of Marvin 5.4, please use getBondTable() instead

Gets the bond (edge) table. If there is no bond table for the molecule, then creates it. btab[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 btab array
Since:
Marvin 2.6

getBondTable

public chemaxon.core.util.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 btab array
Since:
Marvin 5.4

findFrags

@Deprecated
public <C extends MoleculeGraph> C[] findFrags(java.lang.Class<C> cl)
Deprecated. since 5.6, replaced by findFrags(Class, int), to keep the same functionality, use value FRAG_KEEPING_MULTICENTERS for parameter fragmentationType, e.g.:
 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(Class, int)

findFrags

public <C extends MoleculeGraph> C[] findFrags(java.lang.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:
FRAG_BASIC, FRAG_KEEPING_MULTICENTERS, FRAG_KEEPING_SGROUPS

mergeFrags

@Deprecated
public void mergeFrags()
Deprecated. since 5.6, it was an empty method in this class which is not required any more, it's usage can simply be deleted.

Merge fragments after the multicenter fragmentation if needed.


findComponentIds

public final int[] findComponentIds()
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
public final int getFragCount()
Deprecated. since 5.6, replaced by getFragCount(int), to keep the same functionality, use value FRAG_KEEPING_MULTICENTERS for parameter fragmentationType, e.g.:
 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(int)

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:
FRAG_BASIC, FRAG_KEEPING_MULTICENTERS, FRAG_KEEPING_SGROUPS

getFragIds

@Deprecated
public final int[] getFragIds()
Deprecated. since 5.6, replaced by getFragIds(int), to keep the same functionality, use value FRAG_KEEPING_MULTICENTERS for parameter fragmentationType, e.g.:
 mol.getFragIds(MoleculeGraph.FRAG_KEEPING_MULTICENTERS);
 

Gets an array containing the fragment id for each atom for fragmentation keeping multicenters. This array is cached, so clone it if you plan to modify it.

Returns:
array of fragment identifiers
Since:
Marvin 2.6
See Also:
getFragIds(int)

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:
FRAG_BASIC, FRAG_KEEPING_MULTICENTERS, FRAG_KEEPING_SGROUPS

regenGearch

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


findFrag

@Deprecated
public final void findFrag(int i,
                                      MoleculeGraph frag)
Deprecated. since 5.6, replaced by findFrag(int, int, MoleculeGraph), to keep the same functionality, use value FRAG_KEEPING_MULTICENTERS for parameter fragmentationType, e.g.:
 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(int, int, MoleculeGraph)

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:
FRAG_BASIC, FRAG_KEEPING_MULTICENTERS, FRAG_KEEPING_SGROUPS

findFragById

@Deprecated
public final void findFragById(int fragId,
                                          MoleculeGraph frag)
Deprecated. since 5.6, replaced by findFragById(int, int, MoleculeGraph), to keep the same functionality, use value FRAG_KEEPING_MULTICENTERS for parameter fragmentationType, e.g.:
 mol.findFragById(fragId, MoleculeGraph.FRAG_KEEPING_MULTICENTERS, frag);
 

Determines the subgraph corresponding to the specific fragment ID, considering multicenter S-groups as one fragment. Atoms are removed from the original molecule graph unless the frag is a SelectionMolecule.

Parameters:
fragId - fragment ID
frag - add the atoms and bonds to this MoleculeGraph
Since:
Marvin 4.0
See Also:
findFragById(int, int, MoleculeGraph), getFragIds()

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:
getFragIds(), FRAG_BASIC, FRAG_KEEPING_MULTICENTERS, FRAG_KEEPING_SGROUPS

findBasicFrags

public final <C extends MoleculeGraph> C[] findBasicFrags(java.lang.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

getNodeCount

public int getNodeCount()
Deprecated. As of Marvin 5.3, replaced by getAtomCount().


getNode

public MolAtom getNode(int i)
Deprecated. As of Marvin 5.3, replaced by getAtom(int).


setNode

public void setNode(int i,
                    MolAtom node)
Deprecated. As of Marvin 5.3, replaced by setAtom(int, MolAtom).


insertNode

public final void insertNode(int i,
                             MolAtom node)
Deprecated. As of Marvin 5.3, replaced by insertAtom(int, MolAtom).


removeNode

public void removeNode(MolAtom node)
Deprecated. As of Marvin 5.3, replaced by removeAtom(MolAtom).


removeNode

public void removeNode(int i)
Deprecated. As of Marvin 5.3, replaced by removeAtom(int).


removeNode

public void removeNode(MolAtom node,
                       int cleanupFlags)
Deprecated. As of Marvin 5.3, replaced by removeAtom(MolAtom, int).


removeNode

public void removeNode(int i,
                       int cleanupFlags)
Deprecated. As of Marvin 5.3, replaced by removeAtom(int, int).


getNodeVector

public java.util.Vector<MolAtom> getNodeVector()
Deprecated. As of Marvin 5.3, replaced by Arrays.asList(getAtomArray()).


getEdgeCount

public int getEdgeCount()
Deprecated. As of Marvin 5.3, replaced by getBondCount().


getEdge

public MolBond getEdge(int i)
Deprecated. As of Marvin 5.3, replaced by getBond(int).


setEdge

public void setEdge(int i,
                    MolBond edge)
Deprecated. As of Marvin 5.3, replaced by setBond(int, MolBond).


insertEdge

public final void insertEdge(int i,
                             MolBond edge)
Deprecated. As of Marvin 5.3, replaced by insertBond(int, MolBond).


insertEdgeInOrder

public void insertEdgeInOrder(MolBond e,
                              MolBond[] order)
Deprecated. As of Marvin 5.3, replaced by insertBondInOrder(MolBond, MolBond[]).


replaceEdge

public void replaceEdge(MolBond olde,
                        MolBond newe)
Deprecated. As of Marvin 5.3, replaced by replaceBond(MolBond, MolBond).


removeEdge

public void removeEdge(MolBond edge)
Deprecated. As of Marvin 5.3, replaced by removeBond(MolBond).


removeEdge

public void removeEdge(int i)
Deprecated. As of Marvin 5.3, replaced by removeBond(int).


getEdgeArray

public MolBond[] getEdgeArray()
Deprecated. As of Marvin 5.3, replaced by getBondArray().


getEdgeVector

public java.util.Vector<MolBond> getEdgeVector()
Deprecated. As of Marvin 5.3, replaced by Arrays.asList(getAtomArray()).


removeAllEdges

public void removeAllEdges()
Deprecated. As of Marvin 5.3, replaced by removeAllBonds().


regenEdges

public void regenEdges()
Deprecated. As of Marvin 5.3, replaced by regenBonds().


sortEdgesAccordingTo

public void sortEdgesAccordingTo(MolBond[] order)
Deprecated. As of Marvin 5.3, replaced by sortBondsAccordingTo(MolBond[]).


mergeNodes

public void mergeNodes(MolAtom that,
                       MolAtom a)
Deprecated. As of Marvin 5.3, replaced by mergeAtoms(MolAtom, MolAtom).


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:
MolAtom.RGROUP_ATTACHMENT, MolAtom.getRgroupAttachmentPointOrder()

mergeFrags

@Deprecated
public int mergeFrags(int id1,
                                 int id2)
Deprecated. since 5.6, replaced by mergeFrags(int, int, int), to keep the same functionality, use value FRAG_KEEPING_MULTICENTERS for parameter fragmentationType, e.g.:
 mol.mergeFrags(id1, id2, MoleculeGraph.FRAG_KEEPING_MULTICENTERS);
 

Merges two connected components in the fragments generated by fragmentation that keeps multicenter groups together.

Parameters:
id1 - index of first atom to be merged into one fragment
id2 - index of second atom to be merged into one fragment
Returns:
the new ID of the merged connected components
See Also:
mergeFrags(int, int, int)

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:
FRAG_BASIC, FRAG_KEEPING_MULTICENTERS, FRAG_KEEPING_SGROUPS

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)
Deprecated. since Marvin 5.9, please use setValenceCheckState(ValenceCheckState) instead

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.

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

isValenceCheckEnabled

public boolean isValenceCheckEnabled()
Deprecated. since Marvin 5.9, please use getValenceCheckState() instead

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.

Returns:
true if the valence check is enabled, false otherwise
Since:
Marvin 5.4
See Also:
setValenceCheckEnabled(boolean b)

setValenceCheckState

public void setValenceCheckState(MoleculeGraph.ValenceCheckState state)
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(), valenceCheck()

getValenceCheckState

public MoleculeGraph.ValenceCheckState getValenceCheckState()

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)

Specified by:
getFreeAttachmentPoints in interface chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>
Since:
Marvin 5.11

getPossibleAttachmentPoints

protected int getPossibleAttachmentPoints(MolAtom 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:
MolAtom.getAttach()

getAtomReferenceList

public java.util.List<MolAtom> getAtomReferenceList()

Specified by:
getAtomReferenceList in interface chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>
Since:
Marvin 5.11

getLigandCount

public int getLigandCount(MolAtom atom)

Specified by:
getLigandCount in interface chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>
Since:
Marvin 5.11

getLigand

public MolAtom getLigand(MolAtom atom,
                         int n)

Specified by:
getLigand in interface chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>
Since:
Marvin 5.11

getLigandBondType

public chemaxon.struc.BondType getLigandBondType(MolAtom atom,
                                                 int i)

Specified by:
getLigandBondType in interface chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>
Since:
Marvin 5.11

getLigandAtno

public int getLigandAtno(MolAtom atom,
                         int n)

Specified by:
getLigandAtno in interface chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>
Since:
Marvin 5.11

getCharge

public int getCharge(MolAtom atom)

Specified by:
getCharge in interface chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>
Since:
Marvin 5.11

getAtomicNumber

public int getAtomicNumber(MolAtom atom)

Specified by:
getAtomicNumber in interface chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>
Since:
Marvin 5.11

getRadicalCount

public int getRadicalCount(MolAtom atom)

Specified by:
getRadicalCount in interface chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>
Since:
Marvin 5.11

getValenceProperty

public int getValenceProperty(MolAtom atom)

Specified by:
getValenceProperty in interface chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>
Since:
Marvin 5.11

getImplicitHCount

public int getImplicitHCount(MolAtom atom)

Specified by:
getImplicitHCount in interface chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>
Since:
Marvin 5.11

isAtomInRing

public boolean isAtomInRing(MolAtom atom)

Specified by:
isAtomInRing in interface chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>
Since:
Marvin 5.11

isAcceptedSpecialLigand

public boolean isAcceptedSpecialLigand(MolAtom atom)

Specified by:
isAcceptedSpecialLigand in interface chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>
Since:
Marvin 5.11