$darkmode
DENOPTIM
denoptim.molecularmodeling.ThreeDimTreeBuilder Class Reference

Tool to build build three-dimensional (3D) tree-like molecular structures from DGraph. More...

Collaboration diagram for denoptim.molecularmodeling.ThreeDimTreeBuilder:
[legend]

Public Member Functions

 ThreeDimTreeBuilder (Logger logger, Randomizer randomizer)
 Constructor providing the program-specific logger and randomizer. More...
 
void setAlignBBsIn3D (boolean align)
 Sets the flag that controls whether building blocks have to be aligned according to the AP vectors or not. More...
 
IAtomContainer convertGraphTo3DAtomContainer (DGraph graph) throws DENOPTIMException
 Created a three-dimensional molecular representation from a given DGraph. More...
 
IAtomContainer convertGraphTo3DAtomContainer (DGraph graph, boolean removeUsedRCAs) throws DENOPTIMException
 Creates a three-dimensional molecular representation from a given DGraph. More...
 
IAtomContainer convertGraphTo3DAtomContainer (DGraph graph, boolean removeUsedRCAs, boolean setCDKRequirements, boolean rebuild) throws DENOPTIMException
 Created a three-dimensional molecular representation from a given DGraph. More...
 

Private Member Functions

void append3DFragmentsViaEdges (IAtomContainer mol, DGraph graph, int idSrcAtmA, Point3d srcApA, Point3d trgApA, Edge edge, boolean removeUsedRCAs, boolean rebuild, Map< Long, ArrayList< AttachmentPoint > > apsPerVertexId, Map< Edge, ArrayList< AttachmentPoint > > apsPerEdge, Map< IAtom, ArrayList< AttachmentPoint > > apsPerAtom, Map< IBond, ArrayList< AttachmentPoint > > apsPerBond) throws DENOPTIMException
 Recursive method that appends branches of building blocks following the edges of the graph. More...
 
Point3d getRandomPoint (IAtomContainer mol)
 

Private Attributes

double maxCoord = 20.0
 Controls the maximum distance between a random place where unanchored building blocks are placed and the system centroid. More...
 
boolean alignIn3D = true
 Flag controlling whether to align building blocks according to the AP vectors or not. More...
 
IChemObjectBuilder builder = SilentChemObjectBuilder.getInstance()
 Private builder of atom containers. More...
 
Logger logger = Logger.getLogger("3dTreeBuilderLogger")
 Program-specific logger. More...
 
Randomizer randomizer = new Randomizer()
 Program-specific randomizer. More...
 

Static Private Attributes

static final String NL = DENOPTIMConstants.EOL
 

Detailed Description

Tool to build build three-dimensional (3D) tree-like molecular structures from DGraph.

The molecular structure is assembled from the building blocks by attaching any set of atoms/pseudo-atoms contained in the building block, and (optionally) aligning each incoming building block by using the geometric parameters defined in their attachment points. By default, this builder does align building blocks, but method ThreeDimTreeBuilder#setAlignBBsIn3D(boolean) allows to configure this builder so that building blocks are not aligned during their assembly. In the latter configuration, the coordinates of atom in the resulting molecular structure will be the same as those found in the building block stored in the given library of building blocks.

Author
Marco Foscato

Definition at line 75 of file ThreeDimTreeBuilder.java.

Constructor & Destructor Documentation

◆ ThreeDimTreeBuilder()

denoptim.molecularmodeling.ThreeDimTreeBuilder.ThreeDimTreeBuilder ( Logger  logger,
Randomizer  randomizer 
)

Constructor providing the program-specific logger and randomizer.

Parameters

Definition at line 112 of file ThreeDimTreeBuilder.java.

References denoptim.molecularmodeling.ThreeDimTreeBuilder.logger, and denoptim.molecularmodeling.ThreeDimTreeBuilder.randomizer.

Member Function Documentation

◆ append3DFragmentsViaEdges()

void denoptim.molecularmodeling.ThreeDimTreeBuilder.append3DFragmentsViaEdges ( IAtomContainer  mol,
DGraph  graph,
int  idSrcAtmA,
Point3d  srcApA,
Point3d  trgApA,
Edge  edge,
boolean  removeUsedRCAs,
boolean  rebuild,
Map< Long, ArrayList< AttachmentPoint > >  apsPerVertexId,
Map< Edge, ArrayList< AttachmentPoint > >  apsPerEdge,
Map< IAtom, ArrayList< AttachmentPoint > >  apsPerAtom,
Map< IBond, ArrayList< AttachmentPoint > >  apsPerBond 
) throws DENOPTIMException
private

Recursive method that appends branches of building blocks following the edges of the graph.

The connection is controlled by the geometries of the attachment point on a growing molecule and that of the attachment point of the incoming vertex, i.e., the child/target vertex connected via the edge argument. If the latter contains no atoms, then we simply return. Thus, vertexes that contain no atoms are not expected to have more than one incident edge (i.e., the edge to their parent vertex).

Parameters
molthe container of atoms that is being built.
idSrcAtmAthe index of the atom holding the AP on the growing molecules, or a negative number if no such bond exists and, thus, we do not add any chemical bond between atoms of the growing molecule and the incoming building block.
srcApAthe point in space corresponding to the source of the attachment point vector on the growing molecule
trgApAthe point in space corresponding to the end of the attachment point vector on the growing molecule
edgethe DENOPTIMEdge corresponding to the connection this method is asked to make between 3D molecular fragments
removeUsedRCAswhen true this method will remove used RCAs (the content of ring-closing vertexes, RCVs) and add bonds to close the rings defined by the DENOPTIMRings in the graph (does not alter the graph). Does not change unused RCVs. Unused RCVs should have been already replaced by capping groups (or removed, if no capping needed), with the GraphConversionTool#replaceUnusedRCVsWithCapps(DGraph) method.
Exceptions
DENOPTIMException

Definition at line 512 of file ThreeDimTreeBuilder.java.

References denoptim.molecularmodeling.ThreeDimTreeBuilder.alignIn3D, denoptim.molecularmodeling.ThreeDimTreeBuilder.append3DFragmentsViaEdges(), denoptim.constants.DENOPTIMConstants.ATMPROPVERTEXID, denoptim.constants.DENOPTIMConstants.ATMPROPVERTEXPATH, denoptim.graph.Vertex.containsAtoms(), denoptim.graph.AttachmentPoint.getAtomPositionNumber(), denoptim.graph.Vertex.getAttachmentPoints(), denoptim.graph.Vertex.getBuildingBlockId(), denoptim.graph.Vertex.getBuildingBlockType(), denoptim.graph.Edge.BondType.getCDKOrder(), denoptim.graph.AttachmentPoint.getDirectionVector(), denoptim.graph.Vertex.getIAtomContainer(), denoptim.utils.MathUtils.getNormalDirection(), denoptim.utils.MoleculeUtils.getPoint3d(), denoptim.molecularmodeling.ThreeDimTreeBuilder.getRandomPoint(), denoptim.graph.Vertex.getVertexId(), denoptim.graph.Edge.BondType.hasCDKAnalogue(), denoptim.graph.Vertex.isRCV, denoptim.molecularmodeling.ThreeDimTreeBuilder.logger, denoptim.molecularmodeling.ThreeDimTreeBuilder.NL, denoptim.molecularmodeling.ThreeDimTreeBuilder.randomizer, denoptim.constants.DENOPTIMConstants.RCAPROPAPCTORCA, denoptim.constants.DENOPTIMConstants.RCAPROPCHORDBNDTYP, and denoptim.constants.DENOPTIMConstants.RCAPROPRINGUSER.

Referenced by denoptim.molecularmodeling.ThreeDimTreeBuilder.append3DFragmentsViaEdges(), and denoptim.molecularmodeling.ThreeDimTreeBuilder.convertGraphTo3DAtomContainer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ convertGraphTo3DAtomContainer() [1/3]

