chemaxon.struc
Class Molecule

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

public class Molecule
extends MoleculeGraph
implements chemaxon.struc.MObjectContainer

Molecule class. A MoleculeGraph that may also contain S-groups.

Version:
5.3, 10/14/2009
Author:
Peter Csizmadia, Andras Volford, Szabolcs Csepregi, Erika Biro
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class chemaxon.struc.MoleculeGraph
MoleculeGraph.ValenceCheckState
 
Field Summary
static int DEFAULT_UNGROUP
          Do not ungroup and do not expand S-group's children.
static int RECURSIVE_UNGROUP
          Ungroup and expand (if possible) the child S-groups.
static int RMCLEANUP_FROMSGROUPS
          Remove atoms from S-groups.
static int RMCLEANUP_SGROUPATOMS
          Remove S-groups of removed superatoms.
protected static int RMSG_DEFAULT
          Remove S-group's children and remove S-group from its parent.
protected static int RMSG_KEEP_CHILDREN
          Do not remove S-group's children.
protected static int RMSG_KEEP_MULTICENTER
          Do not remove central atom of multicenter S-groups.
protected static int RMSG_KEEP_PARENT
          Do not remove S-group from its parent.
 
Fields inherited from class chemaxon.struc.MoleculeGraph
AROM_AMBIGUOUS, AROM_BASIC, AROM_CHEMAXON, AROM_DAYLIGHT, AROM_GENERAL, AROM_LOOSE, AROM_SUBSTRUCTURE, atomCount, AUTO_UNGROUP, bondCount, btab, CACHE_REMOVE_ALL, CACHE_REMOVE_AROMATAMODULE, CACHE_REMOVE_CACHEMEMORY, CACHE_REMOVE_GRINVMODULE, CACHE_REMOVE_PARITYMODULE, CACHE_REMOVE_SSSRMODULE, CACHE_REMOVE_TABS, cacheMemory, ctab, DEAROM_GENERAL, DEAROM_HUCKELCHECK, DEAROM_HUCKELCHECK_EX, DIM_MASK, FRAG_BASIC, FRAG_KEEPING_MULTICENTERS, FRAG_KEEPING_SGROUPS, FRAG_TYPE_COUNT, gearch, GRINV_DONT_STORE, GRINV_NOHYDROGEN, GRINV_OLDSTEREO, GRINV_STEREO, GRINV_USEMAPS, GRINV_VALUE_OPTIONS, grinvCC, INITIAL_CAPACITY, INVALID_LINKNODE_MESSAGE, MIN_RING_SIZE_FOR_TRANS_DB, OMIT_POSTCLEAN, orix, oriy, oriz, parentGraph, propertyContainer, RMCLEANUP_ALL, RMCLEANUP_EDGES, RMCLEANUP_FIXCOMPONENT, RMCLEANUP_MOBJECT, RMCLEANUP_NONE, RMCLEANUP_PARENTDOC, RMCLEANUP_STEREO, superGraph, theAtoms, theBonds, useOnlyFirstAtomInStereoCalculation, VALENCE_CHECK, VALENCE_CHECK_AMBIGUOUS
 
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
Molecule()
          Construct a 2 dimensional molecule.
Molecule(Molecule p, int na, int nb)
          Construct a molecule or fragment with the specified number of atoms and bonds.
Molecule(Molecule p, MolAtom a)
          Construct a molecule consisting of a single atom (node).
Molecule(Molecule p, MolBond b)
          Construct a molecule consisting of a single bond (edge).
 
Method Summary
protected  void addAtom0(MolAtom node)
          Adds an atom.
protected  void addAtomToFragment(MolAtom atom)
          Adds an atom to a fragment.
protected  void addBond0(MolBond bond)
          Adds a bond.
 void addSgroup(Sgroup sg, boolean setparent)
          Adds an S-group to this object.
protected  void addSgroupClones(Molecule origparentm, Molecule origm, Molecule newm)
          Adds the S-groups of a child molecule clone to the new parent molecule clone.
protected  void addSgroupsOf(Molecule m)
          Adds S-groups to this object and its parent.
 void aromatize(int method)
          Aromatizes molecule.
 void aromatize(int method, boolean checkAmbiguity)
          Aromatizes molecule.
 double bondlength()
          Calculate the regular bond length for the unified structure.
 boolean canBeReactionComponent()
          Tests whether an object of this class can be a reaction component.
 void checkConsistency()
          Deprecated.  
protected  void checkSgroupConsistency()
          Checks the internal consisitency of S-groups.
 void clear()
          Clears the molecule.
 void clearExtraLabels()
          Clears extra atom labels.
 void clearForImport(java.lang.String format)
          Initializes molecule for import.
 void clearObjects()
           
 void clearProperties()
          Clears RDfile/SDfile properties.
 java.lang.Object clone()
          Makes an identical copy of the molecule.
 void clonecopy(int[] iatoms, MoleculeGraph g)
          Copies the specified atoms and bonds of this molecule to another one.
 void clonecopy(MoleculeGraph g)
          Makes another molecule identical to this one.
protected  void clonecopyWithoutSgroups(Molecule m)
          Copies the all the contents except the S-groups into another molecule object.
 void clonelesscopy(MoleculeGraph g)
          Copies to selection.
 Molecule cloneMolecule()
          Makes an identical copy of the molecule.
 Molecule cloneMoleculeWithDocument()
          Makes an identical copy of the molecule and its document.
 boolean contains(MolAtom atom)
          Checks if the molecule graph contains the specified atom.
 boolean contractSgroups()
          Contracts all S-groups.
 Molecule[] convertToFrags()
          Converts this molecule to its disconnected fragments, expanding all S-groups and keeping disconnected Multicenter S-groups in the same fragment, but ungroupping and separating fragments in all other types of S-groups.
 int countExpandableContractableSgroups()
          Counts the expandable and contractable S-groups.
 int countOrderedComponentSgroups()
          Counts the ordered component S-groups.
protected  chemaxon.struc.gearch.MoleculeGraphGearch createGearch()
           
 boolean dearomatize()
          Dearomatize molecule.
 void endReuse(int n)
          End reusing atoms.
 boolean expandSgroups()
          Expands all S-groups.
 boolean expandSgroups(int opts)
          Expands all S-groups.
 byte[] exportToBinFormat(java.lang.String fmt)
          Deprecated. As of release 5.7, replaced by MolExporter.exportToBinFormat(Molecule, String)
 java.lang.String exportToFormat(java.lang.String fmt)
          Deprecated. As of release 5.7, replaced by MolExporter.exportToFormat(Molecule, String)
 java.lang.Object exportToObject(java.lang.String fmt)
          Deprecated. As of release 5.7, replaced by MolExporter.exportToObject(Molecule, String)
