private int getGroupNoHSize() { int count = 0; for (Atom atom:g.getAtoms()) { if (atom.getElement()!=Element.H) count++; } return count; }
/** * Calculates the number of non-Hydrogen atoms in the given group * @param g * @return */ private static int getSizeNoH(Group g) { int size = 0; for (Atom a:g.getAtoms()) { if (a.getElement()!=Element.H) size++; } return size; }
/** * Gets the radius for given nucleotide atom * @param atom * @return */ private static double getRadiusForNucl(NucleotideImpl nuc, Atom atom) { if (atom.getElement().equals(Element.H)) return Element.H.getVDWRadius(); if (atom.getElement().equals(Element.D)) return Element.D.getVDWRadius(); if (atom.getElement()==Element.C) return NUC_CARBON_VDW; if (atom.getElement()==Element.N) return NUC_NITROGEN_VDW; if (atom.getElement()==Element.P) return PHOSPHOROUS_VDW; if (atom.getElement()==Element.O) return OXIGEN_VDW; logger.info("Unexpected atom "+atom.getName()+" for nucleotide "+nuc.getPDBName()+", assigning its standard vdw radius"); return atom.getElement().getVDWRadius(); }
private static String formatAtomName(Atom a) { String fullName = null; String name = a.getName(); Element element = a.getElement(); // RULES FOR ATOM NAME PADDING: 4 columns in total: 13, 14, 15, 16 // if length 4: nothing to do if (name.length()==4) fullName = name; // if length 3: they stay at 14 else if (name.length()==3) fullName = " "+name; // for length 2 it depends: // carbon, oxygens, nitrogens, phosphorous stay at column 14 // elements with 2 letters (e.g. NA, FE) will go to column 13 else if (name.length()==2) { if (element == Element.C || element == Element.N || element == Element.O || element == Element.P || element == Element.S) fullName = " "+name+" "; else fullName = name+" "; } // for length 1 (e.g. K but also C, O) they stay in column 14 else if (name.length()==1) fullName = " "+name+" "; //if (fullName.length()!=4) // logger.warn("Atom name "+fullName+"to be written in PDB format does not have length 4. Formatting will be incorrect"); return fullName; }
private Atom getAtom(String atomId, Group group) { Atom a = group.getAtom(atomId); // Check for deuteration if(a==null && atomId.startsWith("H")) { a = group.getAtom(atomId.replaceFirst("H", "D")); // Check it is actually deuterated if(a!=null){ if(!a.getElement().equals(Element.D)){ a=null; } } } return a; }
/** * Returns an Atom array of the C-alpha atoms. Any atom that is a carbon and * has CA name will be returned. * * @param c * the structure object * @return an Atom[] array * @see #getRepresentativeAtomArray(Chain) */ public static final Atom[] getAtomCAArray(Chain c) { List<Atom> atoms = new ArrayList<Atom>(); for (Group g : c.getAtomGroups()) { if (g.hasAtom(CA_ATOM_NAME) && g.getAtom(CA_ATOM_NAME).getElement() == Element.C) { atoms.add(g.getAtom(CA_ATOM_NAME)); } } return atoms.toArray(new Atom[atoms.size()]); }
private static final Atom[] getAllNonHAtomArray(Structure s, boolean hetAtoms, AtomIterator iter) { List<Atom> atoms = new ArrayList<Atom>(); while (iter.hasNext()) { Atom a = iter.next(); if (a.getElement() == Element.H) continue; Group g = a.getGroup(); if (g.isWater()) continue; if (!hetAtoms && g.getType().equals(GroupType.HETATM)) continue; atoms.add(a); } return atoms.toArray(new Atom[atoms.size()]); }
/** * Check to see if a Hydrogen has a Deuterated brother in the group. * @param atom the input atom that is putatively hydorgen * @param currentGroup the group the atom is in * @return true if the atom is hydrogen and it's Deuterium equiv exists. */ public static boolean hasDeuteratedEquiv(Atom atom, Group currentGroup) { if(atom.getElement()==Element.H && currentGroup.hasAtom(replaceFirstChar(atom.getName(),'H', 'D'))) { // If it's hydrogen and has a deuterated brother return true; } return false; }
/** * Check to see if an Deuterated atom has a non deuterated brother in the group. * @param atom the input atom that is putatively deuterium * @param currentGroup the group the atom is in * @return true if the atom is deuterated and it's hydrogen equive exists. */ public static boolean hasNonDeuteratedEquiv(Atom atom, Group currentGroup) { if(atom.getElement()==Element.D && currentGroup.hasAtom(replaceFirstChar(atom.getName(),'D', 'H'))) { // If it's deuterated and has a non-deuterated brother return true; } return false; }
if ( a1.getElement().isMetal() || a2.getElement().isMetal()){ MetalBondDistance defined = getMetalDistanceCutoff(a1.getElement().name(),a2.getElement().name()); float radiusOfAtom1 = ret[0].getElement().getCovalentRadius(); float radiusOfAtom2 = ret[1].getElement().getCovalentRadius();
/** * Return an Atom array of the C-alpha atoms. Any atom that is a carbon and * has CA name will be returned. * * @param s * the structure object * @return an Atom[] array * @see #getRepresentativeAtomArray(Structure) */ public static Atom[] getAtomCAArray(Structure s) { List<Atom> atoms = new ArrayList<Atom>(); for (Chain c : s.getChains()) { for (Group g : c.getAtomGroups()) { if (g.hasAtom(CA_ATOM_NAME) && g.getAtom(CA_ATOM_NAME).getElement() == Element.C) { atoms.add(g.getAtom(CA_ATOM_NAME)); } } } return atoms.toArray(new Atom[atoms.size()]); }
/** * Returns and array of all non-Hydrogen atoms in the given molecule, including all * main chain HETATOM groups. Non main-chain HETATOM groups with fewer than minSizeHetAtomToInclude * non-Hydrogen atoms are not included. * @param m * @param minSizeHetAtomToInclude HETATOM groups (non main-chain) with fewer number of * non-Hydrogen atoms are not included * @return */ private static final Atom[] getAllNonHAtomArray(Atom[] m, int minSizeHetAtomToInclude) { List<Atom> atoms = new ArrayList<>(); for (Atom a:m){ if (a.getElement()==Element.H) continue; Group g = a.getGroup(); if (g.getType().equals(GroupType.HETATM) && !isInChain(g) && getSizeNoH(g)<minSizeHetAtomToInclude) { continue; } atoms.add(a); } return atoms.toArray(new Atom[atoms.size()]); }
/** * Returns and array of all non-Hydrogen atoms 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 Atom[] getAllNonHAtomArray(Chain c, boolean hetAtoms) { List<Atom> atoms = new ArrayList<Atom>(); 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); } } return atoms.toArray(new Atom[atoms.size()]); }
/** * Constructs a new AsaCalculator. Subsequently call {@link #calculateAsas()} * or {@link #getGroupAsas()} to calculate the ASAs. * @param atoms an array of atoms not containing Hydrogen atoms * @param probe the probe size * @param nSpherePoints the number of points to be used in generating the spherical * dot-density, the more points the more accurate (and slower) calculation * @param nThreads the number of parallel threads to use for the calculation * @throws IllegalArgumentException if any atom in the array is a Hydrogen atom */ public AsaCalculator(Atom[] atoms, double probe, int nSpherePoints, int nThreads) { this.atoms = atoms; this.atomCoords = Calc.atomsToPoints(atoms); this.probe = probe; this.nThreads = nThreads; this.useSpatialHashingForNeighbors = DEFAULT_USE_SPATIAL_HASHING; for (Atom atom:atoms) { if (atom.getElement()==Element.H) throw new IllegalArgumentException("Can't calculate ASA for an array that contains Hydrogen atoms "); } // initialising the radii by looking them up through AtomRadii radii = new double[atoms.length]; for (int i=0;i<atoms.length;i++) { radii[i] = getRadius(atoms[i]); } initSpherePoints(nSpherePoints); }
/** * 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()]); }
String spaceY = getSpace(10, df.format(a.getY())); String spaceZ = getSpace(10, df.format(a.getZ())); String spaceEle = getSpace(4, a.getElement().toString()); atomList.append(spaceX+df.format(a.getX())+spaceY+df.format(a.getY())+spaceZ+df.format(a.getZ())+" "+a.getElement().toString()+spaceEle+"0 0 0 0 0 0 0 0 0 0 0 0\n"); for(Bond b: a.getBonds()){ Atom otherAtom = b.getOther(a);
case AMINOACID: if (g.hasAtom(CA_ATOM_NAME) && g.getAtom(CA_ATOM_NAME).getElement() == Element.C) { atoms.add(g.getAtom(CA_ATOM_NAME));
if (atom.getElement()==null) { logger.warn("Unrecognised atom "+atom.getName()+" with serial "+atom.getPDBserial()+ ", assigning the default vdw radius (Nitrogen vdw radius)."); logger.warn("Unknown parent residue for atom "+atom.getName()+" with serial "+ atom.getPDBserial()+", assigning its default vdw radius"); return atom.getElement().getVDWRadius(); return atom.getElement().getVDWRadius();
/** * Returns the center of mass of the set of atoms. Atomic masses of the * Atoms are used. * * @param points * a set of Atoms * @return an Atom representing the center of mass */ public static Atom centerOfMass(Atom[] points) { Atom center = new AtomImpl(); float totalMass = 0.0f; for (Atom a : points) { float mass = a.getElement().getAtomicMass(); totalMass += mass; center = scaleAdd(mass, a, center); } center = scaleEquals(center, 1.0f/totalMass); return center; }
if ( a.getName().equals(StructureTools.CA_ATOM_NAME) && a.getElement()==Element.C){