IAtomContainer denoptim.molecularmodeling.ThreeDimTreeBuilder.convertGraphTo3DAtomContainer ( DGraph  graph) throws DENOPTIMException

Created a three-dimensional molecular representation from a given DGraph.

The conversion creates also two maps to retrace the attachment points within the final 3D structure both based on the ID of the source DENOPTIMVertex and correspondence to DENOPTIMEdge. To retrieve this information see properties DENOPTIMConstants#MOLPROPAPxATOM, DENOPTIMConstants#MOLPROPAPxBOND, DENOPTIMConstants#MOLPROPAPxVID and DENOPTIMConstants#MOLPROPAPxEDGE. In addition each atom is blended with the unique index of the DENOPTIMVertex corresponding to the molecular fragment to which the atom belongs.

This method does not remove ring-closing attractors. You can remove them by calling ThreeDimTreeBuilder#convertGraphTo3DAtomContainer( DGraph, boolean) (with a true 2nd argument) instead of this method.

Parameters
graphthe DGraph to be transformed into a 3D molecule
Returns
the IAtomContainer representation of the molecular system represented by the DGraph.
Exceptions
DENOPTIMException

Definition at line 158 of file ThreeDimTreeBuilder.java.

References denoptim.molecularmodeling.ThreeDimTreeBuilder.convertGraphTo3DAtomContainer().

Referenced by denoptim.ga.GraphOperations.addRing(), denoptim.molecularmodeling.MultiMolecularModelBuilder.build3DTree(), denoptim.combinatorial.GraphBuildingTask.call(), denoptim.ga.OffspringEvaluationTask.call(), denoptim.programs.fitnessevaluator.FitnessEvaluationTask.call(), denoptim.graph.DGraph.checkConsistency(), denoptim.molecularmodeling.ThreeDimTreeBuilder.convertGraphTo3DAtomContainer(), denoptim.graph.Template.getIAtomContainer(), denoptim.gui.GUIGraphHandler.importGraphsFromFile(), denoptim.graph.DGraph.makeAllGraphsWithDifferentRingSets(), denoptim.graph.rings.PathSubGraph.makeMolecularRepresentation(), denoptim.task.FitnessTask.runFitnessProvider(), denoptim.programs.genetweeker.GeneOpsRunner.runMutation(), denoptim.programs.genetweeker.GeneOpsRunner.runXOver(), denoptim.ga.EAUtils.setupRings(), denoptim.molecularmodeling.ThreeDimTreeBuilderTest.testConversionTo3dTree(), denoptim.graph.rings.PathClosabilityToolsTest.testEvaluateConstitutionalClosability(), denoptim.graph.rings.RandomCombOfRingIteratorTest.testEvaluateConstitutionalClosability(), denoptim.graph.rings.RingSizeManagerTest.testEvaluateRCVPair(), denoptim.graph.rings.PathSubGraphTest.testMakePathSubGraph(), denoptim.fragspace.FragmentSpaceTest.testUseWholeMolGeometryForExtractedTemplates(), denoptim.gui.GraphVertexMolViewerPanel.updateMolevularViewer(), and denoptim.io.DenoptimIO.writeGraphsToSDF().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ convertGraphTo3DAtomContainer() [2/3]

IAtomContainer denoptim.molecularmodeling.ThreeDimTreeBuilder.convertGraphTo3DAtomContainer ( DGraph  graph,
boolean  removeUsedRCAs 
) throws DENOPTIMException

Creates a three-dimensional molecular representation from a given DGraph.

The conversion creates also two maps to retrace the attachment points within the final 3D structure both based on the ID of the source DENOPTIMVertex and correspondence to DENOPTIMEdge. To retrieve this information see properties DENOPTIMConstants#MOLPROPAPxATOM, DENOPTIMConstants#MOLPROPAPxBOND, DENOPTIMConstants#MOLPROPAPxVID and DENOPTIMConstants#MOLPROPAPxEDGE.
In addition each atom is blended with the unique index of the DENOPTIMVertex corresponding to the molecular fragment to which the atom belongs.

Parameters
graphthe DGraph to be transformed into a 3D molecule
removeUsedRCAswhen true this method will remove used RCAs (the content of ring-closing vertexes, RCVs) and add bonds to close the rings defined by the DENOPTIMRings in the graph (does not alter the graph). Does not change unused RCVs. Unused RCVs should have been already replaced by capping groups (or removed, if no capping needed), with the GraphConversionTool#replaceUnusedRCVsWithCapps(DGraph) method.
Returns
the AtomContainer representation
Exceptions
DENOPTIMException

Definition at line 194 of file ThreeDimTreeBuilder.java.

References denoptim.molecularmodeling.ThreeDimTreeBuilder.convertGraphTo3DAtomContainer().

Here is the call graph for this function:

◆ convertGraphTo3DAtomContainer() [3/3]

IAtomContainer denoptim.molecularmodeling.ThreeDimTreeBuilder.convertGraphTo3DAtomContainer ( DGraph  graph,
boolean  removeUsedRCAs,
boolean  setCDKRequirements,
boolean  rebuild 
) throws DENOPTIMException

Created a three-dimensional molecular representation from a given DGraph.

The conversion creates also two maps to retrace the attachment points within the final 3D structure both based on the ID of the source Vertex and correspondence to Edge. To retrieve this information see properties DENOPTIMConstants#MOLPROPAPxATOM, DENOPTIMConstants#MOLPROPAPxBOND, DENOPTIMConstants#MOLPROPAPxVID and DENOPTIMConstants#MOLPROPAPxEDGE. In addition each atom is blended with the unique index of the Vertex corresponding to the molecular fragment to which the atom belongs.

Parameters
graphthe DGraph to be transformed into a 3D molecule
removeUsedRCAswhen true this method will remove used RCAs (the content of ring-closing vertexes, RCVs) and add bonds to close the rings defined by the Ring in the graph (does not alter the graph). Does not change unused RCVs. Unused RCVs should have been already replaced by capping groups (or removed, if no capping needed), with the GraphConversionTool#replaceUnusedRCVsWithCapps(DGraph) method.
setCDKRequirementswhen true this method will ensure that the CDK requirements for IAtomContainers are all met. Namely, no bond order is 'undefined' and that intrinsic hydrogen is zero for all atoms (i.e., internal convention in DENOPTIM: all atoms are explicit).
Returns
rebuild when true the chemical representation of every building block is rebuilt ignoring previously available structures.
the AtomContainer representation
Exceptions
DENOPTIMException

Definition at line 238 of file ThreeDimTreeBuilder.java.

References denoptim.molecularmodeling.ThreeDimTreeBuilder.append3DFragmentsViaEdges(), denoptim.constants.DENOPTIMConstants.APSTAG, denoptim.constants.DENOPTIMConstants.ATMPROPVERTEXID, denoptim.constants.DENOPTIMConstants.ATMPROPVERTEXPATH, denoptim.molecularmodeling.ThreeDimTreeBuilder.builder, denoptim.graph.Vertex.containsAtoms(), denoptim.utils.MoleculeUtils.ensureNoUnsetBondOrdersSilent(), denoptim.graph.AttachmentPoint.getAPDefinitionsForSDF(), denoptim.graph.AttachmentPoint.getAtomPositionNumber(), denoptim.graph.Vertex.getAttachmentPoints(), denoptim.graph.AttachmentPoint.getDirectionVector(), denoptim.graph.Vertex.getIAtomContainer(), denoptim.utils.MoleculeUtils.getPoint3d(), denoptim.molecularmodeling.ThreeDimTreeBuilder.getRandomPoint(), denoptim.graph.Vertex.getVertexId(), denoptim.molecularmodeling.ThreeDimTreeBuilder.logger, denoptim.constants.DENOPTIMConstants.MOLPROPAPxATOM, denoptim.constants.DENOPTIMConstants.MOLPROPAPxBOND, denoptim.constants.DENOPTIMConstants.MOLPROPAPxEDGE, denoptim.constants.DENOPTIMConstants.MOLPROPAPxVID, denoptim.molecularmodeling.ThreeDimTreeBuilder.NL, denoptim.molecularmodeling.ThreeDimTreeBuilder.randomizer, denoptim.utils.MoleculeUtils.removeUsedRCA(), denoptim.utils.MoleculeUtils.setZeroImplicitHydrogensToAllAtoms(), denoptim.io.DenoptimIO.writeGraphToJSON(), denoptim.utils.GraphUtils.writeSDFFields(), and denoptim.io.DenoptimIO.writeSDFFile().

Here is the call graph for this function:

◆ getRandomPoint()

Point3d denoptim.molecularmodeling.ThreeDimTreeBuilder.getRandomPoint ( IAtomContainer  mol)
private

Definition at line 858 of file ThreeDimTreeBuilder.java.

References denoptim.utils.MoleculeUtils.calculateCentroid(), denoptim.molecularmodeling.ThreeDimTreeBuilder.maxCoord, denoptim.utils.Randomizer.nextInt(), and denoptim.molecularmodeling.ThreeDimTreeBuilder.randomizer.

Referenced by denoptim.molecularmodeling.ThreeDimTreeBuilder.append3DFragmentsViaEdges(), and denoptim.molecularmodeling.ThreeDimTreeBuilder.convertGraphTo3DAtomContainer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAlignBBsIn3D()

void denoptim.molecularmodeling.ThreeDimTreeBuilder.setAlignBBsIn3D ( boolean  align)

Sets the flag that controls whether building blocks have to be aligned according to the AP vectors or not.

Parameters
alignthe new value. Use true to align building blocks (default), or false to prevent alignment.

Definition at line 126 of file ThreeDimTreeBuilder.java.

Referenced by denoptim.ga.GraphOperations.addRing(), denoptim.combinatorial.GraphBuildingTask.call(), denoptim.graph.DGraph.checkConsistency(), denoptim.graph.DGraph.makeAllGraphsWithDifferentRingSets(), denoptim.ga.EAUtils.setupRings(), denoptim.graph.rings.PathClosabilityToolsTest.testEvaluateConstitutionalClosability(), denoptim.graph.rings.RandomCombOfRingIteratorTest.testEvaluateConstitutionalClosability(), denoptim.graph.rings.RingSizeManagerTest.testEvaluateRCVPair(), and denoptim.graph.rings.PathSubGraphTest.testMakePathSubGraph().

Here is the caller graph for this function:

Member Data Documentation

◆ alignIn3D

boolean denoptim.molecularmodeling.ThreeDimTreeBuilder.alignIn3D = true
private

Flag controlling whether to align building blocks according to the AP vectors or not.

By default, we do align building blocks.

Definition at line 87 of file ThreeDimTreeBuilder.java.

Referenced by denoptim.molecularmodeling.ThreeDimTreeBuilder.append3DFragmentsViaEdges().

◆ builder

IChemObjectBuilder denoptim.molecularmodeling.ThreeDimTreeBuilder.builder = SilentChemObjectBuilder.getInstance()
private

Private builder of atom containers.

Definition at line 92 of file ThreeDimTreeBuilder.java.

Referenced by denoptim.molecularmodeling.ThreeDimTreeBuilder.convertGraphTo3DAtomContainer().

◆ logger

Logger denoptim.molecularmodeling.ThreeDimTreeBuilder.logger = Logger.getLogger("3dTreeBuilderLogger")
private

◆ maxCoord

double denoptim.molecularmodeling.ThreeDimTreeBuilder.maxCoord = 20.0
private

Controls the maximum distance between a random place where unanchored building blocks are placed and the system centroid.

Definition at line 81 of file ThreeDimTreeBuilder.java.

Referenced by denoptim.molecularmodeling.ThreeDimTreeBuilder.getRandomPoint().

◆ NL

◆ randomizer


The documentation for this class was generated from the following file: