@TestClass(value="org.openscience.cdk.tools.StructureResonanceGeneratorTest") public class StructureResonanceGenerator extends Object
This class try to generate resonance structure for a determinate molecule.
Make sure that the molecule has the corresponding lone pair electrons for each atom. You can use the method:
LonePairElectronChecker
It is needed to call the addExplicitHydrogensToSatisfyValency from the class tools.HydrogenAdder.
It is based on rearrangements of electrons and charge
The method is based on call by reactions which occur in a resonance.
StructureResonanceGenerator srG = new StructureReseonanceGenerator(true,true,true,true,false); MoleculeSet setOf = srG.getResonances(new Molecule());
We have the possibility to localize the reactive center. Good method if you want to localize the reaction in a fixed point
atoms[0].setFlag(CDKConstants.REACTIVE_CENTER,true);
Moreover you must put the parameter as true
If the reactive center is not localized then the reaction process will try to find automatically the possible reactive center.
IReactionProcess
Constructor and Description |
---|
StructureResonanceGenerator()
Construct an instance of StructureResonanceGenerator.
|
StructureResonanceGenerator(boolean lookingSymmetry)
Construct an instance of StructureResonanceGenerator.
|
Modifier and Type | Method and Description |
---|---|
IAtomContainer |
getContainer(IMolecule molecule,
IAtom atom)
Get the container which the atom is found on resonance from a IMolecule.
|
IAtomContainer |
getContainer(IMolecule molecule,
IBond bond)
Get the container which the bond is found on resonance from a IMolecule.
|
IAtomContainerSet |
getContainers(IMolecule molecule)
Get the container which is found resonance from a IMolecule.
|
int |
getMaximalStructures()
Get the number maximal of resonance structures to be found.
|
List<IReactionProcess> |
getReactions()
Get the reactions that must be presents in the generation of the resonance.
|
IMoleculeSet |
getStructures(IMolecule molecule)
Get the resonance structures from an IMolecule.
|
void |
setDefaultReactions()
Set the default reactions that must be presents to generate the resonance.
|
void |
setMaximalStructures(int maxStruct)
Set the number maximal of resonance structures to be found.
|
void |
setReactions(List<IReactionProcess> newReactionsList)
Set the reactions that must be used in the generation of the resonance.
|
public StructureResonanceGenerator()
setDefaultReactions()
public StructureResonanceGenerator(boolean lookingSymmetry)
lookingSymmetry
- Specify if the resonance generation is based looking at the symmetrysetDefaultReactions()
@TestMethod(value="testSetReactions_List") public void setReactions(List<IReactionProcess> newReactionsList)
newReactionsList
- The IReactionsProcess's to usegetReactions()
,
setReactions(java.util.List)
,
IReactionProcess
@TestMethod(value="testGetReactions") public List<IReactionProcess> getReactions()
setDefaultReactions()
@TestMethod(value="testSetMaximalStructures_int") public void setMaximalStructures(int maxStruct)
maxStruct
- The maximal number@TestMethod(value="testGetMaximalStructures") public int getMaximalStructures()
@TestMethod(value="testSetDefaultReactions") public void setDefaultReactions()
getReactions()
@TestMethod(value="testGetStructures_IMolecule") public IMoleculeSet getStructures(IMolecule molecule)
Get the resonance structures from an IMolecule.
molecule
- The IMolecule to analyze@TestMethod(value="testGetContainers_IMolecule") public IAtomContainerSet getContainers(IMolecule molecule)
Get the container which is found resonance from a IMolecule. It is based on looking if the order of the bond changes.
molecule
- The IMolecule to analyze@TestMethod(value="testGetContainer_IMolecule_IAtom") public IAtomContainer getContainer(IMolecule molecule, IAtom atom)
Get the container which the atom is found on resonance from a IMolecule. It is based on looking if the order of the bond changes. Return null is any is found.
molecule
- The IMolecule to analyzeatom
- The IAtom@TestMethod(value="testGetContainer_IMolecule_IBond") public IAtomContainer getContainer(IMolecule molecule, IBond bond)
Get the container which the bond is found on resonance from a IMolecule. It is based on looking if the order of the bond changes. Return null is any is found.
molecule
- The IMolecule to analyzebond
- The IBond