1package denoptim.molecularmodeling;
22import static org.junit.jupiter.api.Assertions.assertEquals;
24import java.util.ArrayList;
25import java.util.Arrays;
26import java.util.HashMap;
27import java.util.HashSet;
28import java.util.logging.Logger;
30import javax.vecmath.Point3d;
32import org.junit.jupiter.api.Test;
33import org.openscience.cdk.Atom;
34import org.openscience.cdk.PseudoAtom;
35import org.openscience.cdk.interfaces.IAtom;
36import org.openscience.cdk.interfaces.IAtomContainer;
37import org.openscience.cdk.silent.Bond;
39import denoptim.fragspace.FragmentSpace;
40import denoptim.fragspace.FragmentSpaceParameters;
41import denoptim.graph.APClass;
42import denoptim.graph.DGraph;
43import denoptim.graph.Edge;
44import denoptim.graph.Edge.BondType;
45import denoptim.graph.EmptyVertex;
46import denoptim.graph.Fragment;
47import denoptim.graph.Vertex;
48import denoptim.graph.Vertex.BBType;
49import denoptim.utils.Randomizer;
71 HashMap<APClass,ArrayList<APClass>> cpMap =
72 new HashMap<APClass,ArrayList<APClass>>();
73 cpMap.put(a0,
new ArrayList<APClass>(Arrays.asList(a0, b0)));
74 HashMap<APClass,APClass> capMap =
new HashMap<APClass,APClass>();
76 HashSet<APClass> forbEnds =
new HashSet<APClass>();
81 IAtom a1 =
new Atom(
"C",
new Point3d(
new double[]{0.0, 0.0, 0.0}));
82 IAtom a2 =
new Atom(
"C",
new Point3d(
new double[]{1.0, 0.0, 0.0}));
86 frg1.
addAP(0, a0,
new Point3d(
new double[]{0.0, 0.0, 1.0}));
87 frg1.
addAP(1, a0,
new Point3d(
new double[]{1.0, 1.0, 1.0}));
91 IAtom a3 =
new Atom(
"C",
new Point3d(
new double[]{0.0, 0.0, 0.0}));
93 frg2.
addAP(0, a0,
new Point3d(
new double[]{0.0, 1.0, 1.0}));
94 frg2.
addAP(0, b0,
new Point3d(
new double[]{0.0, 1.0, -1.0}));
98 IAtom a7 =
new Atom(
"C",
new Point3d(
new double[]{2.0, 0.0, 0.0}));
99 IAtom a8 =
new Atom(
"O",
new Point3d(
new double[]{3.0, 0.0, 0.0}));
102 frg3.
addBond(
new Bond(a7, a8));
103 frg3.
addAP(0, a0,
new Point3d(
new double[]{2.0, 1.0, 1.0}));
104 frg3.
addAP(0, a0,
new Point3d(
new double[]{2.0, 1.0, -1.0}));
105 frg3.
addAP(0, b0,
new Point3d(
new double[]{3.0, 1.0, -1.0}));
109 IAtom a4 =
new PseudoAtom(
"ATP",
new Point3d(
110 new double[]{0.0, 0.0, 0.0}));
112 rca1.
addAP(0, ap0,
new Point3d(
new double[]{0.0, 1.0, 1.0}));
116 IAtom a5 =
new PseudoAtom(
"ATM",
new Point3d(
117 new double[]{1.0, 0.0, 0.0}));
119 rca2.
addAP(0, am0,
new Point3d(
new double[]{0.0, 1.0, 1.0}));
123 IAtom a6 =
new Atom(
"H",
new Point3d(
new double[]{0.0, 0.0, 0.0}));
125 cap.
addAP(0, h0,
new Point3d(
new double[]{0.0, 1.0, 1.0}));
128 ArrayList<Vertex> scaff =
new ArrayList<Vertex>();
130 ArrayList<Vertex> frags =
new ArrayList<Vertex>();
135 ArrayList<Vertex> caps =
new ArrayList<Vertex>();
140 cpMap, capMap, forbEnds, cpMap);
169 Logger logger = Logger.getLogger(
"DummyLogger");
174 assertEquals(4, mol.getBondCount(),
"Number of bonds without the "
176 assertEquals(5, mol.getAtomCount(),
"Number of atoms in cyclic molecule"
177 +
" before forming ring");
184 assertEquals(3, mol.getBondCount(),
"Number of bonds, including the "
186 assertEquals(3, mol.getAtomCount(),
"Number of atoms in cyclic "
187 +
"molecule after removal of RCAs");
216 assertEquals(4, acyclicMol.getBondCount(),
"Number of bonds in acyclic "
217 +
"graph with RCAs");
218 assertEquals(5, acyclicMol.getAtomCount(),
"Number of atoms in acyclic "
219 +
"molecule before forming ring");
249 assertEquals(1, molFromEmptyScaff.getBondCount(),
"Number of bonds in "
250 +
"mol with empty scaffold");
251 assertEquals(3, molFromEmptyScaff.getAtomCount(),
"Number of atoms in "
252 +
"mol with empty scaffold");
302 assertEquals(2, molWithEmptyNodes.getBondCount(),
"Number of bonds in "
303 +
"mol with empty scaffold and other nodes");
304 assertEquals(5, molWithEmptyNodes.getAtomCount(),
"Number of atoms in "
305 +
"mol with empty scaffold and other nodes");
Class defining a space of building blocks.
void setAPclassBasedApproach(boolean useAPC)
Set the fragment space to behave according to APClass-based approach.
Parameters defining the fragment space.
static final APClass RCACLASSPLUS
Conventional class of attachment points on ring-closing vertexes.
static final APClass RCACLASSMINUS
Conventional class of attachment points on ring-closing vertexes.
static APClass make(String ruleAndSubclass)
Creates an APClass if it does not exist already, or returns the reference to the existing instance.
Container for the list of vertices and the edges that connect them.
void addVertex(Vertex vertex)
Appends a vertex to this graph without creating any edge.
void addEdge(Edge edge)
Adds the edge to the list of edges belonging to this graph.
This class represents the edge between two vertices.
An empty vertex has the behaviors of a vertex, but has no molecular structure.
void addAP()
Adds an attachment point with no APClass or other attribute.
Class representing a continuously connected portion of chemical object holding attachment points.
void addAP(int atomPositionNumber)
Adds an attachment point with a dummy APClass.
void projectAPsToProperties()
Finds the DENOPTIMAttachmentPoint objects defined as properties of the atoms in this container,...
A vertex is a data structure that has an identity and holds a list of AttachmentPoints.
AttachmentPoint getAP(int i)
Get attachment point i on this vertex.
static Vertex newVertexFromLibrary(int bbId, Vertex.BBType bbt, FragmentSpace fragSpace)
Builds a new molecular fragment kind of vertex.
Tool to build build three-dimensional (3D) tree-like molecular structures from DGraph.
IAtomContainer convertGraphTo3DAtomContainer(DGraph graph)
Created a three-dimensional molecular representation from a given DGraph.
Unit test for TreeBuilder3D.
void testConversionTo3dTree()
Tool to generate random numbers and random decisions.
Possible chemical bond types an edge can represent.
The type of building block.