List of usage examples for org.apache.commons.math3.optimization PointVectorValuePair getPoint
public double[] getPoint()
From source file:ffx.potential.nonbonded.ParticleMeshEwald.java
/** * The least-squares predictor with induced dipole information from 8-10 * previous steps reduces the number SCF iterations by ~50%. *//*from w w w.j ava2 s. com*/ private void leastSquaresPredictor() { if (predictorCount < 2) { return; } try { /** * The Jacobian and target do not change during the LS optimization, * so it's most efficient to update them once before the * Least-Squares optimizer starts. */ leastSquaresPredictor.updateJacobianAndTarget(); int maxEvals = 100; fill(leastSquaresPredictor.initialSolution, 0.0); leastSquaresPredictor.initialSolution[0] = 1.0; PointVectorValuePair optimum = leastSquaresOptimizer.optimize(maxEvals, leastSquaresPredictor, leastSquaresPredictor.calculateTarget(), leastSquaresPredictor.weights, leastSquaresPredictor.initialSolution); double[] optimalValues = optimum.getPoint(); if (logger.isLoggable(Level.FINEST)) { logger.finest(String.format("\n LS RMS: %10.6f", leastSquaresOptimizer.getRMS())); logger.finest(String.format(" LS Iterations: %10d", leastSquaresOptimizer.getEvaluations())); logger.finest( String.format(" Jacobian Evals: %10d", leastSquaresOptimizer.getJacobianEvaluations())); logger.finest(String.format(" Chi Square: %10.6f", leastSquaresOptimizer.getChiSquare())); logger.finest(String.format(" LS Coefficients")); for (int i = 0; i < predictorOrder - 1; i++) { logger.finest(String.format(" %2d %10.6f", i + 1, optimalValues[i])); } } int mode; switch (lambdaMode) { case OFF: case CONDENSED: mode = 0; break; case CONDENSED_NO_LIGAND: mode = 1; break; case VAPOR: mode = 2; break; default: mode = 0; } /** * Initialize a pointer into predictor induced dipole array. */ int index = predictorStartIndex; /** * Apply the LS coefficients in order to provide an initial guess at * the converged induced dipoles. */ for (int k = 0; k < predictorOrder - 1; k++) { /** * Set the current coefficient. */ double c = optimalValues[k]; for (int i = 0; i < nAtoms; i++) { for (int j = 0; j < 3; j++) { inducedDipole[0][i][j] += c * predictorInducedDipole[mode][index][i][j]; inducedDipoleCR[0][i][j] += c * predictorInducedDipoleCR[mode][index][i][j]; } } index++; if (index >= predictorOrder) { index = 0; } } } catch (Exception e) { logger.log(Level.WARNING, " Exception computing predictor coefficients", e); } }