Loading...
Searching...
No Matches
ChargeModel Class Referenceabstract

General API for charge / electrostatics models. More...

`#include <avogadro/calc/chargemodel.h>`

Inheritance diagram for ChargeModel:

## Public Member Functions

virtual ChargeModel * | newInstance () const =0
virtual std::string | identifier () const =0
| A unique identifier, used to retrieve models programmatically. EEM2, NPA, etc. A runtime warning will be generated if the identifier is not unique.
virtual std::string | name () const =0
| A user-visible name of the model (e.g., "Natural Population Analysis").
virtual Core::Molecule::ElementMask | elements () const =0
| Indicate if your method only treats a subset of elements.
virtual void | setDielectric (float dielectric)
virtual float | dielectric () const
virtual MatrixX | partialCharges (Core::Molecule &mol) const =0
virtual MatrixX | partialCharges (const Core::Molecule &mol) const =0
virtual Vector3 | dipoleMoment (const Core::Molecule &mol) const
| Calculate the dipole moment of the molecule.
virtual double | potential (Core::Molecule &mol, const Vector3 &point) const
| Calculate the electrostatic potential at a particular point in space.
virtual Core::Array< double > | potentials (Core::Molecule &mol, const Core::Array< Vector3 > &points) const
| Calculate the electrostatic potential at multiple points.

## Protected Member Functions

void | appendError (const std::string &errorString, bool newLine=true) const
| Append an error to the error string for the model.

## Detailed Description

Author
  Geoffrey R. Hutchison

This serves as the common base class for electrostatics models. Many use atomic point charges, but we also allow for custom models for Slater / Gaussian distributions, distributed electrostatics, use of quantum mechanics, etc.

Key methods are to determine either atomic partial charges or electrostatic potentials at particular points in space.

There is a default implementation for the electrostatic potential at points in space, based on the atomic partial charges. If you implement a different mechanism, you should override this method.

## Member Function Documentation

## newInstance()

virtual ChargeModel * newInstance | ( |  | ) | const

pure virtual

Create a new instance of the model. Ownership passes to the caller.

Implemented in DefaultModel.

## identifier()

virtual std::string identifier | ( |  | ) | const

pure virtual

Implemented in DefaultModel.

## name()

virtual std::string name | ( |  | ) | const

pure virtual

Implemented in DefaultModel.

## elements()

virtual Core::Molecule::ElementMask elements | ( |  | ) | const

pure virtual

Returns
  an element mask corresponding to the defined subset

Implemented in DefaultModel.

## setDielectric()

virtual void setDielectric | ( | float | dielectric | ) |

virtual

Set the dielectric constant for the model.

Parameters

  dielectric | constant.

## dielectric()

virtual float dielectric | ( |  | ) | const

virtual

Returns
  The dielectric constant.

## partialCharges()

virtual MatrixX partialCharges | ( | Core::Molecule & | mol | ) | const

pure virtual

Implemented in DefaultModel.

## dipoleMoment()

virtual Vector3 dipoleMoment | ( | const Core::Molecule & | mol | ) | const

virtual

Defaults to using the partial charges and atomic positions to calculate the net dipole moment.

Returns
  The dipole moment vector of the molecule

## potential()

virtual double potential | ( | Core::Molecule & | mol,
|  | const Vector3 & | point ) const

virtual

Parameters

  mol | The molecule to calculate the potential for.
  point | The point in space to calculate the potential at.

Returns
  The electrostatic potential at the point.

## potentials()

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

virtual

Parameters

  mol | The molecule to calculate the potential for.
  points | The points in space to calculate the potential at.

Returns
  The electrostatic potential at the points in an array.

This method is used for batch calculation and defaults to simply calculating each point at a time. Some methods work faster in batches.

## appendError()

void appendError | ( | const std::string & | errorString,
|  | bool | newLine = true ) const

protected

Parameters

  errorString | The error to be added.
  newLine | Add a new line after the error string?

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

- chargemodel.h