protected  void fillSelectionMolecule(SelectionMolecule s)
          Adds all atoms and bonds to the specified molecule.
 Sgroup[] findAllSgroupContaining(MolAtom a)
          Finds all smallest S-groups containing the specified atom.
 chemaxon.struc.sgroup.MulticenterSgroup findContainingMulticenterSgroup(MolAtom atom)
          Gets the containing multicenter S-group of a multicenter atom.
 Sgroup findContractableSgroup()
          Finds an expanded residue.
 Sgroup findExpandableSgroup()
          Finds a contracted residue.
 SelectionMolecule[] findFrags()
          Determines the disconnected fragments and puts them into an array.
 Sgroup findSgroupContaining(MolAtom a)
          Finds the largest S-group that contains the specified atom.
 Sgroup findSgroupOf(MolAtom a)
          Finds the smallest S-group related to the specified atom.
 Sgroup findSmallestSgroupContaining(MolAtom a)
          Finds the smallest S-group that contains the specified atom.
protected  boolean fixSelfReferringProperty(MProp prop)
          Fix a property containing reference to the molecule.
 java.util.List<MObject> getAllObjects()
           
 java.lang.String getComment()
          Gets the comment.
 long getEndPosition()
          Gets the end position of this molecule in the input file.
 int getFreeAttachmentPoints(java.lang.Integer atom)
          Calculates the available attachment point value for an atom based on the possible attachment point value and occupied attachment point value.
 int getFreeAttachmentPoints(MolAtom atom)
          
protected  SelectionMolecule getGraphUnionAsSelection()
          Gets a selection molecule containing all the atoms and bonds.
 java.lang.String getInputFormat()
          Gets the input file format.
protected  Molecule getMostSimplifiedMolecule()
          Gets the simplified molecule object even if there is a parent document with other objects.
 java.lang.String getName()
          Gets the molecule name that was set by setName(String).
 int getObjectCount()
           
 java.lang.String getProperty(java.lang.String key)
          Deprecated. as of Marvin 5.7 replaced by MPropHandler.convertToString(MProp, String), the following usage will give the same results:
 String property = MPropHandler.convertToString(mol.properties(), key);
 
 int getPropertyCount()
          Gets the total number of RDfile/SDfile properties.
 java.lang.String getPropertyKey(int i)
          Gets an RDfile/SDfile property key.
 java.util.Enumeration getPropertyKeys()
          Deprecated. as of Marvin 4.1, replaced by properties().getKeys()
 java.lang.Object getPropertyObject(java.lang.String key)
          Gets an RDfile/SDfile property object.
 Sgroup[] getRootSgroups()
          Gets root s-groups (groups that are not embedded into another s-group).
 Sgroup getSgroup(int i)
          Gets an S-group.
 Sgroup[] getSgroupArray()
          Gets the array of S-groups.
 int getSgroupCount()
          Gets the number of S-groups.
 MolAtom[] getSgroupLigands()
          Gets the S-group's ligands if the structure represents an S-group.
 Molecule getSimplifiedMolecule()
          Gets the simplified molecule object.
 Sgroup[] getSortedSgroups()
          Gets the sorted S-groups in parent-child order.
 long getStartPosition()
          Gets the starting position of this molecule in the input file.
 double[] getVisibleCoords(MolAtom ma)
          Returns the coordinates of the given atom (contained in the molecule).
protected  boolean implicitizeHydrogens0(int f, MolAtom[] atoms, boolean check)
          Deprecated. as of Marvin 5.7 replaced by Hydrogenize.convertExplicitHToImplicit(MoleculeGraph, MolAtom[], int, boolean)
 int indexOf(Sgroup sg)
          Gets the array index of an S-group.
 boolean isEmpty()
          Tests whether the molecule is empty.
 boolean isExpandable(int opts)
          Tests if the molecule is expandable with the specified options.
 boolean isGUIContracted()
          Tests if the molecule has a GUI-contracted S-group or not.
 boolean isMolecule()
          Checks if the object is an instance of Molecule or not.
 boolean isReaction()
          Checks if the structure represents a reaction or not.
 boolean isSgroup()
          Checks if the structure represents an S-group 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 node)
          Merges bonds of an atom with another atom, then adds the atom to the molecule.
 void mergeFrags()
          Deprecated. since 5.6, it was used by an internal method, not intended for public usage.
 MoleculeGraph newInstance()
          Creates a new Molecule object.
 SelectionMolecule newSelectionMolecule()
          Creates a new SelectionMolecule object appropriate for storing selection from this molecule.
 void removeAll()
          Removes all the atoms and bonds.
 void removeAllBonds()
          Removes all bonds.
protected  void removeAllSgroups()
          Removes all S-groups.
 void removeAtom(int i, int cleanupFlags)
          Removes an atom and its bonds by index.
 void removeAtom(MolAtom atom, int cleanupFlags)
          Removes an atom and its bonds by reference.
protected  void removeBond(int i, int cleanupFlags)
          Removes a bond by index.
protected  void removeBond(MolBond bond, int cleanupFlags)
          Removes a bond by reference.
 void removeObject(MObject mo)
           
protected  void removeSgroupFromList(Sgroup sg)
          Removes an S-group from the sgroupVector.
protected  void removeSgroupsOf(Molecule m)
          Removes S-groups from this object and its parent.
protected  void removeSgroupsOf(Molecule m, int rmflags)
          Removes S-groups that are contained in a given molecule but not contained in another molecule.
protected  void reparentSgroups(Molecule p)
          Change parents of all S-groups in this molecule.
 void replaceSgroup(Sgroup sgroup, Sgroup newSgroup)
          Replaces an S-group with a new sgroup in the molecule.
static java.lang.String residueSymbolOf(int id)
          Gets the name of a residue.
static int residueTypeOf(java.lang.String name)
          Gets the residue identifier for a residue name.
 MolAtom reuseAtom(int z, int i)
          Reuse an atom or create a new one.
 void selectAllObjects(boolean s)
           
protected  void setAtom0(int i, MolAtom node)
          Sets the atom at the specified index.
 void setComment(java.lang.String s)
          Sets the comment.
 void setDim(int d)
          Sets the dimension.
 void setEndPosition(long off)
          Sets the end position of this molecule in the input file.
 void setGUIContracted(boolean v)
          Contracts some S-groups to use in GUI or expands for any other use.
 void setGUIContracted(boolean v, int opts)
          Contracts some S-groups to use in GUI or expands for any other use.
 void setInputFormat(java.lang.String format)
          Sets the input file format.
 void setName(java.lang.String s)
          Sets the molecule name.
 void setProperty(java.lang.String key, java.lang.String value)
          Sets an RDfile/SDfile property.
 void setPropertyObject(java.lang.String key, java.lang.Object value)
          Sets an RDfile/SDfile property object.
 void setSgroupParent(MolAtom a, Sgroup sg, boolean set)
          Sets or unsets an S-group as a parent of an atom.
 void setStartPosition(long off)
          Sets the starting position of this molecule in the input file.
 void sortSgroupXBonds()
          Sorts superatom S-group crossing bonds in attachment point number order.
 byte[] toBinFormat(java.lang.String fmt)
          Deprecated. As of release 5.7, replaced by MolExporter.exportToBinFormat(Molecule, String)
 java.lang.String toFormat(java.lang.String fmt)
          Deprecated. As of release 5.7, replaced by MolExporter.exportToFormat(Molecule, String)
 java.lang.Object toObject(java.lang.String fmt)
          Deprecated. As of release 5.7, replaced by MolExporter.exportToObject(Molecule, String)
 void transform(CTransform3D t, boolean incg)
          Apply a transformation matrix to the atomic coordinates and Data Sgroup coordinates.
 boolean ungroupSgroup(int i)
          Ungroups the specified S-group and expands it if it is an Expandable S-group.
 boolean ungroupSgroup(int i, int opts)
          Ungroups the specified S-group and expands it if it is an Expandable S-group.
 boolean ungroupSgroup(Sgroup sg)
          Ungroups the specified S-group and expands it if it is an Expandable S-group.
 boolean ungroupSgroup(Sgroup sg, int opts)
          Expand and ungroup the specified S-group.
 boolean ungroupSgroups()
          Expand and ungroup all S-groups.
 boolean ungroupSgroups(int type)
          Ungroups all S-groups of a specified type in this molecule.
 
