From: <ha...@us...> - 2006-08-30 23:20:39
|
Revision: 5455 http://svn.sourceforge.net/jmol/?rev=5455&view=rev Author: hansonr Date: 2006-08-30 16:20:15 -0700 (Wed, 30 Aug 2006) Log Message: ----------- 10.9.50 11.0 beta hydrogen bonding update modifying hydrogen bond routine to more appropriately represent hydrogen bonds. Modified Paths: -------------- branches/v10_9/Jmol/src/org/jmol/viewer/AminoPolymer.java Modified: branches/v10_9/Jmol/src/org/jmol/viewer/AminoPolymer.java =================================================================== --- branches/v10_9/Jmol/src/org/jmol/viewer/AminoPolymer.java 2006-08-30 21:12:12 UTC (rev 5454) +++ branches/v10_9/Jmol/src/org/jmol/viewer/AminoPolymer.java 2006-08-30 23:20:15 UTC (rev 5455) @@ -47,15 +47,16 @@ boolean hbondsAlreadyCalculated; - final static boolean debugHbonds = false; + boolean debugHbonds; void calcHydrogenBonds(BitSet bsA, BitSet bsB) { + debugHbonds = Logger.isActiveLevel(Logger.LEVEL_DEBUG); initializeHbondDataStructures(); //Frame frame = model.mmset.frame; //hbondMax2 = frame.hbondMax * frame.hbondMax; calcProteinMainchainHydrogenBonds(bsA, bsB); - if (debugHbonds) { + if (false && debugHbonds) { Logger.debug("calcHydrogenBonds"); for (int i = 0; i < monomerCount; ++i) { Logger.debug(" min1Indexes=" + min1Indexes[i] + @@ -115,13 +116,11 @@ } -// private float hbondMax2; - private final static float maxHbondAlphaDistance = 9; private final static float maxHbondAlphaDistance2 = maxHbondAlphaDistance * maxHbondAlphaDistance; private final static float minimumHbondDistance2 = 0.5f; // note: RasMol is 1/2 this. RMH - private final static double QConst = -332 * 0.42 * 0.2 * 1000; + private final static double QConst = -332 * 0.42 * 0.2 * 1000; void bondAminoHydrogen(int indexDonor, Point3f hydrogenPoint, BitSet bsA, BitSet bsB) { @@ -140,9 +139,7 @@ float dist2 = sourceAlphaPoint.distanceSquared(targetAlphaPoint); if (dist2 > maxHbondAlphaDistance2) continue; - int energy = calcHbondEnergy(sourceNitrogenPoint, hydrogenPoint, target); - if (debugHbonds) - Logger.debug("HbondEnergy=" + energy + " dist2="+dist2+" max^2="+maxHbondAlphaDistance2); + int energy = calcHbondEnergy(source.getNitrogenAtom(), sourceNitrogenPoint, hydrogenPoint, target); if (energy < energyMin1) { energyMin2 = energyMin1; indexMin2 = indexMin1; @@ -166,61 +163,60 @@ } } - int calcHbondEnergy(Point3f nitrogenPoint, Point3f hydrogenPoint, - AminoMonomer target) { + int hPtr = 0; + int calcHbondEnergy(Atom nitrogen, Point3f nitrogenPoint, + Point3f hydrogenPoint, AminoMonomer target) { Point3f targetOxygenPoint = target.getCarbonylOxygenAtomPoint(); + /* + * the following were changed from "return -9900" to "return 0" + * Bob Hanson 8/30/06 + */ float distON2 = targetOxygenPoint.distanceSquared(nitrogenPoint); if (distON2 < minimumHbondDistance2) - return -9900; + return 0; - //why would this not have been in here? RMH 03/8/06 - // if (distON2 > hbondMax2) - // return 0; - //nevermind! :) - - if (debugHbonds) - Logger.debug("calchbondenergy: "+hydrogenPoint.x+","+hydrogenPoint.y+","+hydrogenPoint.z); - float distOH2 = targetOxygenPoint.distanceSquared(hydrogenPoint); if (distOH2 < minimumHbondDistance2) - return -9900; + return 0; Point3f targetCarbonPoint = target.getCarbonylCarbonAtomPoint(); float distCH2 = targetCarbonPoint.distanceSquared(hydrogenPoint); if (distCH2 < minimumHbondDistance2) - return -9900; + return 0; float distCN2 = targetCarbonPoint.distanceSquared(nitrogenPoint); if (distCN2 < minimumHbondDistance2) - return -9900; - + return 0; + + /* + * I'm adding these two because they just makes sense -- Bob Hanson + */ + double distOH = Math.sqrt(distOH2); double distCH = Math.sqrt(distCH2); double distCN = Math.sqrt(distCN2); double distON = Math.sqrt(distON2); - int energy = - (int)((QConst/distOH - QConst/distCH + QConst/distCN - QConst/distON)); + int energy = (int) ((QConst / distOH - QConst / distCH + QConst / distCN - QConst + / distON)); + boolean isHbond = (distCN2 > distCH2 && distOH <= 3.0f && energy <= -500); if (debugHbonds) - Logger.debug(" distOH=" + distOH + - " distCH=" + distCH + - " distCN=" + distCN + - " distON=" + distON + - " energy=" + energy); - if (energy < -9900) - return -9900; - if (energy > -500) - return 0; - return energy; + Logger.debug("draw calcHydrogen"+(++hPtr)+ " ("+nitrogen.getInfo()+") {" + hydrogenPoint.x + " " + + hydrogenPoint.y + " " + hydrogenPoint.z + "} #" + isHbond + " " + + nitrogen.getInfo() + " " + target.getLeadAtom().getInfo() + + " distOH=" + distOH + " distCH=" + distCH + " distCN=" + distCN + + " distON=" + distON + " energy=" + energy); + + return (!isHbond ? 0 : energy < -9900 ? -9900 : energy); } void createResidueHydrogenBond(int indexAminoGroup, int indexCarbonylGroup, BitSet bsA, BitSet bsB) { short order; int aminoBackboneHbondOffset = indexAminoGroup - indexCarbonylGroup; - if (debugHbonds) + if (false && debugHbonds) Logger.debug("aminoBackboneHbondOffset=" + aminoBackboneHbondOffset + " amino:" + @@ -249,9 +245,6 @@ default: order = JmolConstants.BOND_H_REGULAR; } - if (debugHbonds) - Logger.debug("createResidueHydrogenBond(" + indexAminoGroup + - "," + indexCarbonylGroup); AminoMonomer donor = (AminoMonomer)monomers[indexAminoGroup]; Atom nitrogen = donor.getNitrogenAtom(); AminoMonomer recipient = (AminoMonomer)monomers[indexCarbonylGroup]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |