CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CASM::DoFSet Class Reference

#include <DoFSet.hh>

Detailed Description

DoFSet: A set of degrees of freedom (DoF)

DoFSet specifies all identifying information for a vector of continuous independent variables (may be site or global variables). For example, a DoFSet may be used to represent allowed displacements on one site, or allowed lattice strains.

A DoFSet has:

  • AnisoValTraits, which provides the DoF type name, a standard coordinate system (the "standard basis"), and specifies how values transform under application of symmetry.
  • a "DoF basis", a set of named basis vectors which are denoted relative to the standard basis, allowing the user to specify the DoFSet components, name them, and restrict DoF values to a particular subspace
    • The basis is stored as a matrix and components of the basis are also represented as a std::vector<ContinuousDoF>. The ContinuousDoF are used for constructing basis functions.
  • the SymGroupRepID of the DoFSet, which is a key for retrieving the SymGroupRep that encodes how the DoFSet transforms with symmetry from the prim Structure factor group
  • a list of site occupants for which the DoF does not apply ("excluded_occupants", std::unordered_set<std::string>). As an example, this could be used if some allowed site occupant molecules have magnetic spin, but other allowed occupants do not.

Examples of standard basis specified by AnisoValTraits:

  • "disp" -> (dx, dy, dz) -> displacement components relative to fixed laboratory frame
  • "strain" -> (e_xx, e_yy, e_zz, sqrt(2)*e_yz, sqrt(2)*e_xz, sqrt(2)*e_xy) -> tensor elements

Definition at line 156 of file DoFSet.hh.

Public Types

using BasicTraits = AnisoValTraits
 
using TypeFunc = std::function< notstd::cloneable_ptr< AnisoValTraits >()>
 
using Container = std::vector< ContinuousDoF >
 
using const_iterator = std::vector< ContinuousDoF >::const_iterator
 

Public Member Functions

 DoFSet (AnisoValTraits const &_type, std::vector< std::string > components, DoFSetInfo _info, std::unordered_set< std::string > excluded_occupants={})
 
Index size () const
 Returns the number of components in this DoFSet. More...
 
std::string const & type_name () const
 
AnisoValTraits const & traits () const
 Returns the AnisoValTraits object for the DoF type of this DoFSet. More...
 
void set_ID (Index _ID)
 
void lock_IDs ()
 Locks IDs of components in this DoFSet so they can no longer be updated. More...
 
void set_sequential_IDs ()
 
DoFSetInfo const & info () const
 
ContinuousDoF const & operator[] (Index i) const
 
const_iterator begin () const
 Iterator pointing to the first ContinuousDoF component. More...
 
const_iterator end () const
 Iterator pointing one past last ContinuousDoF component. More...
 
const_iterator cbegin () const
 Const iterator to first ContinuousDoF component. More...
 
const_iterator cend () const
 Const iterator pointing one past last ContinuousDoF component. More...
 
bool is_excluded_occ (std::string const &_occ_name) const
 
Index dim () const
 Dimension of the DoFSet, equivalent to basis().cols() More...
 
Eigen::MatrixXd const & basis () const
 
SymGroupRepID const & symrep_ID () const
 
bool identical (DoFSet const &rhs) const
 Returns true if "rhs" has identical components and basis to this DoFSet. More...
 
void transform_basis (Eigen::Ref< const Eigen::MatrixXd > const &trans_mat)
 Equivalent to m_basis=trans_mat*m_basis. Invalidates SymGroupRepID. More...
 
bool update_IDs (const std::vector< Index > &before_IDs, const std::vector< Index > &after_IDs)
 

Static Public Member Functions

static DoFSet make_default (AnisoValTraits const &_type)
 

Private Attributes

BasicTraits m_traits
 
std::vector< ContinuousDoFm_components
 ContinuousDoF components, one for each column in m_info->basis() More...
 
DoFSetInfo m_info
 
std::unordered_set< std::string > m_excluded_occs
 A list of site occupants for which the DoF does not apply. More...
 

