private void checkAddHBond(int i, int j) { SecStrucGroup one = groups[i]; SecStrucGroup two = groups[j]; if (!two.hasAtom("H")) { System.err.println("two has no H " + j); return; } if (one.getPDBName().equals("PRO")) { if (debug) System.out.println(" ignore: PRO " + one.getPDBCode()); return; } double energy = 0; try { energy = calculateHBondEnergy(one, two); } catch (Exception e) { e.printStackTrace(); return; } // System.out.println(" " + energy); trackHBondEnergy(i, j, energy); }
/** * calculate HBond energy of two groups in cal/mol ... see Creighton page 147 f * * <p>Jeffrey, George A., An introduction to hydrogen bonding, Oxford University Press, 1997. * categorizes hbonds with donor-acceptor distances of 2.2-2.5 å as "strong, mostly * covalent", 2.5-3.2 å as "moderate, mostly electrostatic", 3.2-4.0 å as "weak, * electrostatic". Energies are given as 40-14, 15-4, and <4 kcal/mol respectively. */ public double calculateHBondEnergy(SecStrucGroup one, SecStrucGroup two) throws StructureException { // System.out.println("calcHBondEnergy" + one + "|" + two); Atom N = one.getN(); Atom H = one.getH(); Atom O = two.getO(); Atom C = two.getC(); double dno = Calc.getDistance(O, N); double dhc = Calc.getDistance(C, H); double dho = Calc.getDistance(O, H); double dnc = Calc.getDistance(C, N); if (debug) { System.out.println( " cccc: " + one.getPDBCode() + " " + one.getPDBName() + " " + two.getPDBCode() + " " + two.getPDBName() + String.format( " O (" + O.getPDBserial() + ")..N (" + N.getPDBserial() + "):%4.1f | ho:%4.1f - hc:%4.1f + nc:%4.1f - no:%4.1f ", dno, dho, dhc, dnc, dno)); } // System.out.println( cn > ch && oh < 3.0f); double contact = MINDIST; // there seems to be a contact! if ((dno < contact) || (dhc < contact) || (dnc < contact) || (dno < contact)) { // System.out.println("!!! contact " + one + " " + two); return HBONDLOWENERGY; } double e1 = Q / dho - Q / dhc; double e2 = Q / dnc - Q / dno; double energy = e1 + e2; if (debug) System.out.println( String.format( " N (%d) O(%d): %4.1f : %4.2f ", N.getPDBserial(), O.getPDBserial(), (float) dno, energy)); // bond too weak if (energy > HBONDHIGHENERGY) return 0; // test to avoid bond too strong if (energy > HBONDLOWENERGY) return energy; return HBONDLOWENERGY; }