AvogadroLibs 1.103.0
Loading...
Searching...
No Matches
Constraint Class Reference

Constraints for optimization / dynamics. More...

#include <avogadro/core/constraint.h>

Public Types

enum  Type {
  None = 0 ,
  DistanceConstraint ,
  AngleConstraint ,
  TorsionConstraint ,
  OutOfPlaneConstraint ,
  UnknownConstraint
}

Public Member Functions

 Constraint (Index a, Index b, Index c=MaxIndex, Index d=MaxIndex, Real value=0.0)
void set (Index a, Index b, Index c=MaxIndex, Index d=MaxIndex, Real value=0.0)
void setValue (Real value)
Real value () const
std::tuple< Index, Index, Index, Index > atoms () const
Index aIndex () const
Index bIndex () const
Index cIndex () const
Index dIndex () const
Real k () const
void setK (Real k)
Constraint::Type type () const
void setType (Constraint::Type type) const

Protected Attributes

Index m_aIndex = MaxIndex
Index m_bIndex = MaxIndex
Index m_cIndex = MaxIndex
Index m_dIndex = MaxIndex
Real m_value = 0.0
Real m_k = 1000.0
Constraint::Type m_type = None

Detailed Description

Author
Geoffrey R. Hutchison

This class represents a distance, angle, or torsional constraint / restraint during optimization or dynamics. More technically, these are implemented as stiff harmonic oscillators restraining a particular atom set towards the value.

Constructor & Destructor Documentation

◆ Constraint()

Constraint ( Index a,
Index b,
Index c = MaxIndex,
Index d = MaxIndex,
Real value = 0.0 )

Constructor, results in a zero distance constraint

Parameters
aAtom index of the first atom of the constraint
bAtom index of the second atom of the constraint
cAtom index of the third atom (for angles or torsions) or MaxIndex
dAtom index of the fourth atom (for torsion constraints) or MaxIndex
valueThe value of the constraint, either Angstrom for distance or radians)

Member Function Documentation

◆ set()

void set ( Index a,
Index b,
Index c = MaxIndex,
Index d = MaxIndex,
Real value = 0.0 )

Set the constraint

Parameters
aAtom index of the first atom of the constraint
bAtom index of the second atom of the constraint
cAtom index of the third atom (for angles or torsions) or MaxIndex
dAtom index of the fourth atom (for torsion constraints) or MaxIndex
valueThe value of the constraint, either Angstrom for distance or radians)

◆ setValue()

void setValue ( Real value)

Set the constraint value (distance, angle, dihedral)

Parameters
valueThe value of the constraint, either Angstrom for distance or radians)

◆ value()

Real value ( ) const
Returns
the constraint value

◆ atoms()

std::tuple< Index, Index, Index, Index > atoms ( ) const
Returns
the atoms in the constraint as a tuple

◆ aIndex()

Index aIndex ( ) const
Returns
the atom index from the constraint or MaxIndex

◆ type()

Constraint::Type type ( ) const
Returns
the type of constraint

◆ setType()

void setType ( Constraint::Type type) const

Set the type of constraint

Parameters
typeThe type of constraint

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