|
AvogadroLibs 2.1.0-20261111
|
Class to manage registration, searching and creation of force field (energy) calculators. More...
#include <chargemanager.h>
Public Member Functions | |
| bool | addModel (EnergyCalculator *model) |
| bool | removeModel (const std::string &identifier) |
| EnergyCalculator * | model (const std::string &identifier) const |
| std::set< std::string > | identifiers () const |
| std::set< std::string > | identifiersForMolecule (const Core::Molecule &molecule) const |
| Get a list of models that work for this molecule. | |
| std::string | recommendedModel (const Core::Molecule &molecule) const |
| Get a recommended model for this molecule. | |
| std::string | nameForModel (const std::string &identifier) const |
| Get the name of the model for the specified identifier. | |
| std::string | error () const |
Static Public Member Functions | |
| static EnergyManager & | instance () |
| static bool | registerModel (EnergyCalculator *model) |
| Register a new model with the manager. | |
| static bool | unregisterModel (const std::string &identifier) |
| Unregister a charge model from the manager. | |
<avogadro/calc/energymanager.h>
The energy manager is a singleton class that handles the runtime registration, search, creation and eventual destruction of calculators for geometry optimization and molecular dynamics. It can be used to gain a listing of available models, register new models, etc.
All energy calculation can take place independent of this code, but for automated registration and look up, this is the preferred API.
|
static |
Get the singleton instance of the energy manager. This instance should not be deleted.
|
static |
| model | An instance of the calculator to manage, the manager assumes ownership of the object passed in. |
|
static |
| identifier | The identifier for the model to remove. |
| bool addModel | ( | EnergyCalculator * | model | ) |
Add the supplied model to the manager, registering its ID and other relevant data for later lookup. The manager assumes ownership of the supplied object.
| bool removeModel | ( | const std::string & | identifier | ) |
Remove the model with the identifier identifier from the manager.
| EnergyCalculator * model | ( | const std::string & | identifier | ) | const |
New instance of the model for the specified identifier. Ownership is passed to the caller.
| identifier | The unique identifier of the model. |
| std::set< std::string > identifiers | ( | ) | const |
Get a list of all loaded identifiers
| std::set< std::string > identifiersForMolecule | ( | const Core::Molecule & | molecule | ) | const |
This is probably the method you want to get a list for a user
| std::string recommendedModel | ( | const Core::Molecule & | molecule | ) | const |
This returns the identifier for a model that works, given the charge, unit cell, spin states, etc.
Only the built-in models (GAFF, MMFF94, UFF, LJ) are ever recommended, in that order of preference. Plugin / user-installed models are never auto-selected, even if compatible with the molecule: they typically run as external processes (so can be slow to start and less robust), and when several are installed there is no principled way to rank them against each other, so the user must choose one explicitly.
| std::string nameForModel | ( | const std::string & | identifier | ) | const |
The name is a user-visible string, and may be translated.
| identifier | The unique identifier of the model. |
| std::string error | ( | ) | const |
Get any errors that have been logged when loading models.