Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix script energies #1845

Merged
merged 3 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
QString::number(x[i + 1]).toUtf8() + " " +
QString::number(x[i + 2]).toUtf8() + "\n";
}
// qDebug() << " wrote coords ";

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
QByteArray result = m_interpreter->asyncWriteAndResponse(input);
// qDebug() << " got result " << result;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

// 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 @@
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
Loading