1package denoptim.fragmenter;
3import static org.junit.jupiter.api.Assertions.assertTrue;
5import java.util.ArrayList;
8import javax.vecmath.Point3d;
10import org.junit.jupiter.api.Test;
11import org.openscience.cdk.Atom;
12import org.openscience.cdk.interfaces.IAtomContainer;
13import org.openscience.cdk.interfaces.IBond;
14import org.openscience.cdk.interfaces.IChemObjectBuilder;
15import org.openscience.cdk.silent.SilentChemObjectBuilder;
17import denoptim.fragmenter.FragmentClusterer.DistanceAsRMSD;
18import denoptim.graph.APClass;
19import denoptim.graph.Fragment;
20import denoptim.graph.Vertex.BBType;
31 private IChemObjectBuilder
builder = SilentChemObjectBuilder.getInstance();
38 List<ClusterableFragment> sample =
new ArrayList<ClusterableFragment>();
40 IAtomContainer mol0 =
builder.newAtomContainer();
41 mol0.addAtom(
new Atom(
"C",
new Point3d(0,0,0)));
42 mol0.addAtom(
new Atom(
"H",
new Point3d(2,0,0)));
43 mol0.addBond(0,1,IBond.Order.SINGLE);
50 IAtomContainer mol1 =
builder.newAtomContainer();
51 mol1.addAtom(
new Atom(
"C",
new Point3d(0,0,0)));
52 mol1.addAtom(
new Atom(
"H",
new Point3d(1,0,0)));
53 mol1.addBond(0,1,IBond.Order.SINGLE);
60 IAtomContainer mol2 =
builder.newAtomContainer();
61 mol2.addAtom(
new Atom(
"C",
new Point3d(0,0,0)));
62 mol2.addAtom(
new Atom(
"H",
new Point3d(1.5,0,0)));
63 mol2.addBond(0,1,IBond.Order.SINGLE);
79 assertTrue(centroid != cf2);
87 List<ClusterableFragment> sample =
new ArrayList<ClusterableFragment>();
89 IAtomContainer mol0 =
builder.newAtomContainer();
90 mol0.addAtom(
new Atom(
"C",
new Point3d(0,0,0)));
91 mol0.addAtom(
new Atom(
"H",
new Point3d(2,0,0)));
92 mol0.addBond(0,1,IBond.Order.SINGLE);
99 IAtomContainer mol1 =
builder.newAtomContainer();
100 mol1.addAtom(
new Atom(
"C",
new Point3d(0,0,0)));
101 mol1.addAtom(
new Atom(
"H",
new Point3d(1,0,0)));
102 mol1.addBond(0,1,IBond.Order.SINGLE);
109 IAtomContainer mol2 =
builder.newAtomContainer();
110 mol2.addAtom(
new Atom(
"C",
new Point3d(0,0,0)));
111 mol2.addAtom(
new Atom(
"H",
new Point3d(1.5,0,0)));
112 mol2.addBond(0,1,IBond.Order.SINGLE);
128 assertTrue(nearest == cf2);
Represents a fragment that can be clustered based on the 3*N coordinate of atoms and attachment point...
void setNaturalNodeOrder()
Define the node order from the list of atoms and attachment points.
A cluster with a centroid that can be updated after definition of the cluster.
ClusterableFragment getCentroid()
Get the point chosen to be the centroid of this cluster.
ClusterableFragment getNearestToCentroid(DistanceMeasure measure)
Gets the original data that upon clustering is closest to the cluster centroid according to the given...
void addPoint(ClusterableFragment point)
Add a new member of this cluster.
Unit test for fragmenter's tools.
IChemObjectBuilder builder
Private builder of atom containers.
void testGetNearestToCentroid()
Distance in terms of RMSD between sets of 3D points expressed as a single vector of coordinates [x1,...
double compute(double[] coordsA, double[] coordsB)
static APClass make(String ruleAndSubclass)
Creates an APClass if it does not exist already, or returns the reference to the existing instance.
Class representing a continuously connected portion of chemical object holding attachment points.
void addAP(int atomPositionNumber)
Adds an attachment point with a dummy APClass.
The type of building block.