Methods inherited from class chemaxon.struc.MoleculeGraph
add, add, addAtomsAndBondsTo, addAtomWithoutChangingIt, addBondWithoutChangingIt, addExplicitHydrogens, addExplicitHydrogens, addExplicitLonePairs, adjustMultiChiralFlag, aromatize, aromatize, arrangeComponents, calcCenter, calcCenter, calcDehydrogenizedGrinv, calcHeight, calcHybridization, calcOutRect, calcOutRect, calcOutRectCenter, calcOutRectCenter, calcWidth, canBeCT, canBeCT, canBeCT, checkBondConsistency, clean, clean, clearCachedInfo, clonecopyMoleculeGraphWithoutSgroups, contains, contains, createBHtab, createCHtab, createDehydrogenizedReadOnlyGraph, createSmolecule, dearomatize, findAtom, findAtomClone, findBasicFrags, findBond, findComponentIds, findComponentIds, findFrag, findFrag, findFragById, findFragById, findFrags, findFrags, findInArray, fuse, fuse, fuse0, getAromaticAndAliphaticRings, getAromrings, getAromrings, getAtom, getAtomArray, getAtomCount, getAtomCount, getAtomicNumber, getAtomReferenceList, getBond, getBondArray, getBondCount, getBonds, getBondTable, getBtab, getCharge, getChirality, getCSSR, getCtab, getDesiredLength, getDesiredLength, getDim, getDocument, getDocumentForChild, getEdge, getEdgeArray, getEdgeCount, getEdgeVector, getEnclosingCube, getExactMass, getExplicitHcount, getExplicitLonePairCount, getFlags, getForefather, getFormalCharge, getFormula, getFragCount, getFragCount, getFragIds, getFragIds, getGraphUnion, getGrinv, getGrinv, getGrinv, getGrinv, getGrinvCC, getGrinvOptions, getImplicitHcount, getImplicitHCount, getLigand, getLigandAtno, getLigandBondType, getLigandCount, getLocalParity, getLocation, getLock, getLonePairCount, getMass, getMaxRgroupAttachmentPointOrder, getNode, getNodeCount, getNodeVector, getNonAromrings, getNonAromrings, getParent, getParentDocument, getParity, getParityType, getPoints, getPossibleAttachmentPoints, getRadicalCount, getSmallestRingSizeForIdx, getSSSR, getSSSRBonds, getSSSRBondSet, getSSSRBondSetInLong, getSSSRIdxesForAtoms, getStereo2, getStereo2, getStereo2, getStereo2, getStereo2, getStereo2, getStereo2, getSubGraphCount, getSubGraphs, getSubGraphs, getTotalCharge, getValenceCheckState, getValenceProperty, hasAtomSet, hasBondSet, hasExplicitLonePairs, hasExtraLabelSet, hasImplicitH, hasSelfReferringProperty, hasValenceError, hydrogenize, implicitizeHydrogens, implicitizeHydrogens, implicitizeHydrogens, incGrinvCC, incGrinvCCOnly, indexOf, indexOf, insertAtom, insertBond, insertBondInOrder, insertEdge, insertEdgeInOrder, insertNode, insertNullAtoms, insertNullBonds, isAbsStereo, isAcceptedSpecialLigand, isAtom, isAtomInRing, isBond, isGrinvCCValid, isLargeMolecule, isMultiChiral, isolate, isolate, isOnlyFirstAtomInStereoCalculation, isQuery, isRealAtomParent, isRing, isRingBond, isSelfReference, isSimilarTo, isSymmetric, isValenceCheckEnabled, isValidLinkNode, mergeFrags, mergeFrags, mergeNodes, moveTo, pack, partialClean, partialClean, partialClean, properties, qpropCheck, regenBonds, regenCtabs, regenEdges, regenGearch, removeAllEdges, removeAtom, removeAtom, removeBond, removeBond, removeEdge, removeEdge, removeExplicitLonePairs, removeIsolatedAtoms, removeIsolatedBonds, removeNode, removeNode, removeNode, removeNode, replaceBond, replaceEdge, resetCtab, resetGrinvInParents, restoreCache, revalidateCoordDependentProps, saveCache, setAbsStereo, setAtom, setAtomSetSeqs, setBond, setBondSetSeqs, setChirality, setEdge, setFlags, setFlags, setGrinvCC, setGrinvOptions, setLinkNodeDefaultOuters, setLocalParity, setLocalParity, setLocation, setNode, setParity, setParity, setParity, setSetSeqs, setValenceCheckEnabled, setValenceCheckState, smol, sortBondsAccordingTo, sortEdgesAccordingTo, stereoClean, sumConservedQuantities, toString, transform, updateDim, useOnlyFirstAtomInStereoCalculation, valenceCheck, valenceCheck
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RMCLEANUP_SGROUPATOMS

public static final int RMCLEANUP_SGROUPATOMS
Remove S-groups of removed superatoms.

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

RMCLEANUP_FROMSGROUPS

public static final int RMCLEANUP_FROMSGROUPS
Remove atoms from S-groups. The S-groups, which contain the atoms, are not removed from the molecule. The S-group removal is performed automatically only when all represented atoms were deleted from the S-group graph and the S-group graph is empty.

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

RMSG_DEFAULT

protected static final int RMSG_DEFAULT
Remove S-group's children and remove S-group from its parent.

Since:
Marvin 5.0, 03/27/2007
See Also:
Constant Field Values

RMSG_KEEP_CHILDREN

protected static final int RMSG_KEEP_CHILDREN
Do not remove S-group's children.

Since:
Marvin 5.0, 03/27/2007
See Also:
Constant Field Values

RMSG_KEEP_PARENT

protected static final int RMSG_KEEP_PARENT
Do not remove S-group from its parent.

Since:
Marvin 5.0, 03/27/2007
See Also:
Constant Field Values

RMSG_KEEP_MULTICENTER

protected static final int RMSG_KEEP_MULTICENTER
Do not remove central atom of multicenter S-groups.

