Changeset ad2befa


Ignore:
Timestamp:
Jul 10, 2012, 1:15:51 PM (13 years ago)
Author:
Frederik Heber <heber@…>
Children:
d392067
Parents:
42a775
git-author:
Frederik Heber <heber@…> (07/06/12 19:55:54)
git-committer:
Frederik Heber <heber@…> (07/10/12 13:15:51)
Message:

Extracted performing energy optimization into own function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/bin/mpqc/mpqc.cc

    r42a775 rad2befa  
    890890}
    891891
     892/** Performs the energy optimization.
     893 *
     894 * \param opt optimization object
     895 * \param mole molecular energy object
     896 * \return 0 - not read for frequency calculation, 1 - ready
     897 */
     898int performEnergyOptimization(
     899    Ref<Optimize> &opt,
     900    Ref<MolecularEnergy> &mole
     901    )
     902{
     903  int ready_for_freq = 0;
     904  int result = opt->optimize();
     905  if (result) {
     906    ExEnv::out0() << indent
     907         << "The optimization has converged." << endl << endl;
     908    ExEnv::out0() << indent
     909         << scprintf("Value of the MolecularEnergy: %15.10f",
     910                     mole->energy())
     911         << endl << endl;
     912    ready_for_freq = 1;
     913  } else {
     914    ExEnv::out0() << indent
     915         << "The optimization has NOT converged." << endl << endl;
     916    ready_for_freq = 0;
     917  }
     918  return ready_for_freq;
     919}
     920
    892921int
    893922try_main(int argc, char *argv[])
     
    11121141
    11131142    if (do_opt && opt.nonnull() && mole->gradient_implemented()) {
    1114       int result = opt->optimize();
    1115       if (result) {
    1116         ExEnv::out0() << indent
    1117              << "The optimization has converged." << endl << endl;
    1118         ExEnv::out0() << indent
    1119              << scprintf("Value of the MolecularEnergy: %15.10f",
    1120                          mole->energy())
    1121              << endl << endl;
    1122       } else {
    1123         ExEnv::out0() << indent
    1124              << "The optimization has NOT converged." << endl << endl;
    1125         ready_for_freq = 0;
    1126       }
     1143
     1144      ready_for_freq = performEnergyOptimization(opt, mole);
     1145
    11271146    } else if (do_grad && mole->gradient_implemented()) {
    11281147      mole->do_gradient(1);
Note: See TracChangeset for help on using the changeset viewer.