Class Molecule
- java.lang.Object
-
- chemaxon.struc.MoleculeGraph
-
- chemaxon.struc.Molecule
-
- All Implemented Interfaces:
chemaxon.core.calculations.valencecheck.MoleculeWithValence<MolAtom>
,chemaxon.core.structure.MoleculeForBuilder
,chemaxon.core.structure.RootStructureForBuilder
,chemaxon.core.structure.StructureForBuilder
,Incomplecule
,chemaxon.struc.MObjectContainer
,MTransformable
,StereoConstants
,Serializable
- Direct Known Subclasses:
RgMolecule
,RxnMolecule
@PublicAPI public class Molecule extends MoleculeGraph implements chemaxon.struc.MObjectContainer
Molecule class. A MoleculeGraph that may also contain S-groups.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class chemaxon.struc.MoleculeGraph
MoleculeGraph.ValenceCheckState
-
-
Field Summary
Fields Modifier and Type Field Description 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
RM_KEEP_LEAVINGGROUPS
Deprecated.As of Marvin 6.2, no replacement.
Not supported feature.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_CHUCKEL, 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_ALL_POSSIBLE, CHIRALITYSUPPORT_NONE, CHIRALITYSUPPORT_SELECTED, CIS, CIS_TRANS, CTUMASK, CTUNKNOWN, CTUNSPEC, DBS_ALL, DBS_MARKED, DBS_NONE, ENDO, EXO, PARITY_ALLENE, PARITY_EITHER, PARITY_EVEN, PARITY_MASK, PARITY_NONE, PARITY_ODD, PARITY_TETRAHEDRAL, PARITY_UNSPEC, STGRP_ABS, STGRP_AND, STGRP_NONE, STGRP_OR, SYN, TRANS
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
add(MolBond bond)
Adds a bond to the molecule.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 originalParent, Molecule originalChild, Molecule newChild)
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.As of Marvin 5.7, no replacement.
Not intended for public use, it was intended only for internal debugging.protected void
checkSgroupConsistency()
Checks the internal consisitency of S-groups.void
clear()
Clears the molecule.void
clearExtraLabels()
Clears extra atom labels.void
clearForImport(String format)
Initializes molecule for import.void
clearObjects()
void
clearProperties()
Clears RDfile/SDfile properties.Molecule
clone()
Makes an identical copy of the molecule.protected int
cloneAtoms(int[] cnodes, MoleculeGraph graph)
Copies the specified atoms.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)
Deprecated.as of Marvin 6.3.
Not supported feature.Molecule
cloneMolecule()
Deprecated.as of Marvin 2014.09.01.0 useclone()
insteadMolecule
cloneMoleculeWithDocument()
Makes an identical copy of the molecule and its document.protected void
connectOriginalBondsToNewAtom(MolAtom newAtom, MolAtom orig, MolBond[] bonds)
Sets the original connections to the new atom.boolean
contains(MolAtom atom)
Checks if the molecule graph contains the specified atom.boolean
contractSgroups()
Contracts all S-groups.boolean
contractSgroups(int opts)
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(String fmt)
Deprecated.As of Marvin 5.7, replaced byMolExporter.exportToBinFormat(Molecule, String)
.String
exportToFormat(String fmt)
Deprecated.As of Marvin 5.7, replaced byMolExporter.exportToFormat(Molecule, String)
.Object
exportToObject(String fmt)
Deprecated.As of Marvin 5.7, replaced byMolExporter.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.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.<C extends MoleculeGraph>
C[]findFrags(Class<C> cl, int fragmentationType)
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.protected void
fuse0(MoleculeGraph graph, boolean check)
Adds those atoms and bonds of a molecule graph to this one that are not already elements.List<MObject>
getAllObjects()
protected MolBond[]
getBonds(MolAtom atom)
Returns the bonds attached to the given atom.String
getComment()
Gets the comment.long
getEndPosition()
Gets the end position of this molecule in the input file.protected SelectionMolecule
getGraphUnionAsSelection()
Gets a selection molecule containing all the atoms and bonds.String
getId()
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.String
getName()
Gets the molecule name/title that was set bysetName(String)
.int
getObjectCount()
String
getProperty(String key)
Deprecated.As of Marvin 5.7, replaced byMPropHandler.convertToString(MProp, String)
.
Usage:int
getPropertyCount()
Gets the total number of RDfile/SDfile properties.String
getPropertyKey(int i)
Gets an RDfile/SDfile property key.Enumeration<?>
getPropertyKeys()
Deprecated.As of Marvin 4.1, replaced byproperties()
.getKeys()
andproperties()
.getKeyEnumeration()
.
One-to-one replacement is methodgetKeyEnumeration()
but methodgetKeys()
is simpler to use.Object
getPropertyObject(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.IteratorFactory.SgroupIterator
getSgroupIterator()
Returns an iterator over the s-groups in this molecule in proper sequence.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).boolean
hasAtomSet()
Tests whether the molecule graph has atom sets.boolean
hasContractedSgroup()
Tests if the molecule has contracted S-groups or not.boolean
hasId(String id)
protected boolean
implicitizeHydrogens0(int f, MolAtom[] atoms, boolean check)
Deprecated.As of Marvin 5.7, replaced byHydrogenize.convertExplicitHToImplicit(MoleculeGraph, MolAtom[], int, boolean)
.
Usage: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()
Deprecated.as of Marvin 6.2 replaced byhasContractedSgroup()
boolean
isReaction()
Checks if the structure represents a reaction or not.boolean
isSgroup()
Deprecated.As of Marvin 14.7.7, no replacement.
Not supported feature.protected void
makeItSimilar(MoleculeGraph g)
Copies some properties of this molecule to the other one specified as argument.void
mergeAtoms(MolAtom that, MolAtom node)
Deprecated.As of Marvin 6.2, useMergeUtil.mergeAtoms(MolAtom, MolAtom, boolean)
instead.MoleculeGraph
newInstance()
Creates a new Molecule object.SelectionMolecule
newSelectionMolecule()
Creates a new SelectionMolecule object appropriate for storing selection from this molecule.void
rearrangeSgroups(int[] newIndexes)
Orders S-groups in the vector of S-groups in the given order corresponding to the given new indexes.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
removeAtomFromChildren(Sgroup sgroup, MolAtom atom)
Removes the parameter atom from the parameter S-group and it's descendants.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
replaceAtom(int i, MolAtom newAtom)
Replaces the atom on the given index with the parameter atom and removes the parameter atom from its original parent molecule if needed.void
replaceSgroup(Sgroup sgroup, Sgroup newSgroup)
Replaces an S-group with a new sgroup in the molecule.static String
residueSymbolOf(int id)
Gets the name of a residue.static int
residueTypeOf(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 newAtom)
Sets the atom at the specified index.void
setComment(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 contract)
Deprecated.as of Marvin 6.2, useexpandSgroups(int)
orcontractSgroups(int)
instead with option parameterExpandable.LEAVE_COORDS_UNCHANGED
void
setGUIContracted(boolean contract, int opts)
Deprecated.as of Marvin 6.2, useexpandSgroups(int)
orcontractSgroups(int)
instead with option parameterExpandable.LEAVE_COORDS_UNCHANGED
void
setId(String id)
void
setInputFormat(String format)
Sets the input file format.void
setName(String s)
Sets the molecule name/title.void
setProperty(String key, String value)
Sets an RDfile/SDfile property.void
setPropertyObject(String key, 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()
Deprecated.As of Marvin 5.12, no replacement.
Crossing bonds of aSuperatomSgroup
do not need to be sorted any more.byte[]
toBinFormat(String fmt)
Deprecated.As of Marvin 5.7, replaced byMolExporter.exportToBinFormat(Molecule, String)
.String
toFormat(String fmt)
Deprecated.As of Marvin 5.7, replaced byMolExporter.exportToFormat(Molecule, String)
.Object
toObject(String fmt)
Deprecated.As of Marvin 5.7, replaced byMolExporter.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)
Deprecated.as of Marvin 6.3.boolean
ungroupSgroup(int i, int opts)
Deprecated.as of Marvin 6.3.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()
Expands and ungroups all S-groups.boolean
ungroupSgroups(int type)
Deprecated.as of Marvin 6.3.boolean
ungroupSgroups(EnumSet<SgroupType> types)
Ungroups all S-groups of the specified types in this molecule.-
Methods inherited from class chemaxon.struc.MoleculeGraph
add, add, addAtomsAndBondsTo, addAtomWithoutChangingIt, addBondWithoutChangingIt, addExplicitHydrogens, addExplicitHydrogens, addExplicitLonePairs, addSimpleAtomWithoutChangingIt, adjustMultiChiralFlag, aromatize, aromatize, arrangeComponents, atoms, bonds, calcCenter, calcCenter, calcDehydrogenizedGrinv, calcHeight, calcHybridization, calcOutRect, calcOutRect, calcOutRectCenter, calcOutRectCenter, calcWidth, canBeCT, canBeCT, canBeCT, checkBondConsistency, clean, clean, clearCachedInfo, clonecopyMoleculeGraphWithoutSgroups, contains, contains, createDehydrogenizedReadOnlyGraph, createSmolecule, dearomatize, findAtom, findAtomClone, findBasicFrags, findBond, findComponentIds, findComponentIds, findFrag, findFrag, findFragById, findFrags, findInArray, fixProperties, fuse, fuse, getAromaticAndAliphaticRings, getAtom, getAtomArray, getAtomCount, getAtomCount, getAtomicNumber, getAtomIterator, getAtomReferenceList, getBond, getBondArray, getBondCount, getBondIterator, getBondTable, getCharge, getChirality, getCSSR, getCSSRIdxesForAtoms, getCtab, getDesiredLength, getDesiredLength, getDim, getDocument, getDocumentForChild, getEnclosingCube, getExactMass, getExplicitHcount, getExplicitLonePairCount, getEZStereo, getFlags, getForefather, getFormalCharge, getFormula, getFragCount, getFragCount, getFragIds, getFreeAttachmentPoints, getGraphUnion, getGrinv, getGrinv, getGrinv, getGrinv, getGrinvCC, getGrinvOptions, getImplicitHcount, getImplicitHCount, getLigand, getLigandAtno, getLigandBondType, getLigandCount, getLocalParity, getLocation, getLock, getLonePairCount, getMass, getMaxRgroupAttachmentPointOrder, getParent, getParentDocument, getParity, getParityType, getPoints, getPossibleAttachmentPoints, getRadicalCount, getSmallestRingSizeForIdx, getSSSR, getSSSRBonds, getSSSRBondsAsBitSet, getSSSRBondSet, getSSSRBondSetInLong, getSSSRIdxesForAtoms, getStereo2, getStereo2, getStereo2, getStereo2, getStereo2, getStereo2, getStereo2, getSubGraphCount, getSubGraphs, getSubGraphs, getTotalCharge, getValenceCheckOptions, getValenceCheckState, getValenceProperty, hasBondSet, hasExplicitLonePairs, hasExtraLabelSet, hasImplicitH, hasSelfReferringProperty, hasValenceError, hydrogenize, implicitizeHydrogens, implicitizeHydrogens, implicitizeHydrogens, incGrinvCC, incGrinvCC, incGrinvCCOnly, indexOf, indexOf, insertAtom, insertBond, insertBondInOrder, insertNullAtoms, insertNullBonds, isAbsStereo, isAcceptedSpecialLigand, isAtom, isAtomInRing, isBond, isBondParallelWith, isGrinvCCValid, isLargeMolecule, isMolecule, isMultiChiral, isolate, isolate, isOnlyFirstAtomInStereoCalculation, isQuery, isRealAtomParent, isRing, isRingBond, isSelfReference, isSimilarTo, isSymmetric, isValenceCheckEnabled, isValidLinkNode, mergeFrags, moveTo, pack, partialClean, partialClean, partialClean, properties, qpropCheck, regenBonds, regenBtab, regenCtab, regenGearch, removeAtom, removeAtom, removeBond, removeBond, removeExplicitLonePairs, removeIsolatedAtoms, removeIsolatedBonds, replaceBond, resetCtab, resetGrinvInParents, restoreCache, revalidateCoordDependentProps, saveCache, setAbsStereo, setAtom, setAtomSetSeqs, setBond, setBondSetSeqs, setChirality, setChirality, setFlags, setFlags, setGrinvCC, setGrinvOptions, setLinkNodeDefaultOuters, setLocalParity, setLocalParity, setLocation, setParity, setParity, setParity, setSupergraph, setValenceCheckEnabled, setValenceCheckOptions, setValenceCheckState, smol, sortBondsAccordingTo, stereoClean, sumConservedQuantities, toString, transform, updateDim, useOnlyFirstAtomInStereoCalculation, valenceCheck, valenceCheck
-
-
-
-
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
-
RM_KEEP_LEAVINGGROUPS
@Deprecated public static final int RM_KEEP_LEAVINGGROUPS
Deprecated.As of Marvin 6.2, no replacement.
Not supported feature.Keep leaving group while removing its bond.- Since:
- Marvin 6.2 2013.07.01.
- See Also:
removeAtom(int, int)
,removeAtom(MolAtom, 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 fragmentna
- no reallocation needed until the number of atoms is less than this valuenb
- 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 structurea
- the atom
-
Molecule
public Molecule(Molecule p, MolBond b)
Construct a molecule consisting of a single bond (edge).- Parameters:
p
- the parent structureb
- the bond
-
Molecule
public Molecule()
Construct a 2 dimensional molecule.
-
-
Method Detail
-
setDim
public void setDim(int d)
Sets the dimension.- Overrides:
setDim
in classMoleculeGraph
- Parameters:
d
- 0, 2, or 3- See Also:
MoleculeGraph.getFlags()
-
clear
public void clear()
Clears the molecule.- Overrides:
clear
in classMoleculeGraph
- See Also:
MoleculeGraph.clearForImport(java.lang.String)
,MoleculeGraph.theAtoms
-
clearForImport
public void clearForImport(String format)
Initializes molecule for import.- Overrides:
clearForImport
in classMoleculeGraph
- 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 String getName()
Gets the molecule name/title that was set bysetName(String)
.- Specified by:
getName
in interfaceIncomplecule
- Overrides:
getName
in classMoleculeGraph
- Returns:
- the molecule name or an empty string
- Since:
- Marvin 2.7
-
setName
public void setName(String s)
Sets the molecule name/title.- Parameters:
s
- the molecule name, empty string or null (null is equivalent to empty string)- Since:
- Marvin 2.7
-
getComment
public String getComment()
Gets the comment.- Returns:
- the comment or empty string
- Since:
- Marvin 2.9
-
setComment
public void setComment(String s)
Sets the comment.- Parameters:
s
- the comment, empty string or null (null is equivalent to empty string)- Since:
- Marvin 2.9
-
getId
public String getId()
-
setId
public void setId(String id)
-
hasId
public boolean hasId(String id)
-
getInputFormat
public final String getInputFormat()
Gets the input file format. Set by the import module if the molecule is from a file.- Returns:
- "mrv", "mol", "mol:V3", "csmol", "sdf", "cssdf", "rdf", "csrdf", "smiles", "sybyl", "mol2", "pdb", "xyz" or "cube" or "inchi" or null if not imported from any format
- Since:
- Marvin 2.7
-
setInputFormat
public void setInputFormat(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
@Deprecated public Enumeration<?> getPropertyKeys()
Deprecated.As of Marvin 4.1, replaced byproperties()
.getKeys()
andproperties()
.getKeyEnumeration()
.
One-to-one replacement is methodgetKeyEnumeration()
but methodgetKeys()
is simpler to use.
-
getPropertyKey
public 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 String getProperty(String key)
Deprecated.As of Marvin 5.7, replaced byMPropHandler.convertToString(MProp, String)
.
Usage: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 Object getPropertyObject(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(String key, String value)
Sets an RDfile/SDfile property. Setting null value removes the property.- Parameters:
key
- the property namevalue
- the value or null
-
setPropertyObject
public void setPropertyObject(String key, Object value)
Sets an RDfile/SDfile property object. Setting null value removes the property.- Parameters:
key
- the property namevalue
- the value or null- Since:
- Marvin 3.1.2
-
residueTypeOf
public static int residueTypeOf(String name)
Gets the residue identifier for a residue name.- Parameters:
name
- residue name- Returns:
- the residue type
-
residueSymbolOf
public static 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 newAtom)
Sets the atom at the specified index. Overridden because Sgroups must be set correctly in RgMolecule.clone() and RxnMolecule.clone().- Overrides:
setAtom0
in classMoleculeGraph
- Parameters:
i
- the atom indexnewAtom
- 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. UseMoleculeGraph.removeAtom(MolAtom)
instead unless you are sure what you are doing.- Overrides:
removeAtom
in classMoleculeGraph
- Parameters:
atom
- the atomcleanupFlags
- 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. UseMoleculeGraph.removeAtom(MolAtom)
instead unless you are sure what you are doing.- Overrides:
removeAtom
in classMoleculeGraph
- Parameters:
i
- the atom indexcleanupFlags
- 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 classMoleculeGraph
- Parameters:
bond
- the bondcleanupFlags
- 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 classMoleculeGraph
- Parameters:
i
- the bond indexcleanupFlags
- 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 classMoleculeGraph
-
removeAll
public void removeAll()
Removes all the atoms and bonds.- Overrides:
removeAll
in classMoleculeGraph
-
isEmpty
public boolean isEmpty()
Tests whether the molecule is empty.- Overrides:
isEmpty
in classMoleculeGraph
- 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 classMoleculeGraph
- Parameters:
method
- Specifies the algorithm for aromatization.- Throws:
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 classMoleculeGraph
- Parameters:
method
- Specifies the algorithm for aromatization.checkAmbiguity
- Specifies whether ANY bonds should be considered during aromatization.- Throws:
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 classMoleculeGraph
- Returns:
- true if success, else false.
- Throws:
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 classMoleculeGraph
- 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 classMoleculeGraph
- Parameters:
prop
- the property- Since:
- Marvin 4.1.6, 02/14/2007
- See Also:
MoleculeGraph.clonecopy(MoleculeGraph)
-
addSgroupClones
protected final void addSgroupClones(Molecule originalParent, Molecule originalChild, Molecule newChild)
Adds the S-groups of a child molecule clone to the new parent molecule clone.- Parameters:
originalParent
- the original parent moleculeoriginalChild
- the original child moleculenewChild
- 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 classMoleculeGraph
- Parameters:
iatoms
- array of atom indices to copy ornull
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
-
cloneAtoms
protected int cloneAtoms(int[] cnodes, MoleculeGraph graph)
Copies the specified atoms.- Overrides:
cloneAtoms
in classMoleculeGraph
- Parameters:
cnodes
- array of atom indices to copy ornull
graph
- the target molecule graph- Returns:
- the atom count
- Since:
- Marvin 6.0, 2013.02.25.
-
clonelesscopy
@Deprecated public void clonelesscopy(MoleculeGraph g)
Deprecated.as of Marvin 6.3.
Not supported feature.Copies to selection. Makes another molecule identical to this one, but does not clone atoms, bonds, and the properties.- Overrides:
clonelesscopy
in classMoleculeGraph
- Parameters:
g
- the target molecule object (the selection)
-
cloneMoleculeWithDocument
public Molecule cloneMoleculeWithDocument()
Makes an identical copy of the molecule and its document. If the molecule does not have a parent, then copies non-molecular data: graphics objects, electron flows, text boxes, atom and bond sets (color, font and thickness). Otherwise (root, rgroup, component molecule) creates a new document.- Returns:
- the copy
- Since:
- Marvin 4.1, 01/16/2006
-
cloneMolecule
@Deprecated public Molecule cloneMolecule()
Deprecated.as of Marvin 2014.09.01.0 useclone()
insteadMakes an identical copy of the molecule. It also clones the atoms and bonds of the Molecule. Note that it does not clone the correspondingMDocument
, hence the atom and bond formatting (color, font, thickness) is lost.- Returns:
- the copy
- Since:
- Marvin 3.5.1, 11/20/2004
-
clone
public Molecule clone()
Makes an identical copy of the molecule. It also clones the atoms and bonds of the Molecule. Note, that it does not clone the correspondingMDocument
, hence the atom and bond formatting (color, font, thickness) is lost.- Overrides:
clone
in classMoleculeGraph
- Returns:
- the copy
-
toFormat
@Deprecated public final String toFormat(String fmt)
Deprecated.As of Marvin 5.7, replaced byMolExporter.exportToFormat(Molecule, String)
.
To get exact replacement use:
try { String out = MolExporter.exportToFormat(this, fmt); } catch (IOException e) { throw new IllegalArgumentException(e); }
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:
IllegalArgumentException
- Invalid format string.SecurityException
- Export module cannot be loaded because of security reasons (firewall).- See Also:
toObject(java.lang.String)
-
exportToFormat
@Deprecated public final String exportToFormat(String fmt) throws IOException
Deprecated.As of Marvin 5.7, replaced byMolExporter.exportToFormat(Molecule, String)
.Creates a string representation of the molecule. Similar totoFormat(String)
, the only difference is that export exceptions are not converted toIllegalArgumentException
.- Parameters:
fmt
- the format descriptor string- Returns:
- string representation of the molecule in the specified format
- Throws:
IOException
MolExportException
- Export errorIllegalArgumentException
- Invalid format string.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(String fmt)
Deprecated.As of Marvin 5.7, replaced byMolExporter.exportToBinFormat(Molecule, String)
.Creates a binary representation of the molecule. Works with all the text formats that are supported by thetoFormat
method, and also with the binary image formats (jpeg, msbmp, png). 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("png:w300,h300,b32,#00ffff00"); byte[] d4 = 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:
IllegalArgumentException
- Invalid format string.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(String fmt) throws IOException
Deprecated.As of Marvin 5.7, replaced byMolExporter.exportToBinFormat(Molecule, String)
.Creates a binary representation of the molecule. Similar totoBinFormat(String)
, the only difference is that export exceptions are not converted toIllegalArgumentException
.- Parameters:
fmt
- the format descriptor string- Returns:
- a binary representation of the molecule in the specified format
- Throws:
MolExportException
- Export errorIllegalArgumentException
- Invalid format string.SecurityException
- Export module cannot be loaded because of security reasons (firewall).IOException
- Since:
- Marvin 4.0, 07/01/2005
- See Also:
toBinFormat(String)
-
toObject
@Deprecated public Object toObject(String fmt)
Deprecated.As of Marvin 5.7, replaced byMolExporter.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("png:w300,h300,b32,#00ffff00"); byte[] d4 = (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:
IllegalArgumentException
- Invalid format string.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 Object exportToObject(String fmt) throws IOException
Deprecated.As of Marvin 5.7, replaced byMolExporter.exportToObject(Molecule, String)
.Creates a String, byte[] array or Image representation of the molecule. Similar totoObject(String)
, the only difference is that export exceptions are not converted toIllegalArgumentException
.- Parameters:
fmt
- the format descriptor string- Returns:
- a String, a byte[] array or an Image
- Throws:
MolExportException
- Export errorIllegalArgumentException
- Invalid format string.SecurityException
- Export module cannot be loaded because of security reasons (firewall).IOException
- 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 numberi
- 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 classMoleculeGraph
- 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 classMoleculeGraph
- Parameters:
g
- the molecule to change
-
getSimplifiedMolecule
public final Molecule getSimplifiedMolecule()
Gets the simplified molecule object. It returnsthis
usually. In case ofRgMolecule
, it returns the simply modified root structure if there are no R-groups present. In this case theRgMolecule
will be inconsistent. 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 returnsthis
usually. In case ofRgMolecule
, 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
-
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 returnstrue
- Returns:
true
if it can be a reactant, product or agent,false
if adding it to anRxnMolecule
is not supported- Since:
- Marvin 4.1.13, 09/19/2007
-
isSgroup
@Deprecated public boolean isSgroup()
Deprecated.As of Marvin 14.7.7, no replacement.
Not supported feature.Checks if the structure represents an S-group or not.- Returns:
true
if the structure is an S-group,false
otherwise- 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:
- contracting a MultipleSgroup removes any embedded SuperatomSgroup except those inside the repeating unit,
- expanding a MultipleSgroup adds n-1 new clones for each embedded SuperatomSgroup in the repeating unit.
- 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:
- contracting a MultipleSgroup removes any embedded SuperatomSgroup except those inside the repeating unit,
- expanding a MultipleSgroup adds n-1 new clones for each embedded SuperatomSgroup in the repeating unit.
- 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
@Deprecated public void sortSgroupXBonds()
Deprecated.As of Marvin 5.12, no replacement.
Crossing bonds of aSuperatomSgroup
do not need to be sorted any more. It is not advised to sort them anyway because then the indexes of bonds change in the parent molecule.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 classMoleculeGraph
- 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 atomsg
- the S-groupset
- set (true) or unset (false)- Throws:
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:
IllegalArgumentException
- molecule does not contain the atom- Since:
- Marvin 3.0
-
mergeAtoms
@Deprecated public void mergeAtoms(MolAtom that, MolAtom node)
Deprecated.As of Marvin 6.2, useMergeUtil.mergeAtoms(MolAtom, MolAtom, boolean)
instead.Merges bonds of an atom with another atom, then adds the atom to the molecule.- Overrides:
mergeAtoms
in classMoleculeGraph
- Parameters:
that
- the atomnode
- the other atom
-
addAtom0
protected void addAtom0(MolAtom node)
Adds an atom.- Overrides:
addAtom0
in classMoleculeGraph
- 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 classMoleculeGraph
- Parameters:
atom
- the atom reference
-
addBond0
protected void addBond0(MolBond bond)
Adds a bond.- Overrides:
addBond0
in classMoleculeGraph
- Parameters:
bond
- the bond reference
-
fuse0
protected void fuse0(MoleculeGraph graph, boolean check)
Adds those atoms and bonds of a molecule graph to this one that are not already elements.- Overrides:
fuse0
in classMoleculeGraph
- Parameters:
graph
- the molecule graphcheck
-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 moleclue graph is known to be disjoint from this one and this check can be safely skipped- Since:
- Marvin 5.0
-
contractSgroups
public final boolean contractSgroups()
Contracts all S-groups.- Returns:
- true if the operation was successful, false if nothing changed
- Since:
- Marvin 3.0
-
contractSgroups
public final boolean contractSgroups(int opts)
Contracts all S-groups.- Parameters:
opts
- contraction options- Returns:
- true if the operation was successful, false if nothing changed
- Since:
- Marvin 3.4
- See Also:
Expandable.contract(int)
,Expandable.DEFAULT_OPTIONS
,Expandable.LEAVE_COORDS_UNCHANGED
,Expandable.NONRECURSIVE_EXPAND
-
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.LEAVE_COORDS_UNCHANGED
-
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.LEAVE_COORDS_UNCHANGED
-
setGUIContracted
@Deprecated public final void setGUIContracted(boolean contract)
Deprecated.as of Marvin 6.2, useexpandSgroups(int)
orcontractSgroups(int)
instead with option parameterExpandable.LEAVE_COORDS_UNCHANGED
S-group expansion or contraction is performed depending on the parametercontract
.
Ifcontract
is set to:false
, then expansion happens to the contracted groups with no coordinate generation.true
, then contraction is performed for those s-groups that were expanded the way that was explained in the previous point.
- Parameters:
contract
- true for contraction, false for expansion- Since:
- Marvin 3.4, 05/04/2004
-
setGUIContracted
@Deprecated public final void setGUIContracted(boolean contract, int opts)
Deprecated.as of Marvin 6.2, useexpandSgroups(int)
orcontractSgroups(int)
instead with option parameterExpandable.LEAVE_COORDS_UNCHANGED
S-group expansion or contraction is performed depending on the parametercontract
.
Ifcontract
is set to:false
, then expansion happens to the contracted groups with no coordinate generation.true
, then contraction is performed for those s-groups that were expanded the way that was explained in the previous point.
- Parameters:
contract
- true for contraction, false for expansionopts
- for further expand options- Since:
- Marvin 3.4, 05/04/2004
-
isGUIContracted
@Deprecated public final boolean isGUIContracted()
Deprecated.as of Marvin 6.2 replaced byhasContractedSgroup()
Tests if the molecule has contracted S-groups or not.- Returns:
- true there is at least one contracted S-group, false otherwise
- Since:
- Marvin 3.4.1, 07/26/2004
-
hasContractedSgroup
public boolean hasContractedSgroup()
Tests if the molecule has contracted S-groups or not.- Returns:
- true there is at least one contracted S-group, false otherwise
- Since:
- Marvin 6.2, 2013/09/25
-
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-groupopts
- 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
@Deprecated public final boolean ungroupSgroup(int i)
Deprecated.as of Marvin 6.3. useungroupSgroup(Sgroup)
instead.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
@Deprecated public final boolean ungroupSgroups(int type)
Deprecated.as of Marvin 6.3. useungroupSgroups(EnumSet)
instead.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)
-
ungroupSgroups
public final boolean ungroupSgroups(EnumSet<SgroupType> types)
Ungroups all S-groups of the specified types in this molecule. Performs expand before ungroup if a type is an expandable S-group type. NOTE that givingSgroupType.SUPERATOM
as parameter will leave theSgroupType.AMINOACID
typed S-groups in unchanged state while the former method (ungroupSgroups(int)
) ungrouped theAminoAcidSgroups
as well.- Parameters:
types
- the S-group types that specifies which S-group types to ungroup.- Returns:
- true if the operation was successful, false if nothing changed.
- Since:
- Marvin 6.3
- See Also:
SgroupType
-
ungroupSgroup
@Deprecated public final boolean ungroupSgroup(int i, int opts)
Deprecated.as of Marvin 6.3. useungroupSgroup(Sgroup)
instead.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 indexopts
- 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()
Expands and ungroups 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 removermflags
- 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
-
rearrangeSgroups
public void rearrangeSgroups(int[] newIndexes)
Orders S-groups in the vector of S-groups in the given order corresponding to the given new indexes.- Parameters:
newIndexes
- array of new S-group indexes, ith element of the array contains the new index of the ith s-group in the s-group vector- Throws:
IllegalArgumentException
- if newIndexes are not in the range [0..getSgroupCount()] or not all values in this range are contained.- Since:
- Marvin 5.12, 2012.11.12.
-
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
-
removeAtomFromChildren
protected void removeAtomFromChildren(Sgroup sgroup, MolAtom atom)
Removes the parameter atom from the parameter S-group and it's descendants.
-
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 classMoleculeGraph
- 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 <C extends MoleculeGraph> C[] findFrags(Class<C> cl, int fragmentationType)
Determines the disconnected fragments and puts them into an array. Atoms are removed from the original molecule object unless the fragment class is SelectionMolecule.class. The original atom order is preserved in the returned fragments. Fragment order is also determined by the original atom order. The first fragment is the one containing atom 0, the second fragment is the one containing the smallest indexed atom not in the first fragment, etc. If not using the FRAG_KEEPING_SGROUPS option and an S-group would contain more fragments, then it won't be added to any of them, and its parent-child relations with other S-groups will be removed. Fragmentation is performed depending on fragmentation type:- Merge only fragmented multicenter S-groups (see
MoleculeGraph.FRAG_KEEPING_MULTICENTERS
) - Merge all types of S-groups (see
MoleculeGraph.FRAG_KEEPING_SGROUPS
) - Keep all fragments separately, do not take into account the S-groups (see
MoleculeGraph.FRAG_BASIC
)
- Overrides:
findFrags
in classMoleculeGraph
- Type Parameters:
C
- the class of the fragments- Parameters:
cl
- create fragment objects of this classfragmentationType
- determines the type of fragmentation- Returns:
- array of fragments
- Since:
- Marvin 5.6
- See Also:
MoleculeGraph.FRAG_BASIC
,MoleculeGraph.FRAG_KEEPING_MULTICENTERS
,MoleculeGraph.FRAG_KEEPING_SGROUPS
- Merge only fragmented multicenter S-groups (see
-
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
@Deprecated public void checkConsistency()
Deprecated.As of Marvin 5.7, no replacement.
Not intended for public use, it was intended only for internal debugging.Checks the internal consistency of the structure. Use this method for debugging.- Overrides:
checkConsistency
in classMoleculeGraph
- Throws:
RuntimeException
- if inconsistency found- Since:
- Marvin 5.0, 11/06/2007
-
checkSgroupConsistency
protected void checkSgroupConsistency()
Checks the internal consisitency of S-groups.- Throws:
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 classMoleculeGraph
- 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 classMoleculeGraph
- Parameters:
t
- the transformation matrixincg
- graph invariants are changed (true) or not (false)- Since:
- Marvin 4.0 2/09/2005
-
findContainingMulticenterSgroup
public 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 classMoleculeGraph
-
clearObjects
public void clearObjects()
- Specified by:
clearObjects
in interfacechemaxon.struc.MObjectContainer
-
getObjectCount
public int getObjectCount()
- Specified by:
getObjectCount
in interfacechemaxon.struc.MObjectContainer
-
removeObject
public void removeObject(MObject mo)
- Specified by:
removeObject
in interfacechemaxon.struc.MObjectContainer
-
selectAllObjects
public void selectAllObjects(boolean s)
- Specified by:
selectAllObjects
in interfacechemaxon.struc.MObjectContainer
-
getAllObjects
public List<MObject> getAllObjects()
- Specified by:
getAllObjects
in interfacechemaxon.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 replacenewSgroup
- the sgroup to replace with
-
implicitizeHydrogens0
@Deprecated protected boolean implicitizeHydrogens0(int f, MolAtom[] atoms, boolean check)
Deprecated.As of Marvin 5.7, replaced byHydrogenize.convertExplicitHToImplicit(MoleculeGraph, MolAtom[], int, boolean)
.
Usage:Hydrogenize.convertExplicitHToImplicit(mol, atoms, f, check);
- Overrides:
implicitizeHydrogens0
in classMoleculeGraph
- Returns:
- true if success else false
-
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).- Overrides:
add
in classMoleculeGraph
- Parameters:
bond
- the bond object
-
replaceAtom
public void replaceAtom(int i, MolAtom newAtom)
Replaces the atom on the given index with the parameter atom and removes the parameter atom from its original parent molecule if needed. Sets the sgroup hierarchy.- Overrides:
replaceAtom
in classMoleculeGraph
- Parameters:
i
- the index of the original atomnewAtom
- the atom which will replace the original
-
getBonds
protected MolBond[] getBonds(MolAtom atom)
Returns the bonds attached to the given atom.- Overrides:
getBonds
in classMoleculeGraph
- Parameters:
atom
- the atom- Returns:
- the bonds attached to the given atom in this molecule
- Since:
- Marvin 6.2
-
getSgroupIterator
public IteratorFactory.SgroupIterator getSgroupIterator()
Returns an iterator over the s-groups in this molecule in proper sequence.- Returns:
- an iterator over the s-groups in this molecule in proper sequence
- Since:
- Marvin 6.2, 2013.09.09.
-
connectOriginalBondsToNewAtom
protected void connectOriginalBondsToNewAtom(MolAtom newAtom, MolAtom orig, MolBond[] bonds)
Description copied from class:MoleculeGraph
Sets the original connections to the new atom.- Overrides:
connectOriginalBondsToNewAtom
in classMoleculeGraph
- Parameters:
newAtom
- the atom which replace the originalorig
- the original atombonds
- the original atoms bonds (before any modification)
-
hasAtomSet
public boolean hasAtomSet()
Description copied from class:MoleculeGraph
Tests whether the molecule graph has atom sets.- Overrides:
hasAtomSet
in classMoleculeGraph
- Returns:
true
if there are atom sets,false
otherwise
-
-