Since:
Marvin 5.0, 10/22/2007
See Also:
Constant Field Values

RECURSIVE_UNGROUP

public static final int RECURSIVE_UNGROUP
Ungroup and expand (if possible) the child S-groups.

Since:
Marvin 5.1, 06/05/2008
See Also:
Constant Field Values

DEFAULT_UNGROUP

public static final int DEFAULT_UNGROUP
Do not ungroup and do not expand S-group's children.

Since:
Marvin 5.1, 06/05/2008
See Also:
Constant Field Values
Constructor Detail

Molecule

public Molecule(Molecule 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

Molecule

public Molecule(Molecule p,
                MolAtom a)
Construct a molecule consisting of a single atom (node).

Parameters:
p - the parent structure
a - the atom

Molecule

public Molecule(Molecule p,
                MolBond b)
Construct a molecule consisting of a single bond (edge).

Parameters:
p - the parent structure
b - the bond

Molecule

public Molecule()
Construct a 2 dimensional molecule.

Method Detail

setDim

public void setDim(int d)
Sets the dimension.

Overrides:
setDim in class MoleculeGraph
Parameters:
d - 0, 2, or 3
See Also:
MoleculeGraph.getFlags()

clear

public void clear()
Clears the molecule.

Overrides:
clear in class MoleculeGraph
See Also:
MoleculeGraph.clearForImport(java.lang.String), MoleculeGraph.theAtoms

clearForImport

public void clearForImport(java.lang.String format)
Initializes molecule for import.

Overrides:
clearForImport in class MoleculeGraph
Parameters:
format - input file format
Since:
Marvin 2.7
See Also:
MoleculeGraph.theBonds, MoleculeGraph.orix, MoleculeGraph.oriy, MoleculeGraph.oriz, MoleculeGraph.setFlags(int)

getStartPosition

public long getStartPosition()
Gets the starting position of this molecule in the input file.

Returns:
the starting position

setStartPosition

public void setStartPosition(long off)
Sets the starting position of this molecule in the input file.

Parameters:
off - the starting position

getEndPosition

public long getEndPosition()
Gets the end position of this molecule in the input file.

Returns:
the end position

setEndPosition

public void setEndPosition(long off)
Sets the end position of this molecule in the input file.

Parameters:
off - the end position

getName

public java.lang.String getName()
Gets the molecule name that was set by setName(String).

Specified by:
getName in interface Incomplecule
Overrides:
getName in class MoleculeGraph
Returns:
the molecule name or an empty string
Since:
Marvin 2.7

setName

public void setName(java.lang.String s)
Sets the molecule name.

Parameters:
s - the molecule name, empty string or null (null is equivalent to empty string)
Since:
Marvin 2.7

getComment

public java.lang.String getComment()
Gets the comment.

Returns:
the comment or empty string
Since:
Marvin 2.9

setComment

public void setComment(java.lang.String s)
Sets the comment.

Parameters:
s - the comment, empty string or null (null is equivalent to empty string)
Since:
Marvin 2.9

getInputFormat

public final java.lang.String getInputFormat()
Gets the input file format. Set by the import module if the molecule is from a file.

Returns:
"mol", "csmol", "sdf", "cssdf", "rdf", "csrdf", "smiles", "sybyl", "mol2", "pdb", "xyz" or "cube" or "inchi"
Since:
Marvin 2.7

setInputFormat

public void setInputFormat(java.lang.String format)
Sets the input file format.

Parameters:
format - the input format
Since:
Marvin 2.7
See Also:
getInputFormat()

clearProperties

public void clearProperties()
Clears RDfile/SDfile properties.


getPropertyCount

public int getPropertyCount()
Gets the total number of RDfile/SDfile properties.

Returns:
number of properties
Since:
Marvin 2.7

getPropertyKeys

public java.util.Enumeration getPropertyKeys()
Deprecated. as of Marvin 4.1, replaced by properties().getKeys()


getPropertyKey

public java.lang.String getPropertyKey(int i)
Gets an RDfile/SDfile property key.

Parameters:
i - property index
Returns:
the property name
Since:
Marvin 2.7

getProperty

@Deprecated
public java.lang.String getProperty(java.lang.String key)
Deprecated. as of Marvin 5.7 replaced by MPropHandler.convertToString(MProp, String), the following usage will give the same results:
 String property = MPropHandler.convertToString(mol.properties(), key);
 

Gets an RDfile/SDfile property.

Parameters:
key - property name
Returns:
the value of the property, or null if the key is not found

getPropertyObject

public java.lang.Object getPropertyObject(java.lang.String key)
Gets an RDfile/SDfile property object.

Parameters:
key - property name
Returns:
the value of the property, or null if the key is not found
Since:
Marvin 3.1.2

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Sets an RDfile/SDfile property. Setting null value removes the property.

Parameters:
key - the property name
value - the value or null

setPropertyObject

public void setPropertyObject(java.lang.String key,
                              java.lang.Object value)
Sets an RDfile/SDfile property object. Setting null value removes the property.

Parameters:
key - the property name
value - the value or null
Since:
Marvin 3.1.2

residueTypeOf

public static int residueTypeOf(java.lang.String name)
Gets the residue identifier for a residue name.

Parameters:
name - residue name
Returns:
the residue type

residueSymbolOf

public static java.lang.String residueSymbolOf(int id)
Gets the name of a residue.

Parameters:
id - the residue identifier
Returns:
the residue symbol

setAtom0

protected void setAtom0(int i,
                        MolAtom node)
Sets the atom at the specified index. Overridden because Sgroups must be set correctly in RgMolecule.clone() and RxnMolecule.clone().

Overrides:
setAtom0 in class MoleculeGraph
Parameters:
i - the atom index
node - the atom

removeAtom

public void removeAtom(MolAtom atom,
                       int cleanupFlags)
Removes an atom and its bonds by reference. This method is for internal use only. Use MoleculeGraph.removeAtom(MolAtom) instead unless you are sure what you are doing.

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

removeAtom

public void removeAtom(int i,
                       int cleanupFlags)
Removes an atom and its bonds by index. This method is for internal use only. Use MoleculeGraph.removeAtom(MolAtom) instead unless you are sure what you are doing.

Overrides:
removeAtom in class MoleculeGraph
Parameters:
i - the atom index
cleanupFlags - extra clean-up methods
Since:
Marvin 3.1
See Also:
MoleculeGraph.RMCLEANUP_NONE, MoleculeGraph.RMCLEANUP_ALL, MoleculeGraph.RMCLEANUP_EDGES, MoleculeGraph.RMCLEANUP_STEREO, RMCLEANUP_FROMSGROUPS

removeBond

protected void removeBond(MolBond bond,
                          int cleanupFlags)
Removes a bond by reference.

Overrides:
removeBond in class MoleculeGraph
Parameters:
bond - the bond
cleanupFlags - extra clean-up methods
Since:
Marvin 3.1
See Also:
MoleculeGraph.RMCLEANUP_NONE, MoleculeGraph.RMCLEANUP_ALL, MoleculeGraph.RMCLEANUP_EDGES, MoleculeGraph.RMCLEANUP_STEREO

removeBond

protected void removeBond(int i,
                          int cleanupFlags)
Removes a bond by index.

Overrides:
removeBond in class MoleculeGraph
Parameters:
i - the bond index
cleanupFlags - extra clean-up methods
Since:
Marvin 3.1
See Also:
MoleculeGraph.RMCLEANUP_NONE, MoleculeGraph.RMCLEANUP_ALL, MoleculeGraph.RMCLEANUP_EDGES, MoleculeGraph.RMCLEANUP_STEREO

removeAllBonds

public void removeAllBonds()
Removes all bonds.

Overrides:
removeAllBonds in class MoleculeGraph

removeAll

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

Overrides:
removeAll in class MoleculeGraph

isEmpty

public boolean isEmpty()
Tests whether the molecule is empty.

Overrides:
isEmpty in class MoleculeGraph
Returns:
true if the molecule graph does not contain any atoms, bonds or non-empty S-groups, false otherwise
Since:
Marvin 4.1.1, 09/06/2006

aromatize

public void aromatize(int method)
Aromatizes molecule.

Overrides:
aromatize in class MoleculeGraph
Parameters:
method - Specifies the algorithm for aromatization.
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
See Also:
MoleculeGraph.AROM_BASIC, MoleculeGraph.AROM_GENERAL, MoleculeGraph.AROM_LOOSE, Document about aromatization

aromatize

public void aromatize(int method,
                      boolean checkAmbiguity)
Aromatizes molecule.

Overrides:
aromatize in class MoleculeGraph
Parameters:
method - Specifies the algorithm for aromatization.
checkAmbiguity - Specifies whether ANY bonds should be considered during aromatization.
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)
See Also:
MoleculeGraph.AROM_BASIC, MoleculeGraph.AROM_GENERAL, MoleculeGraph.AROM_LOOSE, Document about aromatization

dearomatize

public boolean dearomatize()
Dearomatize molecule.

Overrides:
dearomatize in class MoleculeGraph
Returns:
true if success, else false.
Throws:
java.lang.SecurityException - cannot load module because of a security problem (firewall)

clonecopy

public void clonecopy(MoleculeGraph g)
Makes another molecule identical to this one.

Overrides:
clonecopy in class MoleculeGraph
Parameters:
g - the target molecule

fixSelfReferringProperty

protected boolean fixSelfReferringProperty(MProp prop)
Fix a property containing reference to the molecule. Called from clonelesscopy().

Overrides:
fixSelfReferringProperty in class MoleculeGraph
Parameters:
prop - the property
Since:
Marvin 4.1.6, 02/14/2007
See Also:
MoleculeGraph.clonecopy(MoleculeGraph)

addSgroupClones

protected final void addSgroupClones(Molecule origparentm,
                                     Molecule origm,
                                     Molecule newm)
Adds the S-groups of a child molecule clone to the new parent molecule clone.

Parameters:
origparentm - the original parent molecule
origm - the original child molecule
newm - the new child molecule (clone of the original)
Since:
Marvin 3.4

clonecopy

public void clonecopy(int[] iatoms,
                      MoleculeGraph g)
Copies the specified atoms and bonds of this molecule to another one.

Overrides:
clonecopy in class MoleculeGraph
Parameters:
iatoms - array of atom indices to copy or null
g - the target molecule graph
Since:
Marvin 5.0.2, 03/11/2008

clonecopyWithoutSgroups

protected void clonecopyWithoutSgroups(Molecule m)
Copies the all the contents except the S-groups into another molecule object.

Parameters:
m - the target molecule
Since:
Marvin 3.4

clonelesscopy

public void clonelesscopy(MoleculeGraph g)
Copies to selection. Makes another molecule identical to this one, but does not clone atoms, bonds, and the properties.

Overrides:
clonelesscopy in class MoleculeGraph
Parameters:
g - the target molecule object (the selection)

cloneMoleculeWithDocument

public Molecule cloneMoleculeWithDocument()
Makes an identical copy of the molecule and its document. Copies non-molecular data: graphics objects, electron flows, text boxes.

Returns:
the copy
Since:
Marvin 4.1, 01/16/2006

cloneMolecule

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

Returns:
the copy
Since:
Marvin 3.5.1, 11/20/2004

clone

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

Overrides:
clone in class MoleculeGraph
Returns:
the copy

toFormat

@Deprecated
public final java.lang.String toFormat(java.lang.String fmt)
Deprecated. As of release 5.7, replaced by MolExporter.exportToFormat(Molecule, String)

Creates a string representation of the molecule. The format descriptor string can also contain export options. Format and options are separated by a colon, multiple options can be separated by commas. See the text formats and their options on the File Formats in Marvin page. Examples:
 s1 = mol.toFormat("mol");
 s2 = mol.toFormat("smiles:a-H"); // aromatize and remove Hydrogens
 

Parameters:
fmt - the format descriptor string
Returns:
string representation of the molecule in the specified format
Throws:
java.lang.IllegalArgumentException - Invalid format string.
java.lang.SecurityException - Export module cannot be loaded because of security reasons (firewall).
See Also:
toObject(java.lang.String)

exportToFormat

@Deprecated
public final java.lang.String exportToFormat(java.lang.String fmt)
                                      throws MolExportException
Deprecated. As of release 5.7, replaced by MolExporter.exportToFormat(Molecule, String)

Creates a string representation of the molecule. Similar to toFormat(String), the only difference is that export exceptions are not converted to IllegalArgumentException.

Parameters:
fmt - the format descriptor string
Returns:
string representation of the molecule in the specified format
Throws:
MolExportException - Export error
java.lang.IllegalArgumentException - Invalid format string.
java.lang.SecurityException - Export module cannot be loaded because of security reasons (firewall).
Since:
Marvin 4.0, 07/01/2005
See Also:
toFormat(String)

toBinFormat

@Deprecated
public final byte[] toBinFormat(java.lang.String fmt)
Deprecated. As of release 5.7, replaced by MolExporter.exportToBinFormat(Molecule, String)

Creates a binary representation of the molecule. Works with all the text formats that are supported by the toFormat method, and also with the binary image formats (jpeg, msbmp, png, ppm). When creating an image, display options can also be specified in the format descriptor string. Format and options are separated by a colon, multiple options can be separated by commas. See the possible formats and their options on the File Formats in Marvin page. Examples:
 byte[] d1 = mol.toBinFormat("mol");
 byte[] d2 = mol.toBinFormat("smiles:a-H"); // aromatize and remove H
 byte[] d3 = mol.toBinFormat("ppm:w300,h300,#ffff00");
 byte[] d4 = mol.toBinFormat("png:w300,h300,b32,#00ffff00");
 byte[] d5 = mol.toBinFormat("jpeg:w300,h300,Q95,#ffff00,spacefill");
 

Parameters:
fmt - the format descriptor string
Returns:
a binary representation of the molecule in the specified format
Throws:
java.lang.IllegalArgumentException - Invalid format string.
java.lang.SecurityException - Export module cannot be loaded because of security reasons (firewall).
Since:
Marvin 2.7.11
See Also:
toObject(java.lang.String)

exportToBinFormat

@Deprecated
public final byte[] exportToBinFormat(java.lang.String fmt)
                               throws MolExportException
Deprecated. As of release 5.7, replaced by MolExporter.exportToBinFormat(Molecule, String)

Creates a binary representation of the molecule. Similar to toBinFormat(String), the only difference is that export exceptions are not converted to IllegalArgumentException.

Parameters:
fmt - the format descriptor string
Returns:
a binary representation of the molecule in the specified format
Throws:
MolExportException - Export error
java.lang.IllegalArgumentException - Invalid format string.
java.lang.SecurityException - Export module cannot be loaded because of security reasons (firewall).
Since:
Marvin 4.0, 07/01/2005
See Also:
toBinFormat(String)

toObject

@Deprecated
public java.lang.Object toObject(java.lang.String fmt)
Deprecated. As of release 5.7, replaced by MolExporter.exportToObject(Molecule, String)

Creates a String, byte[] array or Image representation of the molecule. When creating an image, display options can also be specified in the format descriptor string. Format and options are separated by a colon, multiple options can be separated by commas. See the possible formats and their options on the File Formats in Marvin page. Examples:
 import java.awt.Image;
 ...
 String s1 = (String)mol.toObject("mol");
 String s2 = (String)mol.toObject("smiles:a-H"); // aromatize, remove H
 Image img = (Image)mol.toObject("image:w300,h300,#ffff00");
 byte[] d3 = (byte[])mol.toObject("ppm:w300,h300,#ffff00");
 byte[] d4 = (byte[])mol.toObject("png:w300,h300,b32,#00ffff00");
 byte[] d5 = (byte[])mol.toObject("jpeg:w300,h300,Q95,#ffff00,spacefill");
 

Parameters:
fmt - the format descriptor string
Returns:
a String, a byte[] array or an Image
Throws:
java.lang.IllegalArgumentException - Invalid format string.
java.lang.SecurityException - Export module cannot be loaded because of security reasons (firewall).
Since:
Marvin 2.8.1
See Also:
toFormat(java.lang.String), toBinFormat(java.lang.String)

exportToObject

@Deprecated
public java.lang.Object exportToObject(java.lang.String fmt)
                                throws MolExportException
Deprecated. As of release 5.7, replaced by MolExporter.exportToObject(Molecule, String)

Creates a String, byte[] array or Image representation of the molecule. Similar to toObject(String), the only difference is that export exceptions are not converted to IllegalArgumentException.

Parameters:
fmt - the format descriptor string
Returns:
a String, a byte[] array or an Image
Throws:
MolExportException - Export error
java.lang.IllegalArgumentException - Invalid format string.
java.lang.SecurityException - Export module cannot be loaded because of security reasons (firewall).
Since:
Marvin 4.0, 07/01/2005
See Also:
toObject(String)

reuseAtom

public MolAtom reuseAtom(int z,
                         int i)
Reuse an atom or create a new one. If an atom is reused, all its properties except the corners are initialized.

Parameters:
z - the atomic number
i - the atom index
Returns:
the atom reference
Since:
Marvin 2.6

endReuse

public void endReuse(int n)
End reusing atoms.

Parameters:
n - number of atoms
Since:
Marvin 2.6

newInstance

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

Overrides:
newInstance in class MoleculeGraph
Returns:
a Molecule object

newSelectionMolecule

public SelectionMolecule newSelectionMolecule()
Creates a new SelectionMolecule object appropriate for storing selection from this molecule.

Returns:
an empty selection molecule
Since:
Marvin 4.1, 11/24/2005

makeItSimilar

protected void makeItSimilar(MoleculeGraph g)
Copies some properties of this molecule to the other one specified as argument. Copies the input format.

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

getSimplifiedMolecule

public final Molecule getSimplifiedMolecule()
Gets the simplified molecule object. It returns this usually. In case of RgMolecule, it returns the simply modified root structure if there are no R-groups present. It can simplify the molecule only if there is no parent document containing other objects.

Returns:
the simplified molecule
Since:
Marvin 3.0.1

getMostSimplifiedMolecule

protected Molecule getMostSimplifiedMolecule()
Gets the simplified molecule object even if there is a parent document with other objects. It returns this usually. In case of RgMolecule, it returns the root structure if there are no R-groups present.

Returns:
this in the default implementation
Since:
Marvin 4.1.13, 09/20/2007

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.

Overrides:
isMolecule in class MoleculeGraph
Returns:
true
Since:
Marvin 5.2

isReaction

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

Returns:
false
Since:
Marvin 3.0

canBeReactionComponent

public boolean canBeReactionComponent()
Tests whether an object of this class can be a reaction component. This implementation returns true

Returns:
true if it can be a reactant, product or agent, false if adding it to an RxnMolecule is not supported
Since:
Marvin 4.1.13, 09/19/2007

isSgroup

public boolean isSgroup()
Checks if the structure represents an S-group or not.

Returns:
true if the structure is an S-group
Since:
Marvin 3.0

getSgroupLigands

public MolAtom[] getSgroupLigands()
Gets the S-group's ligands if the structure represents an S-group.

Returns:
the array of ligands if the structure is an S-group with ligands, null otherwise
Since:
Marvin 3.0

findExpandableSgroup

public final Sgroup findExpandableSgroup()
Finds a contracted residue.

Returns:
the S-group if found, null if all S-groups are expanded
Since:
Marvin 3.0

findContractableSgroup

public final Sgroup findContractableSgroup()
Finds an expanded residue.

Returns:
the S-group if found, null if all S-groups are contracted
Since:
Marvin 3.0

getSgroupArray

public final Sgroup[] getSgroupArray()
Gets the array of S-groups.

Warning! Expansion or contraction of an S-group in this array may invalidate other array elements. Examples:

Returns:
an array containing all the S-groups
Since:
Marvin 3.0

getSgroupCount

public final int getSgroupCount()
Gets the number of S-groups.

Returns:
the number of S-groups
Since:
Marvin 3.0

countExpandableContractableSgroups

public final int countExpandableContractableSgroups()
Counts the expandable and contractable S-groups.

Returns:
the number of expandable/contractable S-groups
Since:
Marvin 5.0, 02/28/2007

countOrderedComponentSgroups

public final int countOrderedComponentSgroups()
Counts the ordered component S-groups.

Returns:
the number of ordered component S-groups.
Since:
Marvin 4.1.6, 02/28/2007

getSgroup

public final Sgroup getSgroup(int i)
Gets an S-group.

Parameters:
i - S-group index
Since:
Marvin 3.0

getSortedSgroups

public final Sgroup[] getSortedSgroups()
Gets the sorted S-groups in parent-child order.

Warning! Expansion or contraction of an S-group in this array may invalidate other array elements. Examples:

