public static void rotate(Atom[] ca, Matrix matrix) { for (Atom atom : ca) Calc.rotate(atom, matrix); }
/** rotate and shift atoms with currentRotMatrix and current Tranmatrix * * @param ca */ private void rotateShiftAtoms(Atom[] ca){ for (int i = 0 ; i < ca.length; i++){ Atom c = ca[i]; Calc.rotate(c,currentRotMatrix); Calc.shift(c,currentTranMatrix); //System.out.println("after " + c); ca[i] = c; } //System.out.println("after " + ca[0]); }
/** * Rotate a group object. The rotation Matrix must be a pre-multiplication * Matrix. * * @param group * a group to be rotated * @param m * a Matrix object representing the rotation matrix */ public static final void rotate(Group group, Matrix m){ AtomIterator iter = new AtomIterator(group) ; while (iter.hasNext()) { Atom atom = iter.next() ; rotate(atom,m); } }
/** * Rotate a structure object. The rotation Matrix must be a * pre-multiplication Matrix. * * @param structure * the structure to be rotated * @param m * rotation matrix to be applied */ public static final void rotate(Structure structure, Matrix m){ AtomIterator iter = new AtomIterator(structure) ; while (iter.hasNext()) { Atom atom = iter.next() ; rotate(atom,m); } }
/** only shift CA positions. * */ public static void shiftCA2(AFPChain afpChain, Atom[] ca2, Matrix m, Atom shift, Group[] twistedGroups) { int i = -1; for (Atom a: ca2){ i++; Group g = a.getGroup(); Calc.rotate(g,m); Calc.shift(g, shift); if (g.hasAltLoc()){ for (Group alt: g.getAltLocs()){ for (Atom alta : alt.getAtoms()){ if ( g.getAtoms().contains(alta)) continue; Calc.rotate(alta,m); Calc.shift(alta,shift); } } } twistedGroups[i]=g; } }
public void rotate(Atom[] atoms, double theta) { Matrix rot = getRotationMatrix(theta); if(rotationPos == null) { // Undefined rotation axis; do nothing return; } Atom negPos; negPos = Calc.invert(rotationPos); for(Atom a: atoms) { Calc.shift(a, negPos); } Calc.rotate(atoms, rot); for(Atom a: atoms) { Calc.shift(a, rotationPos); } }
private void rot_mol(Atom[] caA, Atom[] caB, int nse2, Matrix m , Atom shift) throws StructureException{ for(int l=0; l<nse2; l++) { Atom a = caA[l]; Group g = (Group)a.getGroup().clone(); //Group g = (Group)a.getParent(); Calc.rotate( g, m); Calc.shift( g, shift); caB[l] = g.getAtom(a.getName()); } }
private void rot_mol(Atom[] caA, Atom[] caB, int nse2, Matrix m , Atom shift) throws StructureException{ for(int l=0; l<nse2; l++) { Atom a = caA[l]; Group g = (Group)a.getGroup().clone(); //Group g = (Group)a.getParent(); Calc.rotate( g, m); Calc.shift( g, shift); caB[l] = g.getAtom(a.getName()); } }
/** * Rotate a structure. The rotation Matrix must be a pre-multiplication * Matrix. * * @param structure * a Structure object * @param rotationmatrix * an array (3x3) of double representing the rotation matrix. * @throws StructureException * ... */ public static final void rotate(Structure structure, double[][] rotationmatrix) throws StructureException { if ( rotationmatrix.length != 3 ) { throw new StructureException ("matrix does not have size 3x3 !"); } AtomIterator iter = new AtomIterator(structure) ; while (iter.hasNext()) { Atom atom = iter.next() ; Calc.rotate(atom,rotationmatrix); } }
/** * Rotate a Group. The rotation Matrix must be a pre-multiplication Matrix. * * @param group * a group object * @param rotationmatrix * an array (3x3) of double representing the rotation matrix. * @throws StructureException * ... */ public static final void rotate(Group group, double[][] rotationmatrix) throws StructureException { if ( rotationmatrix.length != 3 ) { throw new StructureException ("matrix does not have size 3x3 !"); } AtomIterator iter = new AtomIterator(group) ; while (iter.hasNext()) { Atom atom = null ; atom = iter.next() ; rotate(atom,rotationmatrix); } }
for (int p = 0; p < optAln[b][0].length; p++) { Atom ca2clone = ca2[optAln[b][1][p]]; Calc.rotate(ca2clone, afpChain.getBlockRotationMatrix()[b]); Calc.shift(ca2clone, afpChain.getBlockShiftVector()[b]);
Calc.rotate(g, m1); Calc.shift(g,vector1);
Calc.rotate(s3,m2); Calc.shift(s3,shift2);
Calc.rotate(aunitv, rotmat); f.setUnitv(aunitv);
/** create an artifical Structure object that contains the two * structures superimposed onto each other. Each structure is in a separate model. * Model 1 is structure 1 and Model 2 is structure 2. * * @param s1 the first structure. its coordinates will not be changed * @param s2 the second structure, it will be cloned and the cloned coordinates will be rotated according to the alignment results. * @return composite structure containing the 2 aligned structures as a models 1 and 2 */ public Structure getAlignedStructure(Structure s1, Structure s2){ // do not change the original coords .. Structure s3 = s2.clone(); currentRotMatrix.print(3,3); Calc.rotate(s3, currentRotMatrix); Calc.shift( s3, currentTranMatrix); Structure newpdb = new StructureImpl(); newpdb.setPDBCode("Java"); newpdb.setName("Aligned with BioJava"); newpdb.addModel(s1.getChains(0)); newpdb.addModel(s3.getChains(0)); return newpdb; }
/** * Get the RMS of the JointFragments pair frag * * @param ca1 the array of all atoms of structure1 * @param ca2 the array of all atoms of structure1 * @param frag the JointFragments object that contains the list of identical positions * @return the rms */ public static double getRMS(Atom[] ca1, Atom[]ca2,JointFragments frag) throws StructureException { // now svd ftmp and check if the rms is < X ... AlternativeAlignment ali = new AlternativeAlignment(); ali.apairs_from_idxlst(frag); double rms = 999; int[] idx1 = ali.getIdx1(); int[] idx2 = ali.getIdx2(); Atom[] ca1subset = AlignUtils.getFragmentFromIdxList(ca1, idx1); Atom[] ca2subset = AlignUtils.getFragmentFromIdxList(ca2,idx2); ali.calculateSuperpositionByIdx(ca1,ca2); Matrix rot = ali.getRotationMatrix(); Atom atom = ali.getShift(); for (Atom a : ca2subset) { Calc.rotate(a, rot); Calc.shift(a, atom); } rms = Calc.rmsd(ca1subset,ca2subset); return rms; }
Atom tranMatrix = getTranslationVector(transform); Calc.rotate(aCB,rotMatrix);
Calc.rotate(a, matrix); Calc.shift(a, shift);
Calc.rotate(shiftVec[block],blockRotMat[block]); shiftVec[block] = Calc.invert(shiftVec[block]);
Calc.rotate(shiftN[i],maxN[i]);