1package denoptim.fragmenter;
3import java.util.ArrayList;
4import java.util.Collection;
8import javax.vecmath.Point3d;
10import org.apache.commons.math3.ml.clustering.Clusterable;
11import org.jgrapht.graph.DefaultUndirectedGraph;
12import org.openscience.cdk.interfaces.IAtom;
14import denoptim.constants.DENOPTIMConstants;
15import denoptim.graph.AttachmentPoint;
16import denoptim.graph.FragIsomorphEdge;
17import denoptim.graph.FragIsomorphNode;
18import denoptim.graph.Fragment;
93 List<FragIsomorphNode> naturalOrder =
new ArrayList<FragIsomorphNode>();
94 Set<FragIsomorphNode> nodeSet =
100 if (n.getOriginal() == atm)
111 if (n.getOriginal() == ap)
131 this.allCoords = coords;
164 protected DefaultUndirectedGraph<FragIsomorphNode, FragIsomorphEdge>
208 double[] coords =
new double[pts.length*3];
209 for (
int j=0; j<pts.length; j++)
212 coords[i] = pts[j].x;
213 coords[i+1] = pts[j].y;
214 coords[i+2] = pts[j].z;
230 Point3d[] pts =
new Point3d[coords.length/3];
231 for (
int j=0; j<coords.length/3; j++)
234 pts[j] =
new Point3d(coords[i], coords[i+1], coords[i+2]);
271 int atmId =
frag.
indexOf((IAtom) node.getOriginal());
272 copy.
getAtom(atmId).setPoint3d(newCoords[j]);
Represents a fragment that can be clustered based on the 3*N coordinate of atoms and attachment point...
Fragment getTransformedCopy()
double[] allCoords
Ordered list of coordinated reflecting the ordered list of atoms/APs.
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.
static double[] convertToCoordsVector(Point3d[] pts)
Converts an array of 3-dimensional points in a vector of coordinates in 3*N-dimensional space where c...
ClusterableFragment clone()
Returns a shallow copy where the vector of coordinates has a new reference.
void setCoordsVector(double[] coords)
Sets the coordinates of each atom and attachment point in this object.
static Point3d[] convertToPointArray(double[] coords)
Converts an array of 3*N-dimensional coordinates into an array of 3-dimensional points assuming coord...
Fragment frag
Reference to original fragment.
Fragment getOriginalFragment()
The original fragment used to construct an instance of this object.
List< FragIsomorphNode > orderedNodes
Ordered list of nodes determined by isomorphism.
ClusterableFragment(Fragment frag)
Constructor.
void setOrderOfNodes(Collection< FragIsomorphNode > c)
Sets the order of nodes (i.e., atoms/APs) to use for geometric comparison with other fragments,...
void setCoordsVector(Point3d[] pts)
Sets the coordinates of each atom and attachment point in this object.
DefaultUndirectedGraph< FragIsomorphNode, FragIsomorphEdge > getJGraphFragIsomorphism()
An attachment point (AP) is a possibility to attach a Vertex onto the vertex holding the AP (i....
void setDirectionVector(Point3d dirVec)
Sets the end of the 3D vector defining the direction of the AP in 3D.
Class representing a continuously connected portion of chemical object holding attachment points.
List< AttachmentPoint > getAttachmentPoints()
Fragment clone()
Returns a deep copy of this fragments.
Iterable< IAtom > atoms()
IAtom getAtom(int number)
DefaultUndirectedGraph< FragIsomorphNode, FragIsomorphEdge > getJGraphFragIsomorphism()
Creates a graph representation of this fragment where both atoms and AttachmentPoints are represented...
int getIndexOfAP(AttachmentPoint ap)
Returns the position of the given AP in the list of APs of this vertex.
AttachmentPoint getAP(int i)
Get attachment point i on this vertex.