From: <ha...@us...> - 2012-05-14 22:39:02
|
Revision: 17129 http://jmol.svn.sourceforge.net/jmol/?rev=17129&view=rev Author: hansonr Date: 2012-05-14 22:38:55 +0000 (Mon, 14 May 2012) Log Message: ----------- MMFF -- preliminary parameter setting only for -- all except electrostatic now set forceField "MMFF" minimize energy Modified Paths: -------------- trunk/Jmol/src/org/jmol/minimize/MinAngle.java trunk/Jmol/src/org/jmol/minimize/forcefield/Calculations.java trunk/Jmol/src/org/jmol/minimize/forcefield/CalculationsMMFF.java trunk/Jmol/src/org/jmol/minimize/forcefield/ForceFieldMMFF.java Modified: trunk/Jmol/src/org/jmol/minimize/MinAngle.java =================================================================== --- trunk/Jmol/src/org/jmol/minimize/MinAngle.java 2012-05-14 15:19:52 UTC (rev 17128) +++ trunk/Jmol/src/org/jmol/minimize/MinAngle.java 2012-05-14 22:38:55 UTC (rev 17129) @@ -4,6 +4,6 @@ public int sbType; public Integer sbKey; MinAngle(int[] data) { - this.data = data; + this.data = data; // ia, ib, ic, iab, ibc } } Modified: trunk/Jmol/src/org/jmol/minimize/forcefield/Calculations.java =================================================================== --- trunk/Jmol/src/org/jmol/minimize/forcefield/Calculations.java 2012-05-14 15:19:52 UTC (rev 17128) +++ trunk/Jmol/src/org/jmol/minimize/forcefield/Calculations.java 2012-05-14 22:38:55 UTC (rev 17129) @@ -125,6 +125,7 @@ } void appendLogData(String s) { + System.out.println("calcultions LOG: " + s); logData.append(s).append("\n"); } @@ -447,6 +448,12 @@ +" ATOMS ATOM TYPES VALENCE IDEAL FORCE\n" +" I J K I J K ANGLE ANGLE CONSTANT ENERGY\n" +"--------------------------------------------------------------------------"; + case CALC_STRETCH_BEND: + return + "\nS T R E T C H B E N D I N G (" + (minAngles.length * 2) + " angles)\n\n" + +" ATOMS ATOM TYPES VALENCE IDEAL FORCE\n" + +" I J K I J K ANGLE ANGLE CONSTANT ENERGY\n" + +"--------------------------------------------------------------------------"; case CALC_TORSION: return "\nT O R S I O N A L (" + minTorsions.length + " torsions)\n\n" @@ -486,6 +493,7 @@ (float)c.delta, (float)c.energy }, new int[] { minAtoms[c.ia].atom.getAtomNumber(), minAtoms[c.ib].atom.getAtomNumber() }}); case CALC_ANGLE: + case CALC_STRETCH_BEND: return TextFormat.sprintf( "%3d %3d %3d %-5s %-5s %-5s %8.3f %8.3f %8.3f %8.3f", new Object[] { minAtoms[c.ia].sType, minAtoms[c.ib].sType, @@ -611,7 +619,7 @@ c.rab = 1.0e-3; } - private void setCoords(Calculation c, int n) { + void setCoords(Calculation c, int n) { switch(n) { case 4: da.set(minAtoms[c.ia].coord); Modified: trunk/Jmol/src/org/jmol/minimize/forcefield/CalculationsMMFF.java =================================================================== --- trunk/Jmol/src/org/jmol/minimize/forcefield/CalculationsMMFF.java 2012-05-14 15:19:52 UTC (rev 17128) +++ trunk/Jmol/src/org/jmol/minimize/forcefield/CalculationsMMFF.java 2012-05-14 22:38:55 UTC (rev 17129) @@ -294,12 +294,53 @@ class SBCalc extends Calculation { - // TODO void setData(List<Object[]> calc, MinAngle angle) { + // not applicable for linear types + switch (minAtoms[angle.data[1]].ffType) { + case 4: + case 53: + case 61: + return; + } + double[] data = (double[]) getParameter(angle.sbKey); + double[] datakat0 = (double[]) getParameter(angle.key); + double[] dataij = (double[]) getParameter(minBonds[angle.data[3]].key); + double[] datajk = (double[]) getParameter(minBonds[angle.data[4]].key); + if (data == null || datakat0 == null || dataij == null || datajk == null) + return; + double theta0 = datakat0[1]; + double r0ij = dataij[1]; + double r0jk = datajk[1]; + calc.add(new Object[] { angle.data, new double[] { data[0], theta0, r0ij } }); + calc.add(new Object[] { new int[] {angle.data[2], angle.data[1], angle.data[0]}, + new double[] { data[1], theta0, r0jk } }); } @Override double compute(Object[] dataIn) { + getPointers(dataIn); + double k = 2.51210 * dData[0]; + double t0 = dData[1]; + double r0_ab = dData[2]; + + setBondVariables(this); + setAngleVariables(this); + double dr_ab = rab - r0_ab; + delta = theta * RAD_TO_DEG - t0; + // equation 5 + energy = k * dr_ab * delta; + + if (logging) + appendLogData(getDebugLine(CALC_STRETCH_BEND, this)); + + if (gradients) { + dE = k * dr_ab; + addForces(this, 3); + setBondVariables(this); + dE = k * delta; + addForces(this, 2); + } + return energy; } } @@ -412,18 +453,19 @@ double[] dataB = (double[]) getParameter(b.vdwKey); if (dataA == null || dataB == null) return; + double alpha_a = dataA[0]; double N_a = dataA[1]; double A_a = dataA[2]; double G_a = dataA[3]; - int DA_a = (int) dataA[4]; + int DA_a = (int) dataA[4]; + double alpha_b = dataB[0]; double N_b = dataB[1]; double A_b = dataB[2]; double G_b = dataB[3]; int DA_b = (int) dataB[4]; - double rs_aa = A_a * Math.pow(alpha_a, 0.25); double rs_bb = A_b * Math.pow(alpha_b, 0.25); double gamma = (rs_aa - rs_bb) / (rs_aa + rs_bb); Modified: trunk/Jmol/src/org/jmol/minimize/forcefield/ForceFieldMMFF.java =================================================================== --- trunk/Jmol/src/org/jmol/minimize/forcefield/ForceFieldMMFF.java 2012-05-14 15:19:52 UTC (rev 17128) +++ trunk/Jmol/src/org/jmol/minimize/forcefield/ForceFieldMMFF.java 2012-05-14 22:38:55 UTC (rev 17129) @@ -50,8 +50,8 @@ public class ForceFieldMMFF extends ForceField { - private static final int A4_SB = 1; - private static final int A4_SBDEF = 2; + private static final int A4_SB = 125; + private static final int A4_SBDEF = 126; private static final int A4_VDW = 3; private static final int A4_CHRG = 4; private static final int KEY_VDW = 0; @@ -72,7 +72,6 @@ return rawMMFF94Charges; } - /* * from SMARTS search when calculating partial charges: * @@ -681,7 +680,7 @@ private int getRowFor(int i) { int elemno = minAtoms[i].atom.getElementNumber(); - return (elemno < 3 ? 1 : elemno < 11 ? 2 : elemno < 19 ? 3 : 4); + return (elemno < 3 ? 0 : elemno < 11 ? 1 : elemno < 19 ? 2 : elemno < 37 ? 3 : 4); } private static Object getFFParams(Integer key) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |