AvogadroLibs 1.98.1
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
ChargeModel Class Referenceabstract

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

#include <avogadro/calc/chargemodel.h>

Inheritance diagram for ChargeModel:
DefaultModel

Public Member Functions

virtual ChargeModelnewInstance () 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 (double dielectric)
 
virtual float dielectric () const
 
virtual MatrixX partialCharges (Core::Molecule &mol) const =0
 
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 ( double  dielectric)
virtual

Set the dielectric constant for the model.

Parameters
dielectricconstant.

◆ dielectric()

virtual float dielectric ( ) const
virtual
Returns
The dielectric constant.

◆ partialCharges()

virtual MatrixX partialCharges ( Core::Molecule mol) const
pure virtual

Implemented in DefaultModel.

◆ potential()

virtual double potential ( Core::Molecule mol,
const Vector3 &  point 
) const
virtual
Parameters
molThe molecule to calculate the potential for.
pointThe 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
molThe molecule to calculate the potential for.
arrayThe 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
errorStringThe error to be added.
newLineAdd a new line after the error string?

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