Skip to content

Commit

Permalink
Allow ions for all Open Babel force fields and radicals for UFF
Browse files Browse the repository at this point in the history
Should ensure there's always something better than Lennard-Jones

Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Dec 27, 2024
1 parent b6365a9 commit 703dc57
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions avogadro/qtplugins/forcefield/obenergy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ OBEnergy::OBEnergy(const std::string& method)

OBEnergy::~OBEnergy() {}

bool OBEnergy::acceptsRadicals() const
{
if (m_identifier == "UFF")
return true;

return false;
}

Calc::EnergyCalculator* OBEnergy::newInstance() const
{
return new OBEnergy(m_name);
Expand Down
4 changes: 4 additions & 0 deletions avogadro/qtplugins/forcefield/obenergy.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ class OBEnergy : public Avogadro::Calc::EnergyCalculator
// gradient (which may be unsupported and fall back to numeric)
void gradient(const Eigen::VectorXd& x, Eigen::VectorXd& grad) override;

bool acceptsIons() const override { return true; }
// UFF can handle radicals
bool acceptsRadicals() const override;

private:
class Private;

Expand Down
9 changes: 9 additions & 0 deletions avogadro/qtplugins/forcefield/obmmenergy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ OBMMEnergy::~OBMMEnergy()
delete m_process;
}

bool OBMMEnergy::acceptsRadicals() const
{
// UFF will figure something out
if (m_identifier == "UFF")
return true;

return false;
}

QByteArray OBMMEnergy::writeAndRead(const QByteArray& input)
{
if (m_process == nullptr)
Expand Down
4 changes: 4 additions & 0 deletions avogadro/qtplugins/forcefield/obmmenergy.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class OBMMEnergy : public Avogadro::Calc::EnergyCalculator
// gradient (which may be unsupported and fall back to numeric)
void gradient(const Eigen::VectorXd& x, Eigen::VectorXd& grad) override;

bool acceptsIons() const override { return true; }
// UFF can handle radicals
bool acceptsRadicals() const override;

/**
* @brief Synchronous use of the QProcess.
*/
Expand Down

1 comment on commit 703dc57

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ERROR: clang-format-diff detected formatting issues. See the artifact for a patch or run clang-format on your branch.

Please sign in to comment.