indigoX
Forcefield Class Reference

#include <indigox/classes/forcefield.hpp>

Public Types

enum  Family
 Enum for the different families of forcefields. More...
 

Public Member Functions

 Forcefield ()=default
 
 Forcefield (const Forcefield &)=default
 
 Forcefield (Forcefield &&)=default
 
 Forcefield (Family family, std::string name)
 Normal constructor. More...
 
 ~ Forcefield ()=default
 
FFAngle GetAngleType (AngleType type, int32_t id) const
 Get the type of angle with the given id. More...
 
FFAngle GetAngleType (int32_t id) const
 Get the first angle type with the given id. More...
 
FFAtom GetAtomType (std::string name) const
 Get the AtomType with the given name. More...
 
FFAtom GetAtomType (int32_t id) const
 Get the AtomType with the given id. More...
 
FFBond GetBondType (BondType type, int32_t id) const
 Get the type of bond with the given id. More...
 
FFBond GetBondType (int32_t id) const
 Get the first bond type with the given id. More...
 
FFDihedral GetDihedralType (DihedralType type, int32_t id) const
 Get the type of dihedral with the given id. More...
 
FFDihedral GetDihedralType (int32_t id) const
 Get the first dihedral type with the given id. More...
 
Family GetFamily () const
 Get the family of the forcefield. More...
 
std::string GetName () const
 Get the name of the forcefield. More...
 
void LinkAngleTypes (const FFAngle &a, const FFAngle &b)
 Link together two equivalent angle types. More...
 
void LinkBondTypes (const FFBond &a, const FFBond &b)
 Link together two equivalent bond types. More...
 
FFAngle NewAngleType (AngleType type, int32_t id, double a, double b)
 Adds a new angle type to the forcefield with two parameters. More...
 
FFAtom NewAtomType (int32_t id, std::string name, const Element &element)
 Add a new atom type to the forcefield. More...
 
FFBond NewBondType (BondType type, int32_t id, double a, double b)
 Adds a new bond type to the forcefield with two parameters. More...
 
FFDihedral NewDihedralType (DihedralType type, int32_t id, double a, double b, double c)
 Adds a new dihedral type to the forcefield with three parameters. More...
 
FFDihedral NewDihedralType (DihedralType type, int32_t id, double a, double b)
 Adds a new dihedral type to the forcefield with two parameters. More...
 
size_t NumAngleTypes () const
 Get the number of angle types in the forcefield. More...
 
size_t NumAngleTypes (AngleType type) const
 Get the number of angle types of the given functional form. More...
 
size_t NumAtomTypes () const
 Get the number of atom types in the forcefield. More...
 
size_t NumBondTypes () const
 Get the total number of bond types in the forcefield. More...
 
size_t NumBondTypes (BondType type) const
 Get the number of bond types of the given functional form. More...
 
size_t NumDihedralTypes () const
 Get the number of dihedral types in the forcefield. More...
 
size_t NumDihedralTypes (DihedralType type) const
 Get the number of dihedral types of the given functional form. More...
 
 operator bool () const
 
bool operator!= (const Forcefield &ff) const
 
bool operator< (const Forcefield &ff) const
 
bool operator<= (const Forcefield &ff) const
 
Forcefieldoperator= (const Forcefield &)=default
 
Forcefieldoperator= (Forcefield &&)=default
 
bool operator== (const Forcefield &ff) const
 
bool operator> (const Forcefield &ff) const
 
bool operator>= (const Forcefield &ff) const
 
void ReserveAngleTypes (AngleType type, size_t size)
 Reserve space for angle types. More...
 
void ReserveAtomTypes (size_t size)
 Reserve space for atom types. More...
 
void ReserveBondTypes (BondType type, size_t size)
 Reserve space for bond types. More...
 
void ReserveDihedralTypes (DihedralType type, size_t size)
 Reserve space for dihedral types. More...
 

Friends

class cereal::access
 Friendship allows serialisation. More...
 
std::ostream & operator<< (std::ostream &os, const Forcefield &ff)
 

Member Enumeration Documentation

◆ Family

enum Family
strong

Enum for the different families of forcefields.

Though other values are provided, currently only the GROMOS family of forcefields are technically supported.

Enumerator
Empty 
GROMOS 
CHARMM 
AMBER 
Other 

Constructor & Destructor Documentation

◆ Forcefield() [1/4]

Forcefield ( )
default

◆ Forcefield() [2/4]

Forcefield ( const Forcefield )
default

◆ Forcefield() [3/4]

Forcefield ( Forcefield &&  )
default

◆ ~ Forcefield()

~ Forcefield ( )
default

◆ Forcefield() [4/4]

Forcefield ( Family  family,
std::string  name 
)

Normal constructor.

Create a new forcefield from the given family. The family dictates which types of functional forms are allowed. Currently implemented is the GROMOS family of forcefields, which allows harmonic and quartic bond types, harmonic and caosine-harmonic angle types, and proper and improper dihedral types.

Parameters
familythe family of forcefields to use.
namethe name of the forcefield.

Member Function Documentation

◆ GetAngleType() [1/2]

FFAngle GetAngleType ( AngleType  type,
int32_t  id 
) const

Get the type of angle with the given id.

Parameters
typethe type of angle to get.
theid of the angle type.
Returns
the requested angle type, or an empty shared_ptr.

◆ GetAngleType() [2/2]

FFAngle GetAngleType ( int32_t  id) const

Get the first angle type with the given id.

Searches through all allowed angle types in order and returns the first type with the given id.

Parameters
idthe id of the angle type.
Returns
the angle type, or an empty shared_ptr.

◆ GetAtomType() [1/2]

FFAtom GetAtomType ( std::string  name) const

Get the AtomType with the given name.

Parameters
namethe name of the atom type.
Returns
the atomtype with the name, or an empty shared_ptr.

◆ GetAtomType() [2/2]

FFAtom GetAtomType ( int32_t  id) const

Get the AtomType with the given id.

Parameters
idthe id of the atom type.
Returns
the atomtype with the id, or an empty shared_ptr.

◆ GetBondType() [1/2]

FFBond GetBondType ( BondType  type,
int32_t  id 
) const

Get the type of bond with the given id.

Parameters
typethe type of bond to get.
theid of the bond type.
Returns
the requested bond type, or an empty shared_ptr.

◆ GetBondType() [2/2]

FFBond GetBondType ( int32_t  id) const

Get the first bond type with the given id.

Searches through all allowed bond types in order and returns the first type with the id.

Parameters
idthe id of the bond type.
Returns
the bond type, or an empty shared_ptr.

◆ GetDihedralType() [1/2]

FFDihedral GetDihedralType ( DihedralType  type,
int32_t  id 
) const

Get the type of dihedral with the given id.

Parameters
typethe type of dihedral to get.
theid of the dihedral type.
Returns
the requested dihedral type, or an empty shared_ptr.

◆ GetDihedralType() [2/2]

FFDihedral GetDihedralType ( int32_t  id) const

Get the first dihedral type with the given id.

Searches through all allowed dihedral types in order and returns the first type with the given id.

Parameters
idthe id of the dihedral type.
Returns
the dihedral type, or an empty shared_ptr.

◆ GetFamily()

Family GetFamily ( ) const

Get the family of the forcefield.

Returns
the forcefields family.

◆ GetName()

std::string GetName ( ) const

Get the name of the forcefield.

Returns
the name of the forcefield.

◆ LinkAngleTypes()

void LinkAngleTypes ( const FFAngle a,
const FFAngle b 
)

Link together two equivalent angle types.

Two angle types can be linked together when they are regarded as the same type with different functional forms. For example, the GROMOS forcefield provides both harmonic and cosine-harmonic force constants for all angle types. This method will remove any existing links.

Parameters
a,bthe two types to link.

◆ LinkBondTypes()

void LinkBondTypes ( const FFBond a,
const FFBond b 
)

Link together two equivalent bond types.

Two bond types can be linked together when they are regarded as the same type with different functional forms. For example, the GROMOS forcefield provides both harmonic and quartic force constants for all bond types. This method will remove any existing links.

Parameters
a,bthe two types to link.

◆ NewAngleType()

FFAngle NewAngleType ( AngleType  type,
int32_t  id,
double  a,
double  b 
)

Adds a new angle type to the forcefield with two parameters.

This constructor should be used for AngleType::Harmonic and AngleType::CosineHarmonic bond types. In both cases, a is the force constant and b is the ideal angle.

Parameters
typethe type of the angle.
idthe id of the angle.
a,bthe two parameter values.
Returns
the newly created angle type.

◆ NewAtomType()

FFAtom NewAtomType ( int32_t  id,
std::string  name,
const Element element 
)

Add a new atom type to the forcefield.

Parameters
idthe id of the atom type.
namethe name of the atom type.
Returns
the newly created atom type.
Exceptions
std::runtime_errorif an atomtype with the given name or id already exists within the forcefield.

◆ NewBondType()

FFBond NewBondType ( BondType  type,
int32_t  id,
double  a,
double  b 
)

Adds a new bond type to the forcefield with two parameters.

This constructor should be used for BondType::Harmonic and BondType::Quartic bond types. In both cases, a is the force constant and b is the ideal length.

Parameters
typethe type of the bond.
idthe id of the bond.
a,bthe two parameter values.
Returns
the newly created bond type.

◆ NewDihedralType() [1/2]

FFDihedral NewDihedralType ( DihedralType  type,
int32_t  id,
double  a,
double  b,
double  c 
)

Adds a new dihedral type to the forcefield with three parameters.

This constructor should be used for DihedralType::Proper dihedral types. In that case, a is the force constant, b is the phase and c is the multiplicity.

Parameters
typethe type of dihedral.
idthe id of the dihedral.
a,b,cthe three parameter values.
Returns
the newly created dihedral type.

◆ NewDihedralType() [2/2]

FFDihedral NewDihedralType ( DihedralType  type,
int32_t  id,
double  a,
double  b 
)

Adds a new dihedral type to the forcefield with two parameters.

This constructor should be used for DihedralType::Improper dihedral types. In that case, a is the force constant and b is the ideal dihedral angle

Parameters
typethe type of dihedral.
idthe id of the dihedral.
a,bthe three parameter values.
Returns
the newly created dihedral type.

◆ NumAngleTypes() [1/2]

size_t NumAngleTypes ( ) const

Get the number of angle types in the forcefield.

For forcefields with multiple allowed types, the count of each type are summed.

Returns
the number of angle types in the forcefield.

◆ NumAngleTypes() [2/2]

size_t NumAngleTypes ( AngleType  type) const

Get the number of angle types of the given functional form.

Determines how may of the given angle types are present in the forcefield. In the case that the provided type is not supposrted by the forcefield, 0 is returned.

Parameters
typethe type of angle to count.
Returns
the number of angle types in the forcefield.

◆ NumAtomTypes()

size_t NumAtomTypes ( ) const

Get the number of atom types in the forcefield.

Returns
the number of atom types in the forcefield.

◆ NumBondTypes() [1/2]

size_t NumBondTypes ( ) const

Get the total number of bond types in the forcefield.

For forcefields with multiple allowed types, the count of each type are summed.

Returns
the number of bond types in the forcefield.

◆ NumBondTypes() [2/2]

size_t NumBondTypes ( BondType  type) const

Get the number of bond types of the given functional form.

Determines how many of the given bond type funcitonal form are present in the forcefield. In the case that the provided type is not supported by the forcefield, 0 is returned.

Parameters
typethe type of bond to count.
Returns
the number of bond types in the forcefield.

◆ NumDihedralTypes() [1/2]

size_t NumDihedralTypes ( ) const

Get the number of dihedral types in the forcefield.

For forcefields with multiple allowed types, the count of each type are summed.

Returns
the number of bond types in the forcefield.

◆ NumDihedralTypes() [2/2]

size_t NumDihedralTypes ( DihedralType  type) const

Get the number of dihedral types of the given functional form.

Determines how many of the given dihedral types are present in the forcefield. In the case that the provided type is not supported by the forcefield, 0 is returned.

Parameters
typethe type of dihedral to count.
Returns
the number of dihedral types in the forcefield.

◆ operator bool()

operator bool ( ) const
inline

◆ operator!=()

bool operator!= ( const Forcefield ff) const
inline

◆ operator<()

bool operator< ( const Forcefield ff) const

◆ operator<=()

bool operator<= ( const Forcefield ff) const
inline

◆ operator=() [1/2]

Forcefield& operator= ( Forcefield &&  )
default

◆ operator=() [2/2]

Forcefield& operator= ( const Forcefield )
default

◆ operator==()

bool operator== ( const Forcefield ff) const

◆ operator>()

bool operator> ( const Forcefield ff) const

◆ operator>=()

bool operator>= ( const Forcefield ff) const
inline

◆ ReserveAngleTypes()

void ReserveAngleTypes ( AngleType  type,
size_t  size 
)

Reserve space for angle types.

Parameters
typethe type of angle to reserve space for.
sizethe amount of space to reserve.

◆ ReserveAtomTypes()

void ReserveAtomTypes ( size_t  size)

Reserve space for atom types.

Parameters
sizethe amount of space to reserve.

◆ ReserveBondTypes()

void ReserveBondTypes ( BondType  type,
size_t  size 
)

Reserve space for bond types.

Parameters
typethe type of bond to reserve space for.
sizethe amount of space to reserve.

◆ ReserveDihedralTypes()

void ReserveDihedralTypes ( DihedralType  type,
size_t  size 
)

Reserve space for dihedral types.

Parameters
typethe type of dihedral to reserve space for.
sizethe amount of space to reserve.

Friends And Related Function Documentation

◆ cereal::access

friend class cereal::access
friend

Friendship allows serialisation.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Forcefield ff 
)
friend

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