diff --git a/avogadro/qtplugins/forcefield/forcefield.cpp b/avogadro/qtplugins/forcefield/forcefield.cpp index d97402e837..4ae132fc9a 100644 --- a/avogadro/qtplugins/forcefield/forcefield.cpp +++ b/avogadro/qtplugins/forcefield/forcefield.cpp @@ -205,7 +205,8 @@ void Forcefield::optimize() bool isInteractive = m_molecule->undoMolecule()->isInteractive(); m_molecule->undoMolecule()->setInteractive(true); - cppoptlib::ConjugatedGradientDescentSolver solver; + cppoptlib::LbfgsSolver solver; + // cppoptlib::ConjugatedGradientDescentSolver solver; int n = m_molecule->atomCount(); diff --git a/avogadro/qtplugins/forcefield/scriptenergy.cpp b/avogadro/qtplugins/forcefield/scriptenergy.cpp index a637f680bc..f7bc5c7e9f 100644 --- a/avogadro/qtplugins/forcefield/scriptenergy.cpp +++ b/avogadro/qtplugins/forcefield/scriptenergy.cpp @@ -125,9 +125,11 @@ Real ScriptEnergy::value(const Eigen::VectorXd& x) double energy = 0.0; for (auto line : lines) { if (line.startsWith("AvogadroEnergy:")) { - QStringList items = line.split(" "); - if (items.size() > 1) + QStringList items = line.split(" ", QString::SkipEmptyParts); + if (items.size() > 1) { energy = items[1].toDouble(); + break; + } } } @@ -163,7 +165,7 @@ void ScriptEnergy::gradient(const Eigen::VectorXd& x, Eigen::VectorXd& grad) } if (readingGrad) { - QStringList items = line.split(" "); + QStringList items = line.split(" ", QString::SkipEmptyParts); if (items.size() == 3) { grad[i] = items[0].toDouble(); grad[i + 1] = items[1].toDouble(); diff --git a/avogadro/qtplugins/forcefield/scripts/gfn1.py b/avogadro/qtplugins/forcefield/scripts/gfn1.py index 14e2e83a07..fdb5a5fb1f 100644 --- a/avogadro/qtplugins/forcefield/scripts/gfn1.py +++ b/avogadro/qtplugins/forcefield/scripts/gfn1.py @@ -64,7 +64,7 @@ def run(filename): while(True): # read new coordinates from stdin for i in range(len(atoms)): - coordinates[i] = np.fromstring(input(), sep=" ") + coordinates[i] = np.fromstring(input()) # .. convert from Angstrom to Bohr coordinates /= 0.52917721067 diff --git a/avogadro/qtplugins/forcefield/scripts/gfn2.py b/avogadro/qtplugins/forcefield/scripts/gfn2.py index 46cd1402c9..7b67c67c7e 100644 --- a/avogadro/qtplugins/forcefield/scripts/gfn2.py +++ b/avogadro/qtplugins/forcefield/scripts/gfn2.py @@ -64,7 +64,7 @@ def run(filename): while(True): # read new coordinates from stdin for i in range(len(atoms)): - coordinates[i] = np.fromstring(input(), sep=" ") + coordinates[i] = np.fromstring(input()) # .. convert from Angstrom to Bohr coordinates /= 0.52917721067 diff --git a/avogadro/qtplugins/forcefield/scripts/gfnff.py b/avogadro/qtplugins/forcefield/scripts/gfnff.py index c487949193..e8f5b1ae73 100644 --- a/avogadro/qtplugins/forcefield/scripts/gfnff.py +++ b/avogadro/qtplugins/forcefield/scripts/gfnff.py @@ -66,7 +66,7 @@ def run(filename): while True: # read new coordinates from stdin for i in range(len(atoms)): - coordinates[i] = np.fromstring(input(), sep=" ") + coordinates[i] = np.fromstring(input()) # .. convert from Angstrom to Bohr coordinates /= 0.52917721067 @@ -80,7 +80,7 @@ def run(filename): # now print the gradient # .. we don't want the "[]" in the output print("AvogadroGradient:") - grad = res.get_gradient() * 496100.475 # convert units + grad = res.get_gradient() * 4961.475 # convert units output = np.array2string(grad) output = output.replace("[", "").replace("]", "") print(output)