1package denoptim.fragmenter;
3import static org.junit.jupiter.api.Assertions.assertEquals;
5import java.util.ArrayList;
7import java.util.logging.Logger;
9import javax.vecmath.Point3d;
11import org.junit.jupiter.api.Test;
12import org.openscience.cdk.Atom;
13import org.openscience.cdk.interfaces.IAtom;
14import org.openscience.cdk.interfaces.IAtomContainer;
15import org.openscience.cdk.interfaces.IChemObjectBuilder;
16import org.openscience.cdk.silent.SilentChemObjectBuilder;
18import denoptim.constants.DENOPTIMConstants;
19import denoptim.graph.APClass;
20import denoptim.graph.AttachmentPoint;
21import denoptim.graph.Fragment;
22import denoptim.graph.Vertex.BBType;
33 private IChemObjectBuilder
builder = SilentChemObjectBuilder.getInstance();
40 String isoFamId =
"IdOfThisFamily";
42 IAtomContainer mol1 =
builder.newAtomContainer();
43 mol1.addAtom(
new Atom(
"C",
new Point3d(0,0,0)));
44 mol1.addAtom(
new Atom(
"H",
new Point3d(1,1,1)));
45 mol1.addAtom(
new Atom(
"O",
new Point3d(3,1,1)));
54 IAtomContainer mol2 =
builder.newAtomContainer();
55 mol2.addAtom(
new Atom(
"O",
new Point3d(3,1,1)));
56 mol2.addAtom(
new Atom(
"H",
new Point3d(1,1,1)));
57 mol2.addAtom(
new Atom(
"C",
new Point3d(0,0,0)));
63 IAtomContainer mol3 =
builder.newAtomContainer();
64 mol3.addAtom(
new Atom(
"O",
new Point3d(1,3,1)));
65 mol3.addAtom(
new Atom(
"H",
new Point3d(1,1,1)));
66 mol3.addAtom(
new Atom(
"C",
new Point3d(0,0,0)));
72 IAtomContainer mol4 =
builder.newAtomContainer();
73 mol4.addAtom(
new Atom(
"C",
new Point3d(0,0,0)));
78 IAtomContainer mol5 =
builder.newAtomContainer();
79 mol5.addAtom(
new Atom(
"O",
new Point3d(1,3,1)));
80 mol5.addAtom(
new Atom(
"H",
new Point3d(1,1,1)));
81 mol5.addAtom(
new Atom(
"C",
new Point3d(0,0,0)));
87 List<IAtomContainer> lst =
new ArrayList<IAtomContainer>();
95 List<ClusterableFragment> sample =
97 lst.iterator(), isoFamId, Logger.getLogger(
"DummyLog"));
100 assertEquals(4,sample.size());
104 for (IAtom atm : frag1.
atoms())
106 assertEquals(atm.getSymbol(),
107 sample.get(0).getOrderedNodes().get(j).getLabel());
112 assertEquals(ap.getAPClass().toString(),
113 sample.get(0).getOrderedNodes().get(j).getLabel());
120 for (
int i=0; i<cf.getOrderedNodes().size(); i++)
122 assertEquals(sample.get(0).getOrderedNodes().get(i).getLabel(),
123 cf.getOrderedNodes().get(i).getLabel());
General set of constants used in DENOPTIM.
static final Object ISOMORPHICFAMILYID
Property used to store the identifier of the family of isomorphic fragments that owns a fragment.
Represents a fragment that can be clustered based on the 3*N coordinate of atoms and attachment point...
static APClass make(String ruleAndSubclass)
Creates an APClass if it does not exist already, or returns the reference to the existing instance.
An attachment point (AP) is a possibility to attach a Vertex onto the vertex holding the AP (i....
Class representing a continuously connected portion of chemical object holding attachment points.
void addAP(int atomPositionNumber)
Adds an attachment point with a dummy APClass.
List< AttachmentPoint > getAttachmentPoints()
Fragment clone()
Returns a deep copy of this fragments.
Iterable< IAtom > atoms()
IAtomContainer getIAtomContainer()
void setProperty(Object key, Object property)
The type of building block.