Returns:
array containing the S-groups
Since:
Marvin 3.4, 05/04/2004

getRootSgroups

public final Sgroup[] getRootSgroups()
Gets root s-groups (groups that are not embedded into another s-group).

Returns:
array containing the root s-groups (empty array if there are no s-groups)
Since:
Marvin 5.3.3, 31/03/2010

sortSgroupXBonds

public void sortSgroupXBonds()
Sorts superatom S-group crossing bonds in attachment point number order.

Since:
Marvin 5.0, 12/07/2007

indexOf

public final int indexOf(Sgroup sg)
Gets the array index of an S-group.

Parameters:
sg - the S-group
Since:
Marvin 3.0

findSgroupOf

public final Sgroup findSgroupOf(MolAtom a)
Finds the smallest S-group related to the specified atom.

Parameters:
a - the atom
Returns:
the S-group or null if not found
Since:
Marvin 3.0

findSgroupContaining

public final Sgroup findSgroupContaining(MolAtom a)
Finds the largest S-group that contains the specified atom.

Parameters:
a - the atom
Returns:
the S-group or null if not found
Since:
Marvin 3.0

findSmallestSgroupContaining

public final Sgroup findSmallestSgroupContaining(MolAtom a)
Finds the smallest S-group that contains the specified atom.

Parameters:
a - the atom
Returns:
the S-group or null if not found
Since:
Marvin 3.4

findAllSgroupContaining

public Sgroup[] findAllSgroupContaining(MolAtom a)
Finds all smallest S-groups containing the specified atom. There can be more groups containing the same atom and not embedding each other because of the data S-groups: they are not in the embedding hierarchy.

Parameters:
a - the atom
Returns:
the array of S-groups
Since:
Marvin 5.0.1

contains

public boolean contains(MolAtom atom)
Checks if the molecule graph contains the specified atom. If the atom is not found in the graph, looks in the sgroupgraphs of contracted Expandable-Sgroups.

Overrides:
contains in class MoleculeGraph
Parameters:
atom - the atom
Returns:
true if the graph or an sgroupgraph contains the object, false otherwise

setSgroupParent

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

Parameters:
a - the atom
sg - the S-group
set - set (true) or unset (false)
Throws:
java.lang.IllegalArgumentException - molecule does not contain the atom
Since:
Marvin 3.0

reparentSgroups

protected final void reparentSgroups(Molecule p)
Change parents of all S-groups in this molecule.

Parameters:
p - the new parent
Throws:
java.lang.IllegalArgumentException - molecule does not contain the atom
Since:
Marvin 3.0

mergeAtoms

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

Overrides:
mergeAtoms in class MoleculeGraph
Parameters:
that - the atom
node - the other atom

addAtom0

protected void addAtom0(MolAtom node)
Adds an atom.

Overrides:
addAtom0 in class MoleculeGraph
Parameters:
node - the atom reference

addAtomToFragment

protected void addAtomToFragment(MolAtom atom)
Adds an atom to a fragment. S-groups are added only if all atoms are already in the molecule.

Overrides:
addAtomToFragment in class MoleculeGraph
Parameters:
atom - the atom reference

addBond0

protected void addBond0(MolBond bond)
Adds a bond.

Overrides:
addBond0 in class MoleculeGraph
Parameters:
bond - the bond reference

contractSgroups

public final boolean contractSgroups()
Contracts all S-groups.

Returns:
true if the operation was successful, false if nothing changed
Since:
Marvin 3.0

expandSgroups

public final boolean expandSgroups()
Expands all S-groups.

Returns:
true if the operation was successful, false if nothing changed
Since:
Marvin 3.0
See Also:
expandSgroups(int)

expandSgroups

public final boolean expandSgroups(int opts)
Expands all S-groups.

Parameters:
opts - expansion options
Returns:
true if the operation was successful, false if nothing changed
Since:
Marvin 3.3
See Also:
Expandable.expand(int), Expandable.DEFAULT_OPTIONS, Expandable.MDL_EXPAND, Expandable.REVERSIBLE_EXPAND

isExpandable

public final boolean isExpandable(int opts)
Tests if the molecule is expandable with the specified options.

Parameters:
opts - expansion options
Returns:
true if an S-group is GUI-contractable, false otherwise
Since:
Marvin 4.0.2, 10/26/2005
See Also:
Expandable.DEFAULT_OPTIONS, Expandable.REVERSIBLE_EXPAND

setGUIContracted

public final void setGUIContracted(boolean v)
Contracts some S-groups to use in GUI or expands for any other use.

Parameters:
v - true in case of GUI usage, false for other cases
Since:
Marvin 3.4, 05/04/2004

setGUIContracted

public final void setGUIContracted(boolean v,
                                   int opts)
Contracts some S-groups to use in GUI or expands for any other use.

Parameters:
v - true in case of GUI usage, false for other cases
opts - option for updating coordinates
Since:
Marvin 3.4, 05/04/2004
See Also:
Expandable.COORDS_UPDATE

isGUIContracted

public final boolean isGUIContracted()
Tests if the molecule has a GUI-contracted S-group or not.

Returns:
true there is a GUI-contracted S-group, false otherwise
Since:
Marvin 3.4.1, 07/26/2004

ungroupSgroup

public final boolean ungroupSgroup(Sgroup sg)
Ungroups the specified S-group and expands it if it is an Expandable S-group. Ungroups and expands the child S-groups also if they are Expandable S-groups. Calls a recursive ungroup.

Parameters:
sg - the S-group
Returns:
true if the operation was successful, false if nothing changed
Since:
Marvin 3.4
See Also:
RECURSIVE_UNGROUP, ungroupSgroup(int)

ungroupSgroup

public final boolean ungroupSgroup(Sgroup sg,
                                   int opts)
Expand and ungroup the specified S-group.

Parameters:
sg - the S-group
opts - option to specify the ungroup type
Returns:
true if the operation was successful, false if nothing changed
Since:
Marvin 5.1.2
See Also:
RECURSIVE_UNGROUP, DEFAULT_UNGROUP, ungroupSgroup(int, int)

ungroupSgroup

public final boolean ungroupSgroup(int i)
Ungroups the specified S-group and expands it if it is an Expandable S-group. Ungroups and expands the child S-groups also if they are Expandable S-groups.

Parameters:
i - the S-group index
Returns:
true if the operation was successful, false if nothing changed
Since:
Marvin 3.4
See Also:
ungroupSgroup(chemaxon.struc.Sgroup), RECURSIVE_UNGROUP

ungroupSgroups

public final boolean ungroupSgroups(int type)
Ungroups all S-groups of a specified type in this molecule. Performs expand before ungroup if the type is an expandable S-group type.

Parameters:
type - the S-group type that specifies which S-groups to ungroup.
Returns:
true if the operation was successful, false if nothing changed.
Since:
Marvin 5.2
See Also:
ungroupSgroup(Sgroup sg)

ungroupSgroup

public final boolean ungroupSgroup(int i,
                                   int opts)
