/** * Convert an array of atoms into an array of vecmath points * * @param atoms * list of atoms * @return list of Point3ds storing the x,y,z coordinates of each atom */ public static Point3d[] atomsToPoints(Atom[] atoms) { Point3d[] points = new Point3d[atoms.length]; for(int i = 0; i< atoms.length;i++) { points[i] = atoms[i].getCoordsAsPoint3d(); } return points; } /**
/** * Convert an array of atoms into an array of vecmath points * * @param atoms * list of atoms * @return list of Point3ds storing the x,y,z coordinates of each atom */ public static List<Point3d> atomsToPoints(Collection<Atom> atoms) { ArrayList<Point3d> points = new ArrayList<>(atoms.size()); for (Atom atom : atoms) { points.add(atom.getCoordsAsPoint3d()); } return points; }
/** * Gets the angle between two vectors * * @param a * an Atom object * @param b * an Atom object * @return Angle between a and b in degrees, in range [0,180]. If either * vector has length 0 then angle is not defined and NaN is returned */ public static final double angle(Atom a, Atom b){ Vector3d va = new Vector3d(a.getCoordsAsPoint3d()); Vector3d vb = new Vector3d(b.getCoordsAsPoint3d()); return Math.toDegrees(va.angle(vb)); }
/** * Converts the List of {@link SubunitCluster} to a Subunit object. * * @param clusters * List of SubunitCluster */ public QuatSymmetrySubunits(List<SubunitCluster> clusters) { this.clusters = clusters; // Loop through all subunits in the clusters and fill Lists for (int c = 0; c < clusters.size(); c++) { for (int s = 0; s < clusters.get(c).size(); s++) { clusterIds.add(c); Atom[] atoms = clusters.get(c).getAlignedAtomsSubunit(s); // Convert atoms to points Point3d[] points = new Point3d[atoms.length]; for (int i = 0; i < atoms.length; i++) points[i] = atoms[i].getCoordsAsPoint3d(); caCoords.add(points); } } // List number of members in each cluster List<Integer> stoichiometries = clusters.stream().map(c -> c.size()) .collect(Collectors.toList()); folds = SymmetryTools.getValidFolds(stoichiometries); }
if (a1 == null || a2 == null) continue; if (Math.abs(a1.getCoordsAsPoint3d().distance(a2.getCoordsAsPoint3d())-10.0) > 4.0) continue; Pair<Group> ga = new Pair<>(g1, g2);
/** * Returns and array of all non-Hydrogen atoms coordinates in the given Chain, * optionally including HET atoms or not Waters are not included. * * @param c * @param hetAtoms * if true HET atoms are included in array, if false they are not * @return */ public static final Point3d[] getAllNonHCoordsArray(Chain c, boolean hetAtoms) { List<Point3d> atoms = new ArrayList<Point3d>(); for (Group g : c.getAtomGroups()) { if (g.isWater()) continue; for (Atom a : g.getAtoms()) { if (a.getElement() == Element.H) continue; if (!hetAtoms && g.getType().equals(GroupType.HETATM)) continue; atoms.add(a.getCoordsAsPoint3d()); } } return atoms.toArray(new Point3d[atoms.size()]); }
if (a1 == null || a2 == null) continue; if (Math.abs(a1.getCoordsAsPoint3d().distance(a2.getCoordsAsPoint3d()) - 10.0) > 4.0) continue; Pair<Group> ga = new Pair<>(g1, g2);
/** * {@inheritDoc} */ @Override public void addAtom(Atom atom){ atom.setGroup(this); atoms.add(atom); // TODO this check is useless, coords are always !=null since they are initialized to 0,0,0 in AtomImpl constructor. We need to review this - JD 2016-09-14 if (atom.getCoordsAsPoint3d() != null){ // we have got coordinates! setPDBFlag(true); } if (atomNameLookup != null){ Atom existingAtom = atomNameLookup.put(atom.getName(), atom); // if an atom with same name is added to the group that has to be some kind of problem, // we need to warn properly if (existingAtom != null) { String altLocStr = ""; char altLoc = atom.getAltLoc(); if (altLoc != ' ') altLocStr = "(alt loc '" + altLoc + "')"; logger.warn("An atom with name " + atom.getName() + " " + altLocStr + " is already present in group: " + this.toString() + ". The atom with serial " + atom.getPDBserial() + " will be ignored in look-ups."); } } };
continue; Point3d coords = atom.getCoordsAsPoint3d(); transformedCoordinate[0] = coords.x; transformedCoordinate[1] = coords.y;
if ( ! m.getChainId().equals(intChainID)) continue; Point3d coords = a.getCoordsAsPoint3d(); transformedCoords[0] = coords.x; transformedCoords[1] = coords.y;
/** * Convert JAMA rotation and translation to a Vecmath transformation matrix. * Because the JAMA matrix is a pre-multiplication matrix and the Vecmath * matrix is a post-multiplication one, the rotation matrix is transposed to * ensure that the transformation they produce is the same. * * @param rot * 3x3 Rotation matrix * @param trans * 3x1 translation vector in Atom coordinates * @return 4x4 transformation matrix */ public static Matrix4d getTransformation(Matrix rot, Atom trans) { return new Matrix4d(new Matrix3d(rot.getColumnPackedCopy()), new Vector3d(trans.getCoordsAsPoint3d()), 1.0); }
pointref[count] = a.getCoordsAsPoint3d(); pointact[count] = pair.getFirst().getAtom(a.getName()).getCoordsAsPoint3d(); count++; for (Atom a : std2.getAtoms()) { if (pair.getSecond().getAtom(a.getName()) == null) return null; pointref[count] = a.getCoordsAsPoint3d(); pointact[count] = pair.getSecond().getAtom(a.getName()).getCoordsAsPoint3d(); count++;