public class StructureDiagramGenerator extends Object
StructureDiagramGenerator sdg = new StructureDiagramGenerator(); sdg.setMolecule(someMolecule); sdg.generateCoordinates(); IAtomContainer layedOutMol = sdg.getMolecule();
The method will fail if the molecule is disconnected. The partitionIntoMolecules(AtomContainer) can help here.
ConnectivityChecker.partitionIntoMolecules(IAtomContainer)| Modifier and Type | Field and Description |
|---|---|
static double |
DEFAULT_BOND_LENGTH |
static javax.vecmath.Vector2d |
DEFAULT_BOND_VECTOR |
static double |
RAD_30 |
| Constructor and Description |
|---|
StructureDiagramGenerator()
The empty constructor.
|
StructureDiagramGenerator(IAtomContainer molecule)
Creates an instance of this class while assigning a molecule to be layed
out.
|
| Modifier and Type | Method and Description |
|---|---|
void |
generateCoordinates()
The main method of this StructurDiagramGenerator.
|
void |
generateCoordinates(IAtomContainer mol)
Convenience method for generating 2D coordinates.
|
void |
generateCoordinates(IReaction reaction)
Convenience method to generate 2D coordinates for a reaction.
|
void |
generateCoordinates(javax.vecmath.Vector2d firstBondVector)
The main method of this StructurDiagramGenerator.
|
void |
generateExperimentalCoordinates()
Deprecated.
|
void |
generateExperimentalCoordinates(javax.vecmath.Vector2d firstBondVector)
Deprecated.
|
double |
getBondLength()
Returns the bond length used for laying out the molecule.
|
IAtomContainer |
getMolecule()
Returns the molecule, usually used after a call of generateCoordinates()
|
IAtom |
getOtherBondAtom(IAtom atom,
IBond bond)
Returns the other atom of the bond.
|
TemplateHandler |
getTemplateHandler()
Deprecated.
always null, substructure templates are not used anymore
|
boolean |
getUseTemplates()
Deprecated.
always false, substructure templates are not used anymore
|
void |
setAlignMappedReaction(boolean align)
Set whether reaction reactants should be allignned to their product.
|
void |
setBondLength(double bondLength)
Deprecated.
|
void |
setMolecule(IAtomContainer molecule)
Assings a molecule to be layed out.
|
void |
setMolecule(IAtomContainer mol,
boolean clone) |
void |
setMolecule(IAtomContainer mol,
boolean clone,
Set<IAtom> afix,
Set<IBond> bfix)
Assigns a molecule to be laid out.
|
void |
setTemplateHandler(TemplateHandler templateHandler)
Deprecated.
substructure templates are no longer used for layout but those provided here
will be converted to identity templates
|
void |
setUseIdentityTemplates(boolean use)
Set whether identity templates are used.
|
void |
setUseTemplates(boolean useTemplates)
Deprecated.
always false, substructure templates are not used anymore
|
public static final double RAD_30
public static final double DEFAULT_BOND_LENGTH
public static javax.vecmath.Vector2d DEFAULT_BOND_VECTOR
public StructureDiagramGenerator()
public StructureDiagramGenerator(IAtomContainer molecule)
molecule - The molecule to be layed out.public final void generateCoordinates(IAtomContainer mol) throws CDKException
Convenience method for generating 2D coordinates.
The method is short-hand for calling:
sdg.setMolecule(mol, false); sdg.generateCoordinates();
mol - molecule to layoutCDKException - problem with layoutpublic final void generateCoordinates(IReaction reaction) throws CDKException
Convenience method to generate 2D coordinates for a reaction. If atom-atom maps are present on a reaction, the substructures are automatically aligned.
This feature can be disabled by changing the setAlignMappedReaction(boolean)
reaction - reaction to layoutCDKException - problem with layoutpublic void setMolecule(IAtomContainer mol, boolean clone)
public void setMolecule(IAtomContainer mol, boolean clone, Set<IAtom> afix, Set<IBond> bfix)
mol - the molecule for which coordinates are to be generated.clone - Should the whole process be performed with a cloned copy?afix - Atoms that should be fixed in place, coordinates are not changed.bfix - Bonds that should be fixed in place, they will not be flipped, bent, or streched.@Deprecated public void setUseTemplates(boolean useTemplates)
useTemplates - set true to use templates, false otherwisepublic void setUseIdentityTemplates(boolean use)
use - whether to use identity templates@Deprecated public boolean getUseTemplates()
@Deprecated public void setTemplateHandler(TemplateHandler templateHandler)
templateHandler - The new templateHandler value@Deprecated public TemplateHandler getTemplateHandler()
public void setMolecule(IAtomContainer molecule)
molecule - the molecule for which coordinates are to be generated.public void setAlignMappedReaction(boolean align)
align - align settingpublic IAtomContainer getMolecule()
@Deprecated public void generateExperimentalCoordinates() throws CDKException
generateCoordinates()CDKException - if an error occursgenerateCoordinates(org.openscience.cdk.interfaces.IAtomContainer)@Deprecated public void generateExperimentalCoordinates(javax.vecmath.Vector2d firstBondVector) throws CDKException
generateCoordinates()firstBondVector - the vector of the first bond to lay outCDKException - if an error occurspublic void generateCoordinates(javax.vecmath.Vector2d firstBondVector)
throws CDKException
firstBondVector - The vector of the first bond to lay outCDKException - if an error occurspublic void generateCoordinates()
throws CDKException
CDKException - if an error occurs@Deprecated public void setBondLength(double bondLength)
GeometryUtil.scaleMolecule(IAtomContainer, double)GeometryUtil.scaleMolecule(IAtomContainer, double).
IAtomContainer mol = ...; sdg.generateCoordinates(mol); int targetBondLength = 28; double factor = targetBondLength/GeometryUtil.getMedianBondLength(mol); GeometryUtil.scaleMolecule(mol, factor);
bondLength - The new bondLength valueUnsupportedOperationException - not supportedpublic double getBondLength()
public IAtom getOtherBondAtom(IAtom atom, IBond bond)
atom - the atom we already havebond - the bondCopyright © 2017. All rights reserved.