Package org.openscience.cdk.tools
Class AtomTypeAwareSaturationChecker
- java.lang.Object
-
- org.openscience.cdk.tools.AtomTypeAwareSaturationChecker
-
- All Implemented Interfaces:
IDeduceBondOrderTool
,IValencyChecker
public class AtomTypeAwareSaturationChecker extends Object implements IValencyChecker, IDeduceBondOrderTool
This class tries to figure out the bond order of the bonds that has the flagSINGLE_OR_DOUBLE
raised (i.e. set totrue
).
The code is written with the assumption that the properties of the atoms in the molecule has configured with the help ofAtomContainerManipulator
. This class uses theSaturationChecker
internally.
If it can't find a solution where all atoms in the molecule are saturated, it gives a "best guess", i.e. the solution with most saturated atoms. If not all atoms are saturated then it will be noticed as a warning in the log.- Author:
- Klas Jönsson, Egon Willighagen
- Source code:
- main
- Belongs to CDK module:
- valencycheck
- Keywords:
- bond order
- Created on:
- 2012-04-13
-
-
Constructor Summary
Constructors Constructor Description AtomTypeAwareSaturationChecker()
Constructs anAtomTypeAwareSaturationChecker
checker.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
bondOrderCanBeIncreased(IBond bond, IAtomContainer atomContainer)
Check if the bond order can be increased.void
decideBondOrder(IAtomContainer atomContainer)
This method decides the bond order on bonds that has theSINGLE_OR_DOUBLE
-flag raised.void
decideBondOrder(IAtomContainer atomContainer, boolean atomsSaturated)
This method decides the bond order on bonds that has theSINGLE_OR_DOUBLE
-flag raised.double
getMaxNoOfBonds(IAtom atom)
This method calculates the number of bonds that anIAtom
can have.boolean
isSaturated(IAtomContainer container)
boolean
isSaturated(IAtom atom, IAtomContainer container)
void
saturate(IAtomContainer container)
-
-
-
Constructor Detail
-
AtomTypeAwareSaturationChecker
public AtomTypeAwareSaturationChecker()
Constructs anAtomTypeAwareSaturationChecker
checker.
-
-
Method Detail
-
decideBondOrder
public void decideBondOrder(IAtomContainer atomContainer, boolean atomsSaturated) throws CDKException
This method decides the bond order on bonds that has theSINGLE_OR_DOUBLE
-flag raised.- Parameters:
atomContainer
- The molecule to investigateatomsSaturated
- Set to true if you want to make sure that all atoms are saturated.- Throws:
CDKException
-
decideBondOrder
public void decideBondOrder(IAtomContainer atomContainer) throws CDKException
This method decides the bond order on bonds that has theSINGLE_OR_DOUBLE
-flag raised.- Parameters:
atomContainer
- The molecule to investigate.- Throws:
CDKException
-
bondOrderCanBeIncreased
public boolean bondOrderCanBeIncreased(IBond bond, IAtomContainer atomContainer) throws CDKException
Check if the bond order can be increased. This method assumes that the bond is between only two atoms.- Parameters:
bond
- The bond to checkatomContainer
- TheIAtomContainer
that the bond belongs to- Returns:
- True if it is possibly to increase the bond order
- Throws:
CDKException
-
getMaxNoOfBonds
public double getMaxNoOfBonds(IAtom atom) throws CDKException
This method calculates the number of bonds that anIAtom
can have.- Parameters:
atom
- TheIAtom
to be investigated- Returns:
- The max number of bonds the
IAtom
can have - Throws:
CDKException
- when the atom's valency is not set
-
saturate
public void saturate(IAtomContainer container) throws CDKException
- Specified by:
saturate
in interfaceIDeduceBondOrderTool
- Throws:
CDKException
-
isSaturated
public boolean isSaturated(IAtomContainer container) throws CDKException
- Specified by:
isSaturated
in interfaceIValencyChecker
- Throws:
CDKException
-
isSaturated
public boolean isSaturated(IAtom atom, IAtomContainer container) throws CDKException
- Specified by:
isSaturated
in interfaceIValencyChecker
- Throws:
CDKException
-
-