Member Typedef Documentation

◆ BasicTraits

Definition at line 158 of file DoFSet.hh.

◆ const_iterator

Definition at line 164 of file DoFSet.hh.

◆ Container

using CASM::DoFSet::Container = std::vector<ContinuousDoF>

Definition at line 162 of file DoFSet.hh.

◆ TypeFunc

Definition at line 160 of file DoFSet.hh.

Constructor & Destructor Documentation

◆ DoFSet()

CASM::DoFSet::DoFSet ( AnisoValTraits const &  _type,
std::vector< std::string >  components,
DoFSetInfo  _info,
std::unordered_set< std::string >  excluded_occupants = {} 
)

General case DoFSet constructor

Parameters
_typeAnisoValTraits specifying the type of DoF.
componentsName of each component of the DoFSet. (i.e. "dx", "dy", "dz" for "disp" DoF)
_infoDoFSetInfo containing the SymGroupRepID and DoFSet coordinate axes matrix (basis)
excluded_occupantsA list of site occupants for which the DoF does not apply

Note: Use the static function DoFSet::make_default to construct a DoFSet having standard dimension and coordinate basis.

Definition at line 10 of file DoFSet.cc.

Member Function Documentation

◆ basis()

Eigen::MatrixXd const& CASM::DoFSet::basis ( ) const
inline

Const reference to the DoFSet coordinate axes

A particular DoFSet column-vector value, 'v', can be represented in the standard coordinate space by:

v_standard = basis * v

Note:

  • The basis is not required to be full rank (i.e. basis.cols() < basis().rows() is valid). This allows DoF values to be restricted to to a subspace of the standard values.

Definition at line 268 of file DoFSet.hh.

◆ begin()

const_iterator CASM::DoFSet::begin ( ) const
inline

Iterator pointing to the first ContinuousDoF component.

Definition at line 236 of file DoFSet.hh.

◆ cbegin()

const_iterator CASM::DoFSet::cbegin ( ) const
inline

Const iterator to first ContinuousDoF component.

Definition at line 242 of file DoFSet.hh.

◆ cend()

const_iterator CASM::DoFSet::cend ( ) const
inline

Const iterator pointing one past last ContinuousDoF component.

Definition at line 245 of file DoFSet.hh.

◆ dim()

Index CASM::DoFSet::dim ( ) const
inline

Dimension of the DoFSet, equivalent to basis().cols()

Definition at line 254 of file DoFSet.hh.

◆ end()

const_iterator CASM::DoFSet::end ( ) const
inline

Iterator pointing one past last ContinuousDoF component.

Definition at line 239 of file DoFSet.hh.

◆ identical()

bool CASM::DoFSet::identical ( DoFSet const &  rhs) const

Returns true if "rhs" has identical components and basis to this DoFSet.

Definition at line 42 of file DoFSet.cc.

◆ info()

DoFSetInfo const& CASM::DoFSet::info ( ) const
inline

Returns reference to DoFSetInfo (which contains SymGroupRepID and basis vectors of the DoFSet coordinate system)

Definition at line 227 of file DoFSet.hh.

◆ is_excluded_occ()

bool CASM::DoFSet::is_excluded_occ ( std::string const &  _occ_name) const
inline

Returns true if DoFSet is inactive (e.g., takes zero values) when specified occupant is present

Definition at line 249 of file DoFSet.hh.

◆ lock_IDs()

void CASM::DoFSet::lock_IDs ( )

Locks IDs of components in this DoFSet so they can no longer be updated.

Definition at line 60 of file DoFSet.cc.

◆ make_default()

DoFSet CASM::DoFSet::make_default ( AnisoValTraits const &  _type)
static

Construct a DoFSet having standard dimension and coordinate basis for given type.

Example usage:

