Loading...
Searching...
No Matches
ChargeManager Class Reference

Class to manage registration, searching and creation of partial charge models. More...

`#include <chargemanager.h>`

## Public Member Functions

bool | addModel (ChargeModel *model)
bool | removeModel (const std::string &identifier)
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
MatrixX | partialCharges (const std::string &identifier, Core::Molecule &mol) const
MatrixX | partialCharges (const std::string &identifier, const Core::Molecule &mol) const
Vector3 | dipoleMoment (const std::string &identifier, const Core::Molecule &mol) const
double | potential (const std::string &identifier, Core::Molecule &mol, const Vector3 &point) const
Core::Array< double > | potentials (const std::string &identifier, Core::Molecule &mol, const Core::Array< Vector3 > &points) const
std::string | error () const

## Static Public Member Functions

static ChargeManager & | instance ()
static bool | registerModel (ChargeModel *model)
| Register a new charge model with the manager.
static bool | unregisterModel (const std::string &identifier)
| Unregister a charge model from the manager.

## Detailed Description

<avogadro/calc/chargemanager.h>

Author
  Geoffrey R. Hutchison

The charge manager is a singleton class that handles the runtime registration, search, creation and eventual destruction of electrostatics models. It can be used to gain a listing of available models, register new models, etc.

All electrostatics can take place independent of this code, but for automated registration and look up, this is the preferred API. It is possible to use the convenience API without ever dealing directly with a model class.

## Member Function Documentation

## instance()

ChargeManager & instance | ( |  | ) |

static

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

## registerModel()

bool registerModel | ( | ChargeModel * | model | ) |

static

Parameters

  model | An instance of the model 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

  identifier | The identifier for the model to remove.

Returns
  True on success, false on failure.

## addModel()

bool addModel | ( | ChargeModel * | 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.

## 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

Includes partial charge types in the molecule itself (e.g., from a file) This is probably the method you want to get a list for a user

## recommendedModel()

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.

Returns
  The recommended model identifier

## nameForModel()

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

Returns
  the user-visible name of the model with the identifier identifier

## partialCharges() [1/2]

MatrixX partialCharges | ( | const std::string & | identifier,
|  | Core::Molecule & | mol ) const

This method will calculate atomic partial charges and save them, if the model is available (i.e., the molecule will change) Note that some models do not have well-defined atomic partial charges

Returns
  atomic partial charges for the molecule, or 0.0 if undefined

## partialCharges() [2/2]

MatrixX partialCharges | ( | const std::string & | identifier,
|  | const Core::Molecule & | mol ) const

Calculate the atomic partial charges and leave the molecule unchanged. Note that some models do not have well-defined atomic partial charges

Returns
  the dipole moment for the molecule, or 0.0 if undefined

## dipoleMoment()

Vector3 dipoleMoment | ( | const std::string & | identifier,
|  | const Core::Molecule & | mol ) const

Returns
  the dipole moment for the molecule, or 0.0 if the model is not available

## potential()

double potential | ( | const std::string & | identifier,
|  | Core::Molecule & | mol,
|  | const Vector3 & | point ) const

Returns
  the potential at the point for the molecule, or 0.0 if the model is not available

## potentials()

Core::Array< double > potentials | ( | const std::string & | identifier,
|  | Core::Molecule & | mol,
|  | const Core::Array< Vector3 > & | points ) const

Returns
  the potentials at the point for the molecule, or an array of 0.0 if the model is not available

## 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:

- chargemanager.h