AvogadroLibs 1.100.0
Loading...
Searching...
No Matches
EnergyManager Class Reference

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)
EnergyCalculatormodel (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 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 EnergyManagerinstance ()
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.

Detailed Description

<avogadro/calc/energymanager.h>

Author
Geoffrey R. Hutchison

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.

Member Function Documentation

◆ instance()

EnergyManager & instance ( )
static

Get the singleton instance of the energy manager. This instance should not be deleted.

◆ registerModel()

bool registerModel ( EnergyCalculator * model)
static
Parameters
modelAn instance of the calculator to manage, the manager assumes ownership of the object passed in.
Returns
True on success, false on failure.

◆ unregisterModel()

bool unregisterModel ( const std::string & identifier)
static
Parameters
identifierThe identifier for the model to remove.
Returns
True on success, false on failure.

◆ addModel()

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.

Returns
True on success, false on failure.

◆ removeModel()

bool removeModel ( const std::string & identifier)

Remove the model with the identifier identifier from the manager.

Returns
True on success, false on failure.

◆ model()

EnergyCalculator * model ( const std::string & identifier) const

New instance of the model for the specified identifier. Ownership is passed to the caller.

Parameters
identifierThe unique identifier of the model.
Returns
Instance of the model, nullptr if not found. Ownership passes to the caller.

◆ identifiers()

std::set< std::string > identifiers ( ) const

Get a list of all loaded identifiers

◆ identifiersForMolecule()

std::set< std::string > identifiersForMolecule ( const Core::Molecule & molecule) const

This is probably the method you want to get a list for a user

◆ nameForModel()

std::string nameForModel ( const std::string & identifier) const

The name is a user-visible string, and may be translated.

Parameters
identifierThe unique identifier of the model.
Returns
The name of the model, or an empty string if not found.

◆ error()

std::string error ( ) const

Get any errors that have been logged when loading models.


The documentation for this class was generated from the following file: