/** * * @param atom1 the first {@link Atom} in structure. * @param atom2 the second {@link Atom} in structure. * @return the distance between the two atoms in Angstrom. */ public static double getAtomDistance(Atom atom1, Atom atom2) { double distance; distance = Calc.getDistance(atom1, atom2); return distance; }
/** * Gets the distance between the two atoms of this bond. * <p> * This distance is calculated by {@link Calc#getDistance(Atom, Atom)}, but * this method will suppress the empty threat of a * {@link StructureException} that method makes. * * @return the distance between the two atoms of this bond. */ @Override public double getLength() { return Calc.getDistance(atomA, atomB); }
/** * Get distances along diagonal k from coordinate array coords. * * @param atoms set of atoms to be used * @param k number of diagonal to be used */ public static double[] getDiagonalAtK (Atom[] atoms,int k) { int l = atoms.length; double[] dk = new double[(l-k)]; for ( int i = 0 ; i< (l-k); i++){ double dist = Calc.getDistance(atoms[i],atoms[i+k]); dk[i] = dist; } return dk; }
private void calMatrix() throws StructureException { int i, j; double dis; for(i = 0; i < pro1Len; i ++) { for(j = 0; j < pro2Len; j ++) { dis = Calc.getDistance(cod1[i],cod2[j]); if(dis < Dc) { sij[i][j] = Dc - dis; } else { sij[i][j] = 0; } } } }
/** * filter 1 for AFP extration: the distance of end-to-end * @param p1b * @param p1e * @param p2b * @param p2e * @return */ private static final double getEnd2EndDistance(Atom[] ca1, Atom[] ca2, int p1b, int p1e, int p2b, int p2e) { double min = 99; double dist1 = Calc.getDistance(ca1[p1b], ca1[p1e]); double dist2 = Calc.getDistance(ca2[p2b], ca2[p2e]); min = dist1 - dist2; return Math.abs(min); }
/** * Get the distance from a point to the axis of rotation * @param point * @return The distance to the axis, or NaN if the RotationAxis is purely translational */ public double getProjectedDistance(Atom point) { Atom projected = getProjectedPoint(point); if( projected == null) { // translation only return Double.NaN; } return Calc.getDistance(point, projected); }
/** this is probably useless * * @param ca1subset * @param ca2subset * @return a double * @throws StructureException */ private double getDensity(Atom[] ca1subset, Atom[] ca2subset ) throws StructureException{ Atom centroid1 = Calc.getCentroid(ca1subset); Atom centroid2 = Calc.getCentroid(ca2subset); // get Average distance to centroid ... double d1 = 0; double d2 = 0; for ( int i = 0 ; i < ca1subset.length;i++){ double dd1 = Calc.getDistance(centroid1, ca1subset[i]); double dd2 = Calc.getDistance(centroid2, ca2subset[i]); d1 += dd1; d2 += dd2; } double avd1 = d1 / ca1subset.length; double avd2 = d2 / ca2subset.length; return Math.min(avd1,avd2); }
/** * Minimum distance between all atoms in two amino acids */ double distanceMin(AminoAcid aa1, AminoAcid aa2) { double distMin = Double.POSITIVE_INFINITY; for (Atom atom1 : aa1.getAtoms()) for (Atom atom2 : aa2.getAtoms()) { double dist = Calc.getDistance(atom1, atom2); distMin = Math.min(distMin, dist); } return distMin; }
private static boolean hasMetalBond(Atom a1, Atom a2, MetalBondDistance definition) { double distance = Calc.getDistance(a1,a2); Float min = definition.getLowerLimit(); Float max = definition.getUpperLimit(); return ( min < distance && max > distance); }
public boolean angleCheckOk(FragmentPair a, FragmentPair b, float distcutoff){ double dist = -999; Atom v1 = a.getUnitv(); Atom v2 = b.getUnitv(); dist = Calc.getDistance(v1,v2); return dist <= distcutoff; }
private boolean distanceCheckOk(FragmentPair a, FragmentPair b, float fragCompatDist){ double dd ; Atom c1i = a.getCenter1(); Atom c1j = b.getCenter1(); Atom c2i = a.getCenter2(); Atom c2j = b.getCenter2(); dd = Calc.getDistance(c1i,c1j) - Calc.getDistance(c2i,c2j); if ( dd < 0) dd = -dd; return dd <= fragCompatDist; }
double distance; distance = Calc.getDistance(linkage[0], linkage[1]);
public static Matrix getDistanceMatrix(Atom[] ca1, Atom[]ca2){ int r = ca1.length; int c = ca2.length; Matrix out = new Matrix(r,c); for (int i=0; i<r; i++) { Atom a1 = ca1[i]; for (int j=0;j<c;j++){ Atom b1 = ca2[j]; double d = Calc.getDistance(a1,b1); out.set(i,j,d); } } return out; }
/** * Matrix of all distances between two sets of Atoms. Does not * superimpose or modify the Atoms. * * @param ca1 * @param ca2 * @return a Matrix */ public static Matrix getDistanceMatrix(Atom[] ca1, Atom[] ca2){ int r = ca1.length; int c = ca2.length; Matrix out = new Matrix(r,c); for (int i=0; i<r; i++) { Atom a1 = ca1[i]; for (int j=0;j<c;j++){ Atom b1 = ca2[j]; double d = Calc.getDistance(a1,b1); out.set(i,j,d); } } return out; }
/** * Test if two amino acids are connected, i.e. if the distance from C to N < * 2.5 Angstrom. * * If one of the AminoAcids has an atom missing, returns false. * * @param a * an AminoAcid object * @param b * an AminoAcid object * @return true if ... */ public static final boolean isConnected(AminoAcid a, AminoAcid b) { Atom C = null ; Atom N = null; C = a.getC(); N = b.getN(); if ( C == null || N == null) return false; // one could also check if the CA atoms are < 4 A... double distance = getDistance(C,N); return distance < 2.5; }
private void formNucleotideBonds() { for (int modelInd=0; modelInd<structure.nrModels(); modelInd++){ for (Chain chain : structure.getChains(modelInd)) { List<Group> groups = chain.getSeqResGroups(); for (int i = 0; i < groups.size() - 1; i++) { if (!(groups.get(i) instanceof NucleotideImpl) || !(groups.get(i + 1) instanceof NucleotideImpl)) continue; NucleotideImpl tail = (NucleotideImpl) groups.get(i); NucleotideImpl head = (NucleotideImpl) groups.get(i + 1); // atoms with no residue number don't have atom information if (tail.getResidueNumber() == null || head.getResidueNumber() == null) { continue; } Atom phosphorous = head.getP(); Atom oThreePrime = tail.getO3Prime(); if (phosphorous == null || oThreePrime == null) { continue; } if (Calc.getDistance(phosphorous, oThreePrime) < MAX_NUCLEOTIDE_BOND_LENGTH) { new BondImpl(phosphorous, oThreePrime, 1); } } } } }
private static Matrix getDisTable(int maxlen, Atom[]ca) { int length = ca.length; Matrix dis = new Matrix(length,length); int i, j; for(i = 0; i < length; i ++) { dis.set(i,i,0); for(j = i + 1;( j < length) && (j <= i + maxlen); j ++) { dis.set(i,j,0); double val = dis.get(i,j) + (Calc.getDistance(ca[i],ca[j])) * (Calc.getDistance(ca[i],ca[j])); dis.set(i,j,val); dis.set(i,j,Math.sqrt(dis.get(i,j))); dis.set(j,i,dis.get(i,j)); } } return dis; }
if (Calc.getDistance(carboxylC, aminoN) < MAX_PEPTIDE_BOND_LENGTH) { new BondImpl(carboxylC, aminoN, 1);
private static Atom calcSimple_H(Atom c, Atom o, Atom n) { Atom h = Calc.subtract(c,o); double dist = Calc.getDistance(o,c); //System.out.println(dist); double x = n.getX() + h.getX() / dist; double y = n.getY() + h.getY() / dist; double z = n.getZ() + h.getZ() / dist; h.setX(x); h.setY(y); h.setZ(z); h.setName("H"); return h; }
Atom N = groups[index+1].getN(); if (Calc.getDistance(C, N) > MAX_PEPTIDE_BOND_LENGTH){ bonded = false; break;