19package denoptim.graph.rings;
21import static org.junit.jupiter.api.Assertions.assertEquals;
23import java.util.logging.Logger;
25import javax.vecmath.Point3d;
27import org.junit.jupiter.api.Test;
28import org.openscience.cdk.Atom;
29import org.openscience.cdk.Bond;
30import org.openscience.cdk.PseudoAtom;
31import org.openscience.cdk.interfaces.IAtom;
32import org.openscience.cdk.interfaces.IAtomContainer;
33import org.openscience.cdk.interfaces.IBond;
34import org.openscience.cdk.interfaces.IChemObjectBuilder;
35import org.openscience.cdk.silent.SilentChemObjectBuilder;
37import denoptim.exception.DENOPTIMException;
38import denoptim.graph.APClass;
39import denoptim.graph.DGraph;
40import denoptim.graph.Edge;
41import denoptim.graph.Edge.BondType;
42import denoptim.graph.Fragment;
43import denoptim.graph.Vertex.BBType;
44import denoptim.molecularmodeling.ThreeDimTreeBuilder;
45import denoptim.utils.Randomizer;
75 IChemObjectBuilder builder = SilentChemObjectBuilder.getInstance();
77 IAtomContainer iacA = builder.newAtomContainer();
78 IAtom iaA1 =
new Atom(
"O",
new Point3d(0,0,0));
79 IAtom iaA2 =
new Atom(
"O",
new Point3d(1,0,0));
82 iacA.addBond(
new Bond(iaA1, iaA2, IBond.Order.SINGLE));
84 vA.
addAP(0,
new Point3d(0,-1,0),apc);
85 vA.
addAP(1,
new Point3d(2,0,0),apc);
87 IAtomContainer iacB = builder.newAtomContainer();
88 IAtom iaB1 =
new Atom(
"C",
new Point3d(0,0,0));
89 IAtom iaB2 =
new Atom(
"C",
new Point3d(1,0,0));
90 IAtom iaB3 =
new Atom(
"C",
new Point3d(1,-0.33,0));
91 IAtom iaB4 =
new Atom(
"C",
new Point3d(1,-0.66,0));
92 IAtom iaB5 =
new Atom(
"C",
new Point3d(1,-1,0));
93 IAtom iaB6 =
new Atom(
"C",
new Point3d(0,-1,0));
94 IAtom iaB7 =
new Atom(
"C",
new Point3d(0,-0.5,0));
102 iacB.addBond(
new Bond(iaB1, iaB2, IBond.Order.SINGLE));
103 iacB.addBond(
new Bond(iaB2, iaB3, IBond.Order.SINGLE));
104 iacB.addBond(
new Bond(iaB3, iaB4, IBond.Order.SINGLE));
105 iacB.addBond(
new Bond(iaB4, iaB5, IBond.Order.SINGLE));
106 iacB.addBond(
new Bond(iaB5, iaB6, IBond.Order.SINGLE));
107 iacB.addBond(
new Bond(iaB6, iaB7, IBond.Order.SINGLE));
108 iacB.addBond(
new Bond(iaB1, iaB7, IBond.Order.SINGLE));
110 vB.
addAP(0,
new Point3d(-1,0,0),apc);
111 vB.
addAP(5,
new Point3d(-1,-1,0),apc);
112 vB.
addAP(6,
new Point3d(1,1,0),apc);
114 IAtomContainer iacC = builder.newAtomContainer();
115 IAtom iaC1 =
new Atom(
"N",
new Point3d(0,0,0));
116 IAtom iaC2 =
new Atom(
"N",
new Point3d(-1,0,0));
117 IAtom iaC3 =
new Atom(
"N",
new Point3d(0,-1,0));
121 iacC.addBond(
new Bond(iaC1, iaC2, IBond.Order.SINGLE));
122 iacC.addBond(
new Bond(iaC2, iaC3, IBond.Order.SINGLE));
123 iacC.addBond(
new Bond(iaC1, iaC3, IBond.Order.SINGLE));
125 vC.
addAP(0,
new Point3d(1,0,0),apc);
126 vC.
addAP(1,
new Point3d(-1,1,0),apc);
127 vC.
addAP(2,
new Point3d(-1,-1,0),apc);
129 IAtomContainer iacG = builder.newAtomContainer();
130 IAtom iaG1 =
new Atom(
"P",
new Point3d(0,0,0));
131 IAtom iaG2 =
new Atom(
"P",
new Point3d(0,0,1));
132 IAtom iaG3 =
new Atom(
"P",
new Point3d(0,0,2));
136 iacG.addBond(
new Bond(iaG1, iaG2, IBond.Order.SINGLE));
137 iacG.addBond(
new Bond(iaG2, iaG3, IBond.Order.SINGLE));
139 vG.
addAP(0,
new Point3d(1,0,0),apc);
141 IAtomContainer iacD = builder.newAtomContainer();
142 iacD.addAtom(
new PseudoAtom(
"ATN",
new Point3d(0,0,0)));
147 IAtomContainer iacE = builder.newAtomContainer();
148 iacE.addAtom(
new PseudoAtom(
"ATN",
new Point3d(0,0,0)));
186 IChemObjectBuilder builder = SilentChemObjectBuilder.getInstance();
188 IAtomContainer iacA = builder.newAtomContainer();
189 IAtom iaA1 =
new Atom(
"O",
new Point3d(0,0,0));
192 vA.
addAP(0,
new Point3d(0,-1,0),apc);
193 vA.
addAP(0,
new Point3d(1,-1,0),apc);
195 IAtomContainer iacB = builder.newAtomContainer();
196 IAtom iaB1 =
new Atom(
"C",
new Point3d(0,0,0));
199 vB.
addAP(0,
new Point3d(-1,0,0),apc);
200 vB.
addAP(0,
new Point3d(-1,-1,0),apc);
202 IAtomContainer iacC = builder.newAtomContainer();
203 IAtom iaC1 =
new Atom(
"N",
new Point3d(0,0,0));
206 vC.
addAP(0,
new Point3d(1,0,0),apc);
207 vC.
addAP(0,
new Point3d(1,1,0),apc);
209 IAtomContainer iacG = builder.newAtomContainer();
210 IAtom iaG1 =
new Atom(
"P",
new Point3d(0,0,0));
213 vG.
addAP(0,
new Point3d(1,0,0),apc);
214 vG.
addAP(0,
new Point3d(-1,1,0),apc);
216 IAtomContainer iacD = builder.newAtomContainer();
217 iacD.addAtom(
new PseudoAtom(
"ATN",
new Point3d(0,0,0)));
222 IAtomContainer iacE = builder.newAtomContainer();
223 iacE.addAtom(
new PseudoAtom(
"ATN",
new Point3d(0,0,0)));
265 Logger logger = Logger.getLogger(
"DummyLogger");
281 assertEquals(14,iacA.getAtomCount(),
"Atom count in the path");
284 assertEquals(6,iacB.getAtomCount(),
"Atom count in the path");
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.
Vertex getVertexAtPosition(int pos)
Returns the vertex that is in the given position of the list of vertices belonging to this graph.
void addEdge(Edge edge)
Adds the edge to the list of edges belonging to this graph.
This class represents the edge between two vertices.
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 setAsRCV(boolean isRCV)
AttachmentPoint getAP(int i)
Get attachment point i on this vertex.
This object represents a path in a DGraph.
void makeMolecularRepresentation(IAtomContainer mol, boolean make3D, Logger logger, Randomizer randomizer)
Creates the molecular representation, list of atoms and bonds involved in the path between the head a...
IAtomContainer getMolecularRepresentation()
Returns the molecular representation.
Unit test for PathSubGraph.
static DGraph makeTestGraphB()
Build a graph meant to be used in unit tests.
void testMakePathSubGraph()
static DGraph makeTestGraphA()
Build a graph meant to be used in unit tests.
Tool to build build three-dimensional (3D) tree-like molecular structures from DGraph.
void setAlignBBsIn3D(boolean align)
Sets the flag that controls whether building blocks have to be aligned according to the AP vectors or...
IAtomContainer convertGraphTo3DAtomContainer(DGraph graph)
Created a three-dimensional molecular representation from a given DGraph.
Tool to generate random numbers and random decisions.
Possible chemical bond types an edge can represent.
The type of building block.