public static int contacts(Point3d[] x, Point3d[] y, double maxDistance) { int contacts = 0; for (int i = 0; i < x.length; i++) { double minDist = Double.MAX_VALUE; for (int j = 0; j < y.length; j++) { minDist = Math.min(minDist, x[i].distanceSquared(y[j])); } if (minDist < maxDistance * maxDistance) { contacts++; } } return contacts; }
public static double rmsdMin(Point3d[] x, Point3d[] y) { if (x.length != y.length) { throw new IllegalArgumentException( "Point arrays are not of the same length."); } double sum = 0.0; for (int i = 0; i < x.length; i++) { double minDist = Double.MAX_VALUE; for (int j = 0; j < y.length; j++) { minDist = Math.min(minDist, x[i].distanceSquared(y[j])); } sum += minDist; } return Math.sqrt(sum / x.length); }
/** * Calculate the RMSD of two point arrays, already superposed. * * @param x * array of points superposed to y * @param y * array of points superposed to x * @return RMSD */ public static double rmsd(Point3d[] x, Point3d[] y) { if (x.length != y.length) { throw new IllegalArgumentException( "Point arrays are not of the same length."); } double sum = 0.0; for (int i = 0; i < x.length; i++) { sum += x[i].distanceSquared(y[i]); } return Math.sqrt(sum / x.length); }
public static double GTSlikeScore(Point3d[] x, Point3d[] y) { if (x.length != y.length) { throw new IllegalArgumentException( "Point arrays are not of the same length."); } int contacts = 0; for (Point3d px : x) { double minDist = Double.MAX_VALUE; for (Point3d py : y) { minDist = Math.min(minDist, px.distanceSquared(py)); } if (minDist > 64) continue; contacts++; if (minDist > 16) continue; contacts++; if (minDist > 4) continue; contacts++; if (minDist > 1) continue; contacts++; } return contacts * 25.0 / x.length; }
public double getRadiusOfGyration() { Point3d c = getCenterOfMass(); Point3d t = new Point3d(); double sum = 0; for (int i = 0, n = points.size(); i < n; i++) { t.set(points.get(i)); sum += t.distanceSquared(c); } sum /= points.size(); return Math.sqrt(sum); }
/** * Returns the TM-Score for two superimposed sets of coordinates Yang Zhang * and Jeffrey Skolnick, PROTEINS: Structure, Function, and Bioinformatics * 57:702–710 (2004) * * @param x * coordinate set 1 * @param y * coordinate set 2 * @param lengthNative * total length of native sequence * @return */ public static double TMScore(Point3d[] x, Point3d[] y, int lengthNative) { if (x.length != y.length) { throw new IllegalArgumentException( "Point arrays are not of the same length."); } double d0 = 1.24 * Math.cbrt(x.length - 15.0) - 1.8; double d0Sq = d0 * d0; double sum = 0; for (int i = 0; i < x.length; i++) { sum += 1.0 / (1.0 + x[i].distanceSquared(y[i]) / d0Sq); } return sum / lengthNative; }
private double calcDistanceThreshold() { double threshold = Double.MAX_VALUE; int n = subunits.getSubunitCount(); List<Point3d> centers = subunits.getCenters(); for (int i = 0; i < n - 1; i++) { Point3d pi = centers.get(i); for (int j = i + 1; j < n; j++) { Point3d pj = centers.get(j); threshold = Math.min(threshold, pi.distanceSquared(pj)); } } double distanceThreshold = Math.sqrt(threshold); distanceThreshold = Math.max(distanceThreshold, parameters.getRmsdThreshold()); return distanceThreshold; }
Point3d atom_j = atomCoords[neighbor_indices[j]]; double r = radii[neighbor_indices[j]] + probe; double diff_sq = test_point.distanceSquared(atom_j); if (diff_sq < r*r) { j_closest_neighbor = j;
double dist = t.distanceSquared(originalCoords[j]); if (dist < minDist) { closest = j;
/** * Get the angle between the three pharmacophore groups that make up the constraint. * * @return The angle in degrees between the two groups */ public double getBondLength() { double epsilon = 1e-3; PharmacophoreAtom atom1 = (PharmacophoreAtom) getAtom(0); PharmacophoreAtom atom2 = (PharmacophoreAtom) getAtom(1); PharmacophoreAtom atom3 = (PharmacophoreAtom) getAtom(2); double a2 = atom3.getPoint3d().distanceSquared(atom1.getPoint3d()); double b2 = atom3.getPoint3d().distanceSquared(atom2.getPoint3d()); double c2 = atom2.getPoint3d().distanceSquared(atom1.getPoint3d()); double cosangle = (b2 + c2 - a2) / (2 * Math.sqrt(b2) * Math.sqrt(c2)); if (-1.0 - epsilon < cosangle && -1.0 + epsilon > cosangle) return 180.0; if (1.0 - epsilon < cosangle && 1.0 + epsilon > cosangle) return 0.0; return Math.acos(cosangle) * 180.0 / Math.PI; }
/** * Get the angle between the three pharmacophore groups that make up the constraint. * * @return The angle in degrees between the two groups */ public double getBondLength() { double epsilon = 1e-3; PharmacophoreAtom atom1 = (PharmacophoreAtom) getAtom(0); PharmacophoreAtom atom2 = (PharmacophoreAtom) getAtom(1); PharmacophoreAtom atom3 = (PharmacophoreAtom) getAtom(2); double a2 = atom3.getPoint3d().distanceSquared(atom1.getPoint3d()); double b2 = atom3.getPoint3d().distanceSquared(atom2.getPoint3d()); double c2 = atom2.getPoint3d().distanceSquared(atom1.getPoint3d()); double cosangle = (b2 + c2 - a2) / (2 * Math.sqrt(b2) * Math.sqrt(c2)); if (-1.0 - epsilon < cosangle && -1.0 + epsilon > cosangle) return 180.0; if (1.0 - epsilon < cosangle && 1.0 + epsilon > cosangle) return 0.0; return Math.acos(cosangle) * 180.0 / Math.PI; }
if (seqClusterId.get(i) == seqClusterId.get(j)) { if (!used[j]) { double dSq = tCenter.distanceSquared(centers.get(j)); if (dSq < minDistSq && dSq <= rmsdThresholdSq) { minDistSq = dSq;
double dSq = orig[j].distanceSquared(trans[j]); sumTm += 1.0/(1.0 + dSq/d0Sq); sumDsq += dSq;
transformation.transform(t); double dSq = orig[j].distanceSquared(t); sumTm += 1.0/(1.0 + dSq/d0Sq); sumDsq += dSq;
Point3d pointTwo = footstepData.trajectoryWaypoints[i]; if (!(pointOne.distanceSquared(pointTwo) < 1e-7)) trajectoryWaypointsEqual = false;
double dSq = point.distanceSquared(v); if (dSq > dSqThreshold) { if (dSq < dSqMin) {