Ungroups the specified S-group and expands it if it is an Expandable S-group. Ungroups and expands the child S-groups also if they are Expandable S-groups according to the specified option.

Parameters:
i - the S-group index
opts - option to specify the ungroup type
Returns:
true if the operation was successful, false if nothing changed
Since:
Marvin 5.1
See Also:
RECURSIVE_UNGROUP, DEFAULT_UNGROUP, ungroupSgroup(chemaxon.struc.Sgroup)

ungroupSgroups

public final boolean ungroupSgroups()
Expand and ungroup all S-groups.

Returns:
true if the operation was successful, false if nothing changed
Since:
Marvin 3.0

addSgroupsOf

protected final void addSgroupsOf(Molecule m)
Adds S-groups to this object and its parent.


removeSgroupsOf

protected final void removeSgroupsOf(Molecule m,
                                     int rmflags)
Removes S-groups that are contained in a given molecule but not contained in another molecule.

Parameters:
m - the molecule whose S-groups are to remove
rmflags - removal flags
Since:
Marvin 4.1.7
See Also:
RMSG_DEFAULT, RMSG_KEEP_CHILDREN, RMSG_KEEP_PARENT

removeSgroupsOf

protected final void removeSgroupsOf(Molecule m)
Removes S-groups from this object and its parent.


removeAllSgroups

protected void removeAllSgroups()
Removes all S-groups.


removeSgroupFromList

protected void removeSgroupFromList(Sgroup sg)
Removes an S-group from the sgroupVector.

Since:
Marvin 4.1, 07/28/2006

addSgroup

public void addSgroup(Sgroup sg,
                      boolean setparent)
Adds an S-group to this object.

Parameters:
sg - the S-group to add.
setparent - if true then the parent of the S-group is set to this molecule and the S-group is removed from the old parent molecule.
Since:
Marvin 5.2

getGraphUnionAsSelection

protected final SelectionMolecule getGraphUnionAsSelection()
Gets a selection molecule containing all the atoms and bonds. Returns the same object until the unified structure is (or might be) changed, then recreates it.

Returns:
a selection molecule object containing the unified structure
Since:
Marvin 3.0, 11/05/2002
See Also:
SelectionMolecule

bondlength

public double bondlength()
Calculate the regular bond length for the unified structure.

Overrides:
bondlength in class MoleculeGraph
Returns:
the regular bond length

convertToFrags

public final Molecule[] convertToFrags()
Converts this molecule to its disconnected fragments, expanding all S-groups and keeping disconnected Multicenter S-groups in the same fragment, but ungroupping and separating fragments in all other types of S-groups.

Warning: Atoms are removed from the original molecule object to the created fragments, therefore the original molecule becomes inconsistent.

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.

Returns:
array of fragments
Since:
Marvin 3.1
See Also:
MoleculeGraph.findFrags(Class, int)

findFrags

public final SelectionMolecule[] findFrags()
Determines the disconnected fragments and puts them into an array. Multicenter S-groups are kept in one fragment.

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.

Returns:
array of fragments
Since:
Marvin 3.0

fillSelectionMolecule

protected void fillSelectionMolecule(SelectionMolecule s)
Adds all atoms and bonds to the specified molecule.

Parameters:
s - the selection molecule
Since:
Marvin 3.0, 11/05/2002

clearExtraLabels

public void clearExtraLabels()
Clears extra atom labels.


checkConsistency

public void checkConsistency()
Deprecated. 

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

Overrides:
checkConsistency in class MoleculeGraph
Throws:
java.lang.RuntimeException - if inconsistency found
Since:
Marvin 5.0, 11/06/2007

checkSgroupConsistency

protected void checkSgroupConsistency()
Checks the internal consisitency of S-groups.

Throws:
java.lang.RuntimeException - if inconsistency found
Since:
Marvin 5.0, 11/06/2007

getVisibleCoords

public double[] getVisibleCoords(MolAtom ma)
Returns the coordinates of the given atom (contained in the molecule). If the atom is part of a contracted superatom sgroup, its coordinates may be false, so this method returns the coordinates of the corresponding sgroup atom instead.

Overrides:
getVisibleCoords in class MoleculeGraph
Parameters:
ma - The atom to be queried.
Returns:
The real coordinates of ma.
Since:
Marvin 4.0 8/07/2005

transform

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

Overrides:
transform in class MoleculeGraph
Parameters:
t - the transformation matrix
incg - graph invariants are changed (true) or not (false)
Since:
Marvin 4.0 2/09/2005

findContainingMulticenterSgroup

public chemaxon.struc.sgroup.MulticenterSgroup findContainingMulticenterSgroup(MolAtom atom)
Gets the containing multicenter S-group of a multicenter atom.

Parameters:
atom - the multicenter atom.
Returns:
the containing multicenter S-group, null if none of the multicenter sgroups contains the multicenter atom.
Since:
Marvin 5.0 04/20/2007
See Also:
MulticenterSgroup, MolAtom.MULTICENTER

createGearch

protected chemaxon.struc.gearch.MoleculeGraphGearch createGearch()
Overrides:
createGearch in class MoleculeGraph

clearObjects

public void clearObjects()
Specified by:
clearObjects in interface chemaxon.struc.MObjectContainer

getObjectCount

public int getObjectCount()
Specified by:
getObjectCount in interface chemaxon.struc.MObjectContainer

removeObject

public void removeObject(MObject mo)
Specified by:
removeObject in interface chemaxon.struc.MObjectContainer

selectAllObjects

public void selectAllObjects(boolean s)
Specified by:
selectAllObjects in interface chemaxon.struc.MObjectContainer

getAllObjects

public java.util.List<MObject> getAllObjects()
Specified by:
getAllObjects in interface chemaxon.struc.MObjectContainer

replaceSgroup

public void replaceSgroup(Sgroup sgroup,
                          Sgroup newSgroup)
Replaces an S-group with a new sgroup in the molecule. Sets parent - child relations of the new sgroup according to the parent - child relations of the old sgroup.

Parameters:
sgroup - the sgroup to replace
newSgroup - the sgroup to replace with

implicitizeHydrogens0

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

Overrides:
implicitizeHydrogens0 in class MoleculeGraph
Returns:
true if success else false

mergeFrags

@Deprecated
public void mergeFrags()
Deprecated. since 5.6, it was used by an internal method, not intended for public usage.

Merges fragments of atoms that are in the same Multicenter S-group.

Overrides:
mergeFrags in class MoleculeGraph

getFreeAttachmentPoints

public int getFreeAttachmentPoints(java.lang.Integer atom)
Calculates the available attachment point value for an atom based on the possible attachment point value and occupied attachment point value.

Parameters:
atom - the atom to calculate the available attachment point value for
Returns:
the calculated attachment point value

getFreeAttachmentPoints

public int getFreeAttachmentPoints(MolAtom atom)
Description copied from class: MoleculeGraph

Specified by:
getFreeAttachmentPoints in interface chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>
Overrides:
getFreeAttachmentPoints in class MoleculeGraph