1package denoptim.fragmenter;
3import static org.junit.jupiter.api.Assertions.assertFalse;
4import static org.junit.jupiter.api.Assertions.assertTrue;
6import javax.vecmath.Point3d;
8import org.junit.jupiter.api.Test;
9import org.openscience.cdk.Atom;
10import org.openscience.cdk.interfaces.IAtom;
11import org.openscience.cdk.interfaces.IAtomContainer;
12import org.openscience.cdk.interfaces.IBond;
13import org.openscience.cdk.interfaces.IChemObjectBuilder;
14import org.openscience.cdk.silent.SilentChemObjectBuilder;
16import denoptim.graph.APClass;
17import denoptim.graph.AttachmentPoint;
18import denoptim.graph.FragIsomorphNode;
19import denoptim.graph.Fragment;
20import denoptim.graph.Vertex.BBType;
31 private IChemObjectBuilder
builder = SilentChemObjectBuilder.getInstance();
38 IAtomContainer mol =
builder.newAtomContainer();
39 mol.addAtom(
new Atom(
"C",
new Point3d(1,0,0)));
40 mol.addAtom(
new Atom(
"H",
new Point3d(2,0,0)));
41 mol.addAtom(
new Atom(
"O",
new Point3d(3,0,0)));
42 mol.addBond(0,1,IBond.Order.SINGLE);
43 mol.addBond(0,2,IBond.Order.SINGLE);
56 assertTrue(Math.abs(value-n.getPoint3d().x) < 0.0001);
65 IAtomContainer mol =
builder.newAtomContainer();
66 mol.addAtom(
new Atom(
"C",
new Point3d(1,0,0)));
67 mol.addAtom(
new Atom(
"H",
new Point3d(2,0,0)));
68 mol.addAtom(
new Atom(
"O",
new Point3d(3,0,0)));
69 mol.addBond(0,1,IBond.Order.SINGLE);
70 mol.addBond(0,2,IBond.Order.SINGLE);
79 double[] newCoords =
new double[] {-1,-1,-1, -2,-2,-2, -3,-3,-3,
80 -4,-4,-4, -5,-5,-5, -6,-6,-6, -7,-7,-7};
85 assertFalse(frag == fragCopy);
88 IAtom atm = fragCopy.
getAtom(i);
89 assertTrue(Math.abs(atm.getPoint3d().x - newCoords[i*3])<0.0001);
90 assertTrue(Math.abs(atm.getPoint3d().y - newCoords[1+i*3])<0.0001);
91 assertTrue(Math.abs(atm.getPoint3d().z - newCoords[2+i*3])<0.0001);
Represents a fragment that can be clustered based on the 3*N coordinate of atoms and attachment point...
Fragment getTransformedCopy()
List< FragIsomorphNode > getOrderedNodes()
Get the ordered list of nodes representing each either an atom or an attachment point is the alignmen...
void setNaturalNodeOrder()
Define the node order from the list of atoms and attachment points.
void setCoordsVector(double[] coords)
Sets the coordinates of each atom and attachment point in this object.
Unit test for fragmenter's tools.
void testSetNaturalNodeOrder()
void testGetTransformedCopy()
IChemObjectBuilder builder
Private builder of atom containers.
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....
Point3d getDirectionVector()
Returns the end of the direction vector.
Class representing a continuously connected portion of chemical object holding attachment points.
void addAP(int atomPositionNumber)
Adds an attachment point with a dummy APClass.
IAtom getAtom(int number)
AttachmentPoint getAP(int i)
Get attachment point i on this vertex.
The type of building block.