Skip to content

Commit

Permalink
Merge pull request OpenChemistry#1845 from ghutchis/fixup-script-ener…
Browse files Browse the repository at this point in the history
…gies

Fix script energies
  • Loading branch information
ghutchis authored Dec 20, 2024
2 parents 33bce45 + 7921a2e commit 04d14b6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions avogadro/calc/lennardjones.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class AVOGADROCALC_EXPORT LennardJones : public EnergyCalculator
return "Universal Lennard-Jones potential";
}

bool acceptsIons() const override { return true; }
bool acceptsRadicals() const override { return true; }
bool acceptsUnitCell() const override { return true; }

Core::Molecule::ElementMask elements() const override { return (m_elements); }
Expand Down
4 changes: 3 additions & 1 deletion avogadro/qtplugins/forcefield/scriptenergy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ Real ScriptEnergy::value(const Eigen::VectorXd& x)
QString::number(x[i + 1]).toUtf8() + " " +
QString::number(x[i + 2]).toUtf8() + "\n";
}
// qDebug() << " wrote coords ";
QByteArray result = m_interpreter->asyncWriteAndResponse(input);
// qDebug() << " got result " << result;

// go through lines in result until we see "AvogadroEnergy: "
QStringList lines = QString(result).remove('\r').split('\n');
Expand Down Expand Up @@ -325,7 +327,7 @@ void ScriptEnergy::readMetaData()
m_inputFormat = inputFormatTmp;

// check ions, radicals, unit cells
/*
/* e.g.,
"unitCell": False,
"gradients": True,
"ion": False,
Expand Down
6 changes: 3 additions & 3 deletions avogadro/qtplugins/forcefield/scriptenergy.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ class ScriptEnergy : public Avogadro::Calc::EnergyCalculator

Core::Molecule::ElementMask elements() const override { return m_elements; }
bool supportsGradients() const { return m_gradients; }
bool supportsIons() const { return m_ions; }
bool supportsRadicals() const { return m_radicals; }
bool supportsUnitCells() const { return m_unitCells; }
bool acceptsIons() const override { return m_ions; }
bool acceptsRadicals() const override { return m_radicals; }
bool acceptsUnitCell() const override { return m_unitCells; }

// This will check if the molecule is valid for this script
// and then start the external process
Expand Down

0 comments on commit 04d14b6

Please sign in to comment.