📄 electrostaticinteractions.java
字号:
*@return MMFF94 Electrostatic interaction gradient value. */ public GVector getGradientMMFF94SumEQ() { return gradientMMFF94SumEQ; } /** * Evaluate a 2nd order error approximation of the gradient, for the Electrostatic interaction term, given the atoms * coordinates * *@param coord3d Current molecule coordinates. *//* public void set2ndOrderErrorApproximateGradientMMFF94SumEQ(GVector coord3d) { order2ndErrorApproximateGradientMMFF94SumEQ = new GVector(coord3d.getSize()); double sigma = Math.pow(0.000000000000001,0.33); GVector xplusSigma = new GVector(coord3d.getSize()); GVector xminusSigma = new GVector(coord3d.getSize()); for (int m = 0; m < order2ndErrorApproximateGradientMMFF94SumEQ.getSize(); m++) { xplusSigma.set(coord3d); xplusSigma.setElement(m,coord3d.getElement(m) + sigma); xminusSigma.set(coord3d); xminusSigma.setElement(m,coord3d.getElement(m) - sigma); order2ndErrorApproximateGradientMMFF94SumEQ.setElement(m,(functionMMFF94SumEQ(xplusSigma) - functionMMFF94SumEQ(xminusSigma)) / (2 * sigma)); } //logger.debug("order2ndErrorApproximateGradientMMFF94SumEQ : " + order2ndErrorApproximateGradientMMFF94SumEQ); }*/ /** * Get the 2nd order error approximate gradient for the Electrostatic interaction term. * * *@return Electrostatic interaction 2nd order error approximate gradient value *//* public GVector get2ndOrderErrorApproximateGradientMMFF94SumEQ() { return order2ndErrorApproximateGradientMMFF94SumEQ; }*/ /** * Evaluate a 5th order error approximation of the gradient, for the Electrostatic interaction term, given the atoms * coordinates * *@param coords3d Current molecule coordinates. *//* public void set5thOrderErrorApproximateGradientMMFF94SumEQ(GVector coord3d) { order5thErrorApproximateGradientMMFF94SumEQ = new GVector(coord3d.getSize()); double sigma = Math.pow(0.000000000000001,0.2); GVector xplusSigma = new GVector(coord3d.getSize()); GVector xminusSigma = new GVector(coord3d.getSize()); GVector xplus2Sigma = new GVector(coord3d.getSize()); GVector xminus2Sigma = new GVector(coord3d.getSize()); for (int m=0; m < order5thErrorApproximateGradientMMFF94SumEQ.getSize(); m++) { xplusSigma.set(coord3d); xplusSigma.setElement(m,coord3d.getElement(m) + sigma); xminusSigma.set(coord3d); xminusSigma.setElement(m,coord3d.getElement(m) - sigma); xplus2Sigma.set(coord3d); xplus2Sigma.setElement(m,coord3d.getElement(m) + 2 * sigma); xminus2Sigma.set(coord3d); xminus2Sigma.setElement(m,coord3d.getElement(m) - 2 * sigma); order5thErrorApproximateGradientMMFF94SumEQ.setElement(m, (8 * (functionMMFF94SumEQ(xplusSigma) - functionMMFF94SumEQ(xminusSigma)) - (functionMMFF94SumEQ(xplus2Sigma) - functionMMFF94SumEQ(xminus2Sigma))) / (12 * sigma)); } //logger.debug("order5thErrorApproximateGradientMMFF94SumEQ : " + order5thErrorApproximateGradientMMFF94SumEQ); }*/ /** * Get the 5th order error approximate gradient for the Electrostatic interaction term. * *@return Electrostatic interaction 5th order error approximate gradient value. *//* public GVector get5OrderApproximateGradientMMFF94SumEQ() { return order5thErrorApproximateGradientMMFF94SumEQ; }*/ /** * Calculate the internuclear separation second derivative respect to the cartesian coordinates of the atoms. * *@param coord3d Current molecule coordinates. */ public void setInternuclearSeparationSecondDerivative(GVector coord3d) { ddR = new double[coord3d.getSize()][][]; Double forAtomNumber = null; int atomNumberi; int atomNumberj; int coordinatei; int coordinatej; double ddR1=0; // ddR[i][j][k] = ddR1 - ddR2 double ddR2=0; setInternuclearSeparationFirstOrderDerivative(coord3d); for (int i=0; i<coord3d.getSize(); i++) { ddR[i] = new double[coord3d.getSize()][]; forAtomNumber = new Double(i/3); atomNumberi = forAtomNumber.intValue(); //logger.debug("atomNumberi = " + atomNumberi); coordinatei = i % 3; //logger.debug("coordinatei = " + coordinatei); for (int j=0; j<coord3d.getSize(); j++) { ddR[i][j] = new double[electrostaticInteractionNumber]; forAtomNumber = new Double(j/3); atomNumberj = forAtomNumber.intValue(); //logger.debug("atomNumberj = " + atomNumberj); coordinatej = j % 3; //logger.debug("coordinatej = " + coordinatej); //logger.debug("atomj : " + molecule.getAtomAt(atomNumberj)); for (int k=0; k < electrostaticInteractionNumber; k++) { if ((electrostaticInteractionAtomPosition[k][0] == atomNumberj) | (electrostaticInteractionAtomPosition[k][1] == atomNumberj)) { if ((electrostaticInteractionAtomPosition[k][0] == atomNumberi) | (electrostaticInteractionAtomPosition[k][1] == atomNumberi)) { // ddR1 if (electrostaticInteractionAtomPosition[k][0] == atomNumberj) { ddR1 = 1; } if (electrostaticInteractionAtomPosition[k][1] == atomNumberj) { ddR1 = -1; } if (electrostaticInteractionAtomPosition[k][0] == atomNumberi) { ddR1 = ddR1 * 1; } if (electrostaticInteractionAtomPosition[k][1] == atomNumberi) { ddR1 = ddR1 * (-1); } ddR1 = ddR1 / r[k]; // ddR2 switch (coordinatej) { case 0: ddR2 = (coord3d.getElement(3 * electrostaticInteractionAtomPosition[k][0]) - coord3d.getElement(3 * electrostaticInteractionAtomPosition[k][1])); //logger.debug("OK: d1 x"); break; case 1: ddR2 = (coord3d.getElement(3 * electrostaticInteractionAtomPosition[k][0] + 1) - coord3d.getElement(3 * electrostaticInteractionAtomPosition[k][1] + 1)); //logger.debug("OK: d1 y"); break; case 2: ddR2 = (coord3d.getElement(3 * electrostaticInteractionAtomPosition[k][0] + 2) - coord3d.getElement(3 * electrostaticInteractionAtomPosition[k][1] + 2)); //logger.debug("OK: d1 z"); break; } if (electrostaticInteractionAtomPosition[k][1] == atomNumberj) { ddR2 = (-1) * ddR2; //logger.debug("OK: bond 1"); } switch (coordinatei) { case 0: ddR2 = ddR2 * (coord3d.getElement(3 * electrostaticInteractionAtomPosition[k][0]) - coord3d.getElement(3 * electrostaticInteractionAtomPosition[k][1])); //logger.debug("OK: have d2 x"); break; case 1: ddR2 = ddR2 * (coord3d.getElement(3 * electrostaticInteractionAtomPosition[k][0] + 1) - coord3d.getElement(3 * electrostaticInteractionAtomPosition[k][1] + 1)); //logger.debug("OK: have d2 y"); break; case 2: ddR2 = ddR2 * (coord3d.getElement(3 * electrostaticInteractionAtomPosition[k][0] + 2) - coord3d.getElement(3 * electrostaticInteractionAtomPosition[k][1] + 2)); //logger.debug("OK: have d2 z"); break; } if (electrostaticInteractionAtomPosition[k][1] == atomNumberi) { ddR2 = (-1) * ddR2; //logger.debug("OK: d2 bond 1"); } ddR2 = ddR2 / Math.pow(r[k],2); // ddR[i][j][k] ddR[i][j][k] = ddR1 - ddR2; } else { ddR[i][j][k] = 0; //logger.debug("OK: 0"); } } else { ddR[i][j][k] = 0; //logger.debug("OK: 0"); } //logger.debug("Electrostatic interactionn " + k + " : " + "ddR[" + i + "][" + j + "][" + k + "] = " + ddR[i][j][k]); } } } } /** * Get the internuclear separation second derivative respect to the cartesian coordinates of the atoms. * *@return Bond lengths second derivative value [dimension(3xN)] [bonds Number] */ public double[][][] getInternuclearSeparationSecondDerivative() { return ddR; } /** * Evaluate the second order partial derivative (hessian) for the Electrostatic interaction energy given the atoms coordinates * *@param coord3d Current molecule coordinates. */ public void setHessianMMFF94SumEQ(GVector coord3d) { forHessian = new double[coord3d.getSize() * coord3d.getSize()]; setInternuclearSeparationSecondDerivative(coord3d); double sumHessianEQ; int forHessianIndex; for (int i = 0; i < coord3d.getSize(); i++) { for (int j = 0; j < coord3d.getSize(); j++) { sumHessianEQ = 0; for (int k = 0; k < electrostaticInteractionNumber; k++) { sumHessianEQ = sumHessianEQ + (((332.0716 * qi[k] * qj[k] * n * (n+1) / D*Math.pow(r[k]+delta,n+2)) * dR[i][k]) * dR[j][k] + (-332.0716 * qi[k] * qj[k] * n / D * Math.pow(r[k]+delta,n+1)) * ddR[i][j][k]); } forHessianIndex = i*coord3d.getSize()+j; forHessian[forHessianIndex] = sumHessianEQ; //logger.debug("forHessian[forHessianIndex] : " + forHessian[forHessianIndex]); } } hessianMMFF94SumEQ = new GMatrix(coord3d.getSize(), coord3d.getSize(), forHessian); //logger.debug("hessianMMFF94SumEQ : " + hessianMMFF94SumEQ); } /** * Get the hessian for the Electrostatic interaction energy. * *@return Hessian value of the Electrostatic interaction term. */ public GMatrix getHessianMMFF94SumEQ() { return hessianMMFF94SumEQ; } /** * Get the hessian for the Electrostatic interaction energy. * *@return Hessian value of the Electrostatic interaction term. */ public double[] getForHessianMMFF94SumEQ() { return forHessian; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -