/** * Get a subset of Atoms based by their positions * * @param caall * @param idx an array where each element is a position of all the Atoms to return * @return at Atom[] array */ public static Atom[] getFragmentFromIdxList(Atom[] caall, int[] idx){ Atom[] subset = new Atom[idx.length]; for (int p = 0 ; p < idx.length;p++){ int pos1 = idx[p]; subset[p] = (Atom) caall[pos1].clone(); } return subset; }
/** * Get a continue subset of Atoms based by the starting position and the length * * @param caall * @param pos the start position * @param fragmentLength the length of the subset to extract. * @return an Atom[] array */ public static Atom[] getFragment(Atom[] caall, int pos, int fragmentLength){ if ( pos+fragmentLength > caall.length) return null; Atom[] tmp = new Atom[fragmentLength]; for (int i=0;i< fragmentLength;i++){ tmp[i] = (Atom)caall[i+pos].clone(); } return tmp; }
/** get a continue subset of Atoms based by the starting position and the length * * @param caall * @param pos ... the start position * @param fragmentLength .. the length of the subset to extract. * @param clone: returns a copy of the atom (in case the coordinate get manipulated...) * @return an Atom[] array */ private static final Atom[] getFragment(Atom[] caall, int pos, int fragmentLength , boolean clone){ if ( pos+fragmentLength > caall.length) return null; Atom[] tmp = new Atom[fragmentLength]; for (int i=0;i< fragmentLength;i++){ if (clone){ tmp[i] = (Atom)caall[i+pos].clone(); } else { tmp[i] = caall[i+pos]; } } return tmp; }
private static Atom[] getAtoms(Atom[] ca, int[] positions, int length, boolean clone) { List<Atom> atoms = new ArrayList<Atom>(); for (int i = 0; i < length; i++) { int p = positions[i]; Atom a; if (clone) { a = (Atom) ca[p].clone(); a.setGroup((Group) ca[p].getGroup().clone()); } else { a = ca[p]; } atoms.add(a); } return atoms.toArray(new Atom[atoms.size()]); }
/** * Create a rotation axis from a vector, a point, and an angle. * * The result will be a pure rotation, with no screw component. * @param axis A vector parallel to the axis of rotation * @param pos A point on the axis of rotation * @param theta The angle to rotate (radians) */ public RotationAxis(Atom axis, Atom pos, double theta) { this.rotationAxis = Calc.unitVector(axis); this.rotationPos = (Atom) pos.clone(); this.theta = theta; this.screwTranslation = new AtomImpl(); //zero this.otherTranslation = null; //deprecated }
public void finish(StrucAligParameters params,Atom[]ca1,Atom[]ca2) throws StructureException{ Atom[] ca3 = new Atom[ca2.length]; for ( int i = 0 ; i < ca2.length;i++){ ca3[i] = (Atom) ca2[i].clone(); } // do the inital superpos... super_pos_alig(ca1,ca3,idx1,idx2,true); rotateShiftAtoms(ca3); calcScores(ca1,ca2); logger.debug("eqr " + eqr0 + " " + gaps0 + " " +idx1[0] + " " +idx1[1]); getPdbRegions(ca1,ca2); }
tmp2[i] = (Atom)ca2[focusRes2[i]].clone(); if (tmp1[i].getCoords() == null){ System.err.println("tmp1 got null: " +i + " pos: " + focusRes1[i]);
private double rmsCheck(Atom[] a1, Atom[] a2,List<int[]> idxlist, int p2i, int p2j, int l2) throws StructureException { //System.out.println(dd); // check if a joint fragment has low rms ... JointFragments ftmp = new JointFragments(); ftmp.setIdxlist(idxlist); ftmp.add(p2i,p2j,0,l2); Atom[] a3 = new Atom[a2.length]; for (int i=0;i < a2.length;i++){ a3[i] = (Atom)a2[i].clone(); } return getRMS(a1,a3,ftmp); }
@Override public Object clone(){ FragmentPair n = new FragmentPair(length,pos1,pos2); if ( center1 !=null) n.setCenter1((Atom)center1.clone()); if ( center2 != null) n.setCenter2((Atom)center2.clone()); n.setCluster(cluster); n.setContacts(contacts); n.setCovered(covered); n.setRms(rms); n.setLength(length); n.setRot((Matrix)rot.clone()); n.setUnitv((Atom)unitv.clone()); return n; } public int getCluster() {
if (alignedPos != null) { blocksetAtoms[blockPos] = (Atom) curr[alignedPos] .clone();
protected void cloneAtomsAndBonds(Group newGroup) { // copy the atoms for (Atom atom1 : atoms) { Atom atom = (Atom) atom1.clone(); newGroup.addAtom(atom); atom.setGroup(newGroup); } // copy the bonds for (int i=0;i<atoms.size();i++) { Atom atom1 = atoms.get(i); List<Bond> bonds1 = atom1.getBonds(); if (bonds1 != null) { for (Bond b : bonds1) { int atomAIndex = atoms.indexOf(b.getAtomA()); int atomBIndex = atoms.indexOf(b.getAtomB()); // The order of the atoms are the same on the original and the cloned object, which we use here. Bond newBond = new BondImpl(newGroup.getAtom(atomAIndex), newGroup.getAtom(atomBIndex), b.getBondOrder(), false); newGroup.getAtom(i).addBond(newBond); } } } }
int pos2 = optAln[block][1][i]; Atom a1 = ca1[pos1]; Atom a2 = (Atom) ca2[pos2].clone(); ca1aligned[pos] = a1; ca2aligned[pos] = a2;
tmp2[i] = (Atom)cod2[ r2 ].clone(); // have to be cloned!
ca2subset[i] = (Atom) ca2[pos2].clone();
int pos2 = optAln[block][1][i]; Atom a1 = ca1[pos1]; Atom a2 = (Atom) ca2[pos2].clone();
int pos2 = optAln[k][1][i]; Atom a1 = ca1[pos1]; Atom a2 = (Atom) ca2[pos2].clone(); ca1block[position] = a1; ca2block[position] = a2;