DoFSet my_disp_dof = DoFSet::make_default("disp");
static DoFSet make_default(AnisoValTraits const &_type)
Definition: DoFSet.cc:93
DoFSet(AnisoValTraits const &_type, std::vector< std::string > components, DoFSetInfo _info, std::unordered_set< std::string > excluded_occupants={})
Definition: DoFSet.cc:10

Definition at line 93 of file DoFSet.cc.

◆ operator[]()

ContinuousDoF const& CASM::DoFSet::operator[] ( Index  i) const
inline

Return i'th component of DoFSet

DoFSet components are represented as ContinuousDoF, which, in addition to a type_name also has a variable name.

Definition at line 233 of file DoFSet.hh.

◆ set_ID()

void CASM::DoFSet::set_ID ( Index  _ID)
inline

Set identifying index (ID) of components in this DoFSet

Notes:

  • ID is context dependent but is used to different distinct DoFSets that are otherwise equivalent (i.e., have same type_name(), components, etc).
  • For example, "disp" DoFSet on two sites in the primitive cell may have the same basis and be indistringuishable except for being associated with different sites. Their components are given different IDs in order to distinguish the DoFSets from each other.

Definition at line 213 of file DoFSet.hh.

◆ set_sequential_IDs()

void CASM::DoFSet::set_sequential_IDs ( )

Sets the IDs of each component of the DoFSet to be their index within the set. That is, components of the set get labeled [0, 1, ..., n-1]

Definition at line 67 of file DoFSet.cc.

◆ size()

Index CASM::DoFSet::size ( ) const
inline

Returns the number of components in this DoFSet.

Definition at line 191 of file DoFSet.hh.

◆ symrep_ID()

SymGroupRepID const& CASM::DoFSet::symrep_ID ( ) const
inline

SymGroupRepID of this DoFSet

Note:

Definition at line 276 of file DoFSet.hh.

◆ traits()

AnisoValTraits const& CASM::DoFSet::traits ( ) const
inline

Returns the AnisoValTraits object for the DoF type of this DoFSet.

Definition at line 200 of file DoFSet.hh.

◆ transform_basis()

void CASM::DoFSet::transform_basis ( Eigen::Ref< const Eigen::MatrixXd > const &  trans_mat)

Equivalent to m_basis=trans_mat*m_basis. Invalidates SymGroupRepID.

Definition at line 52 of file DoFSet.cc.

◆ type_name()

std::string const& CASM::DoFSet::type_name ( ) const
inline

Returns the DoF type name

Note: Will be a standardized DoF type name (e.g., "disp", "magspin", "GLstrain") from the DoFSet's AnisoValTraits object.

Definition at line 197 of file DoFSet.hh.

◆ update_IDs()

bool CASM::DoFSet::update_IDs ( const std::vector< Index > &  before_IDs,
const std::vector< Index > &  after_IDs 
)

Update component IDs

Notes:

  • This is a convenience function used when DoFSet IDs are being set en masse
  • Each component with ID in before_IDs[i] will get changed to the corresponding ID in after_IDs[i].
  • If any component ID is updated, returns true; otherwise returns false.

Definition at line 74 of file DoFSet.cc.

Member Data Documentation

◆ m_components

std::vector<ContinuousDoF> CASM::DoFSet::m_components
private

ContinuousDoF components, one for each column in m_info->basis()

Definition at line 302 of file DoFSet.hh.

◆ m_excluded_occs

std::unordered_set<std::string> CASM::DoFSet::m_excluded_occs
private

A list of site occupants for which the DoF does not apply.

Definition at line 309 of file DoFSet.hh.

◆ m_info

DoFSetInfo CASM::DoFSet::m_info
private

DoFSetInfo containing the SymGroupRepID and DoFSet coordinate axes matrix (basis)

Definition at line 306 of file DoFSet.hh.

◆ m_traits

BasicTraits CASM::DoFSet::m_traits
private

AnisoValTraits. Describes the type of DoF, and can convert Cartesian symmetry representations into the appropriate representation

Definition at line 299 of file DoFSet.hh.


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