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

#include <AnisoValTraits.hh>

Detailed Description

Specifies traits of (possibly) anisotropic crystal properties.

CASM needs to know how to use crystal properties in several places:

Examples of various property types, and their name strings, include:

  • occupation ("occ"): which atom or molecule occupies a particular crystal site
  • displacement ("disp"): displacement of crystal sites from an ideal location
  • strain ("Ustrain", "GLstrain", etc.): how lattice vectors are transformed from the ideal lattice vectors, under various metrics ("Ustrain": stretch tensor, "GLstrain": Green-Lagrange strain metric, etc.)
  • energy ("energy"): the crystal energy, relative to user chosen reference states
  • force ("force"): forces on atoms present without/with allowing atomic and lattice relaxation

The AnisoValTraits class contains all the necessary information for CASM to deal with different types of properties. For each property type there must exist one AnisoValTraits object which controls how CASM treats the property, including:

  • the property name
  • whether the property is a local (site) property or global property
  • whether the property is continuous or discrete
  • the dimension of the property value vector
  • the standard basis for the property value (what each component means)
  • how symmetry operations transform the property value
  • etc.

Note: Traits for all properties are defined using AnisoValTraits, even isotropic properties.

The AnisoValTraits class contains two constructors. One allows defining a new property type which gets placed in a single static container. The other, with just a "name" argument, returns a copy of the already existing AnisoValTraits object for the property type with the given name.

CASM property naming convention

A particular instance of a property, such as in BasicStructure or SimpleStructure, is labeled with a property name string. Property name strings must end with the property type name (i.e. "occ", "disp", "Ustrain", "energy", etc.) and may also include a modifier describing the particular property (i.e. "formation" in "formation_energy"). If a modifier exists, it must be separated from the property type by an underscore character ('_'). The name of a custom property type may not include an underscore.

Thus, whenever a particular property name is encountered, the property type name can be determined and used to lookup the corresponding AnisoValTraits object.

Examples:

  • property name: "energy" -> property type (AnisoValTraits) name: "energy"
  • property name: "relaxed_energy" -> property type (AnisoValTraits) name: "energy"
  • property name: "formation_energy" -> property type (AnisoValTraits) name: "energy"
  • property name: "relaxedenergy" -> Error (because there is no underscore)
  • property name: "Ustrain" -> property type (AnisoValTraits) name: "Ustrain"
  • property name: "strain" -> Error (because there no strain type prefix)

Named constructors for standard types

For standard types, AnisoValTraits are pre-defined and can be accessed via the following named constructors:

Definition at line 25 of file AnisoValTraits.hh.

Public Member Functions

 AnisoValTraits (std::string const &_name, std::vector< std::string > const &_std_var_names, unsigned char _options, SymRepBuilderInterface const &_symrep_builder=NullSymRepBuilder(), std::set< std::string > const &_incompatible={}, std::set< std::string > const &_must_apply_before={}, std::set< std::string > const &_must_apply_after={}, std::vector< std::string > const &_variable_descriptions={}, bool _default=false)
 Explicit constructor for AnisoValTraits. More...
 
 AnisoValTraits (std::string const &_name)
 Construct a copy of an existing AnisoValTraits with matching name suffix. More...
 
Eigen::MatrixXd symop_to_matrix (Eigen::Ref< const Eigen::Matrix3d > const &_matrix, Eigen::Ref< const Eigen::Vector3d > const &_tau, bool time_reversal) const
 Generate a symmetry representation for the supporting vector space. More...
 
std::string const & name () const
 Const access of name. More...
 
bool is_default () const
 Return true if *this has 'default' designation, meaning it can be overridden. More...
 
unsigned char options () const
 Return 'options' bitflag. More...
 
bool extensive () const
 Returns true if type is extensive. More...
 
bool global () const
 Returns true if type is global. More...
 
bool unit_length () const
 Returns true if type must always have unit length. More...
 
bool time_reversal_active () const
 Returns true if time-reversal changes the value. More...
 
bool describes_occupant_orientation () const
 
Index dim () const
 Conventional dimensionality of this type, returns -1 if always variable. More...
 
bool operator== (std::string const &other_name) const
 Equality comparison of name. More...
 
bool operator< (std::string const &other_name) const
 Lexicographic comparison of name. More...
 
 operator std::string const & () const
 Allow implicit conversion to std::string (name) More...
 
std::vector< std::string > const & standard_var_names () const
 Return standard coordinate axes for continuous variable space. More...
 
std::vector< std::string > const & variable_descriptions () const
 Returns expanded description of each standard_var_name. More...
 
std::set< std::string > const & incompatible () const
 When used as a DoF, this is a set of DoFs that are incompatible with this type of DoF. More...
 
std::set< std::string > const & must_apply_before () const
 When used as a DoF, this is a set of DoFs that must be applied before this DoF is applied. More...
 
std::set< std::string > const & must_apply_after () const
 When used as a DoF, this is a set of DoFs that must be applied after this DoF is applied. More...
 
std::unique_ptr< AnisoValTraitsclone () const
 Clone this object. More...
 
std::string symrep_builder_name () const
 Return name of the SymRepBuilderInterface. More...
 

Static Public Member Functions

static AnisoValTraits null ()
 Named constructor for uninitialized AnisoValTraits. More...
 
static AnisoValTraits occ ()
 Named constructor for discrete site occupation AnisoValTraits. More...
 
static AnisoValTraits energy ()
 Named constructor for total energy AnisoValTraits. More...
 
static AnisoValTraits cost ()
 Named constructor for mapping cost AnisoValTraits. More...
 
static AnisoValTraits selective_dynamics ()
 Named constructor for selective_dynamics AnisoValTraits. More...
 
static AnisoValTraits disp ()
 Named constructor for site displacement AnisoValTraits. More...
 
static AnisoValTraits coordinate ()
 Named constructor for site coordinate AnisoValTraits. More...
 
static AnisoValTraits latvec ()
 Named constructor for lattice vector AnisoValTraits. More...
 
static AnisoValTraits force ()
 Named constructor for site force AnisoValTraits. More...
 
static AnisoValTraits isometry ()
 Named constructor for global 'isometry' AnisoValTraits. More...
 
static AnisoValTraits strain (std::string const &_metric)
 Named constructor for global strain AnisoValTraits. More...
 
static AnisoValTraits SOmagspin ()
 Non-collinear magnetic spin, with spin-orbit coupling. More...
 
static AnisoValTraits SOunitmagspin ()
 Non-collinear magnetic spin, with spin-orbit coupling, constrained to unit length. More...
 
static AnisoValTraits NCmagspin ()
 Non-collinear magnetic spin, without spin-orbit coupling. More...
 
static AnisoValTraits NCunitmagspin ()
 Non-collinear magnetic spin, without spin-orbit coupling, constrained to unit length. More...
 
static AnisoValTraits Cmagspin ()
 Collinear magnetic spin. More...
 
static AnisoValTraits Cunitmagspin ()
 Collinear magnetic spin, constrained to unit length. More...
 
static AnisoValTraits d_orbital_occupation ()
 Named constructor for d-orbital occupation AnisoValTraits. More...
 
static AnisoValTraits d_orbital_occupation_spin_polarized ()
 Named constructor for spin-polarized d-orbital occupation AnisoValTraits. More...
 
static std::string name_suffix (std::string const &_name, char delim='_')
 
static std::string class_desc ()
 Returns "AnisoValTraits". More...
 

Static Public Attributes

static const unsigned char LOCAL = 0
 
static const unsigned char GLOBAL = (1u << 0)
 
static const unsigned char UNIT_LENGTH = (1u << 1)
 
static const unsigned char DESCRIBES_ORIENTATION = (1u << 2)
 
static const unsigned char EXTENSIVE = (1u << 3)
 

Protected Attributes

std::string m_name
 
bool m_default
 
std::vector< std::string > m_standard_var_names
 
std::vector< std::string > m_variable_descriptions
 
unsigned char m_opt
 
notstd::cloneable_ptr< const SymRepBuilderInterfacem_symrep_builder
 
std::set< std::string > m_incompatible
 
std::set< std::string > m_apply_before
 
std::set< std::string > m_apply_after
 

Constructor & Destructor Documentation

◆ AnisoValTraits() [1/2]

CASM::AnisoValTraits::AnisoValTraits ( std::string const &  _name,
std::vector< std::string > const &  _std_var_names,
unsigned char  _options,
SymRepBuilderInterface const &  _symrep_builder = NullSymRepBuilder(),
std::set< std::string > const &  _incompatible = {},
std::set< std::string > const &  _must_apply_before = {},
std::set< std::string > const &  _must_apply_after = {},
std::vector< std::string > const &  _variable_descriptions = {},
bool  _default = false 
)

Explicit constructor for AnisoValTraits.

Explicit constructor for AnisoValTraits

All attributes must be specified at construction. There is no mutator for AnisoValTraits. Explicitly constructing two AnisoValTraits objects with the same name but non-identical data members will result in a thrown exception, unless this->is_default()==true.

Parameters
_nameName for this type
_std_var_namesNames for standard coordinate axes of continuous variable space.
_optionsBitflag describing setting properties (LOCAL, GLOBAL, UNIT_LENGTH, DESCRIBES_ORIENTATION, EXTENSIVE)
_symrep_builderMethod for constructing symmetry representations
_incompatibleWhen used as a DoF, this is a set of DoFs that are incompatible with this type of DoF
_must_apply_beforeWhen used as a DoF, this is a set of DoFs (by AnisoValTraits name) that must be applied before this DoF is applied when constructing a SimpleStructure from a Configuration.
_must_apply_afterWhen used as a DoF, this is a set of DoFs (by AnisoValTraits name) that must be applied after this DoF is applied when constructing a SimpleStructure from a Configuration.
_variable_descriptionsExpanded description of each standard_var_name
_defaultTrue if this has 'default' designation, meaning it can be overridden

The special keyword "atomize" is also valid for _must_apply_before and _must_apply_after, indicating the step when molecules are taken and "atomized" (populating SimpleStructure::atom_info from SimpleStructure::mol_info).

Definition at line 229 of file AnisoValTraits.cc.

◆ AnisoValTraits() [2/2]

CASM::AnisoValTraits::AnisoValTraits ( std::string const &  _name)

Construct a copy of an existing AnisoValTraits with matching name suffix.

Construct a copy of an existing AnisoValTraits with matching name suffix

Returns a copy of a previously explicitly initialized AnisoValTraits with name AnisoValTraits::name_suffix(_name). If no AnisoValTraits with matching name has been initialized, throws an exception.

Definition at line 195 of file AnisoValTraits.cc.

Member Function Documentation

◆ class_desc()

static std::string CASM::AnisoValTraits::class_desc ( )
inlinestatic

Returns "AnisoValTraits".

Definition at line 124 of file AnisoValTraits.hh.

◆ clone()

std::unique_ptr<AnisoValTraits> CASM::AnisoValTraits::clone ( ) const
inline

Clone this object.

Definition at line 217 of file AnisoValTraits.hh.

◆ Cmagspin()

AnisoValTraits CASM::AnisoValTraits::Cmagspin ( )
static

Collinear magnetic spin.

Required and non-default values:

Definition at line 510 of file AnisoValTraits.cc.

◆ coordinate()

AnisoValTraits CASM::AnisoValTraits::coordinate ( )
static

Named constructor for site coordinate AnisoValTraits.

Required and non-default values:

Definition at line 345 of file AnisoValTraits.cc.

◆ cost()

AnisoValTraits CASM::AnisoValTraits::cost ( )
static

Named constructor for mapping cost AnisoValTraits.

This includes basis_cost, strain_cost, total_cost.

Required and non-default values:

Definition at line 303 of file AnisoValTraits.cc.

◆ Cunitmagspin()

AnisoValTraits CASM::AnisoValTraits::Cunitmagspin ( )
static

Collinear magnetic spin, constrained to unit length.

Required and non-default values:

Definition at line 525 of file AnisoValTraits.cc.

◆ d_orbital_occupation()

AnisoValTraits CASM::AnisoValTraits::d_orbital_occupation ( )
static

Named constructor for d-orbital occupation AnisoValTraits.

Required and non-default values:

Definition at line 540 of file AnisoValTraits.cc.

◆ d_orbital_occupation_spin_polarized()

AnisoValTraits CASM::AnisoValTraits::d_orbital_occupation_spin_polarized ( )
static

Named constructor for spin-polarized d-orbital occupation AnisoValTraits.

Required and non-default values:

  • name(): "dorbitaloccupationspinpolarized"
  • standard_var_names(): {"u_1", "u_2", "u_3", "u_4", "u_5", "u_6", "u_7", "u_8", "u_9", "u_10", "u_11", "u_12", "u_13", "u_14", "u_15", "d_1", "d_2", "d_3", "d_4", "d_5", "d_6", "d_7", "d_8", "d_9", "d_10", "d_11", "d_12", "d_13", "d_14", "d_15"}
  • options(): LOCAL
  • SymRepBuilderInterface: dOrbitalOccupationSpinPolarizedSymRepBuilder()
  • must_apply_before(): {"atomize"}

Definition at line 560 of file AnisoValTraits.cc.

◆ describes_occupant_orientation()

bool CASM::AnisoValTraits::describes_occupant_orientation ( ) const
inline

Returns true if value tracks the orientation of an occupying molecule (not typical)

Definition at line 170 of file AnisoValTraits.hh.

◆ dim()

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

Conventional dimensionality of this type, returns -1 if always variable.

Definition at line 175 of file AnisoValTraits.hh.

◆ disp()

AnisoValTraits CASM::AnisoValTraits::disp ( )
static

Named constructor for site displacement AnisoValTraits.

Required and non-default values:

Definition at line 330 of file AnisoValTraits.cc.

◆ energy()

AnisoValTraits CASM::AnisoValTraits::energy ( )
static

Named constructor for total energy AnisoValTraits.

Required and non-default values:

Definition at line 288 of file AnisoValTraits.cc.

◆ extensive()

bool CASM::AnisoValTraits::extensive ( ) const
inline

Returns true if type is extensive.

Definition at line 149 of file AnisoValTraits.hh.

◆ force()

AnisoValTraits CASM::AnisoValTraits::force ( )
static

Named constructor for site force AnisoValTraits.

Required and non-default values:

Definition at line 382 of file AnisoValTraits.cc.

◆ global()

bool CASM::AnisoValTraits::global ( ) const
inline

Returns true if type is global.

Definition at line 158 of file AnisoValTraits.hh.

◆ incompatible()

std::set<std::string> const& CASM::AnisoValTraits::incompatible ( ) const
inline

When used as a DoF, this is a set of DoFs that are incompatible with this type of DoF.

Definition at line 202 of file AnisoValTraits.hh.

◆ is_default()

bool CASM::AnisoValTraits::is_default ( ) const
inline

Return true if *this has 'default' designation, meaning it can be overridden.

Definition at line 143 of file AnisoValTraits.hh.

◆ isometry()

AnisoValTraits CASM::AnisoValTraits::isometry ( )
static

Named constructor for global 'isometry' AnisoValTraits.

Required and non-default values:

Definition at line 401 of file AnisoValTraits.cc.

◆ latvec()

AnisoValTraits CASM::AnisoValTraits::latvec ( )
static

Named constructor for lattice vector AnisoValTraits.

Required and non-default values:

Definition at line 364 of file AnisoValTraits.cc.

◆ must_apply_after()

std::set<std::string> const& CASM::AnisoValTraits::must_apply_after ( ) const
inline

When used as a DoF, this is a set of DoFs that must be applied after this DoF is applied.

Definition at line 212 of file AnisoValTraits.hh.

◆ must_apply_before()

std::set<std::string> const& CASM::AnisoValTraits::must_apply_before ( ) const
inline

When used as a DoF, this is a set of DoFs that must be applied before this DoF is applied.

Definition at line 206 of file AnisoValTraits.hh.

◆ name()

std::string const& CASM::AnisoValTraits::name ( ) const
inline

Const access of name.

Definition at line 139 of file AnisoValTraits.hh.

◆ name_suffix()

static std::string CASM::AnisoValTraits::name_suffix ( std::string const &  _name,
char  delim = '_' 
)
inlinestatic

Returns string after final delim character

Given a string, returns string with all characters before the final delim character deleted. For example, if a trajectory has properties with key1="step1_force", key2="step2_force", etc., then AnisoValTraits::name_suffix(key1) will return "force" if ‘delim=’_'`.

Definition at line 98 of file AnisoValTraits.hh.

◆ NCmagspin()

AnisoValTraits CASM::AnisoValTraits::NCmagspin ( )
static

Non-collinear magnetic spin, without spin-orbit coupling.

Required and non-default values:

Definition at line 478 of file AnisoValTraits.cc.

◆ NCunitmagspin()

AnisoValTraits CASM::AnisoValTraits::NCunitmagspin ( )
static

Non-collinear magnetic spin, without spin-orbit coupling, constrained to unit length.

Required and non-default values:

Definition at line 495 of file AnisoValTraits.cc.

◆ null()

AnisoValTraits CASM::AnisoValTraits::null ( )
static

Named constructor for uninitialized AnisoValTraits.

Required and non-default values:

Definition at line 266 of file AnisoValTraits.cc.

◆ occ()

AnisoValTraits CASM::AnisoValTraits::occ ( )
static

Named constructor for discrete site occupation AnisoValTraits.

Required and non-default values:

Definition at line 276 of file AnisoValTraits.cc.

◆ operator std::string const &()

CASM::AnisoValTraits::operator std::string const & ( ) const
inline

Allow implicit conversion to std::string (name)

Definition at line 188 of file AnisoValTraits.hh.

◆ operator<()

bool CASM::AnisoValTraits::operator< ( std::string const &  other_name) const
inline

Lexicographic comparison of name.

Definition at line 183 of file AnisoValTraits.hh.

◆ operator==()

bool CASM::AnisoValTraits::operator== ( std::string const &  other_name) const
inline

Equality comparison of name.

Definition at line 178 of file AnisoValTraits.hh.

◆ options()

unsigned char CASM::AnisoValTraits::options ( ) const
inline

Return 'options' bitflag.

Definition at line 146 of file AnisoValTraits.hh.

◆ selective_dynamics()

AnisoValTraits CASM::AnisoValTraits::selective_dynamics ( )
static

Named constructor for selective_dynamics AnisoValTraits.

Named constructor for selective dynamics AnisoValTraits.

Required and non-default values:

Definition at line 316 of file AnisoValTraits.cc.

◆ SOmagspin()

AnisoValTraits CASM::AnisoValTraits::SOmagspin ( )
static

Non-collinear magnetic spin, with spin-orbit coupling.

Required and non-default values:

Definition at line 447 of file AnisoValTraits.cc.

◆ SOunitmagspin()

AnisoValTraits CASM::AnisoValTraits::SOunitmagspin ( )
static

Non-collinear magnetic spin, with spin-orbit coupling, constrained to unit length.

Required and non-default values:

Definition at line 463 of file AnisoValTraits.cc.

◆ standard_var_names()

std::vector<std::string> const& CASM::AnisoValTraits::standard_var_names ( ) const
inline

Return standard coordinate axes for continuous variable space.

Definition at line 191 of file AnisoValTraits.hh.

◆ strain()

AnisoValTraits CASM::AnisoValTraits::strain ( std::string const &  _prefix)
static

Named constructor for global strain AnisoValTraits.

Parameters
_metricspecifies which strain metric. Choices are:
  • "U" : Right-stretch tensor
  • "B" : Biot
  • "GL" : Green-Lagrange
  • "AE" : Almansi-Euler
  • "H" : Hencky

Required and non-default values:

Definition at line 428 of file AnisoValTraits.cc.

◆ symop_to_matrix()

Eigen::MatrixXd CASM::AnisoValTraits::symop_to_matrix ( Eigen::Ref< const Eigen::Matrix3d > const &  _matrix,
Eigen::Ref< const Eigen::Vector3d > const &  _tau,
bool  time_reversal 
) const
inline

Generate a symmetry representation for the supporting vector space.

Definition at line 127 of file AnisoValTraits.hh.

◆ symrep_builder_name()

std::string CASM::AnisoValTraits::symrep_builder_name ( ) const
inline

Return name of the SymRepBuilderInterface.

Definition at line 222 of file AnisoValTraits.hh.

◆ time_reversal_active()

bool CASM::AnisoValTraits::time_reversal_active ( ) const
inline

Returns true if time-reversal changes the value.

Definition at line 164 of file AnisoValTraits.hh.

◆ unit_length()

bool CASM::AnisoValTraits::unit_length ( ) const
inline

Returns true if type must always have unit length.

Definition at line 161 of file AnisoValTraits.hh.

◆ variable_descriptions()

std::vector<std::string> const& CASM::AnisoValTraits::variable_descriptions ( ) const
inline

Returns expanded description of each standard_var_name.

Definition at line 196 of file AnisoValTraits.hh.

Member Data Documentation

◆ DESCRIBES_ORIENTATION

const unsigned char CASM::AnisoValTraits::DESCRIBES_ORIENTATION = (1u << 2)
static

Definition at line 30 of file AnisoValTraits.hh.

◆ EXTENSIVE

const unsigned char CASM::AnisoValTraits::EXTENSIVE = (1u << 3)
static

Definition at line 31 of file AnisoValTraits.hh.

◆ GLOBAL

const unsigned char CASM::AnisoValTraits::GLOBAL = (1u << 0)
static

Definition at line 28 of file AnisoValTraits.hh.

◆ LOCAL

const unsigned char CASM::AnisoValTraits::LOCAL = 0
static

Definition at line 27 of file AnisoValTraits.hh.

◆ m_apply_after

std::set<std::string> CASM::AnisoValTraits::m_apply_after
protected

Definition at line 238 of file AnisoValTraits.hh.

◆ m_apply_before

std::set<std::string> CASM::AnisoValTraits::m_apply_before
protected

Definition at line 237 of file AnisoValTraits.hh.

◆ m_default

bool CASM::AnisoValTraits::m_default
protected

Definition at line 231 of file AnisoValTraits.hh.

◆ m_incompatible

std::set<std::string> CASM::AnisoValTraits::m_incompatible
protected

Definition at line 236 of file AnisoValTraits.hh.

◆ m_name

std::string CASM::AnisoValTraits::m_name
protected

Definition at line 230 of file AnisoValTraits.hh.

◆ m_opt

unsigned char CASM::AnisoValTraits::m_opt
protected

Definition at line 234 of file AnisoValTraits.hh.

◆ m_standard_var_names

std::vector<std::string> CASM::AnisoValTraits::m_standard_var_names
protected

Definition at line 232 of file AnisoValTraits.hh.

◆ m_symrep_builder

notstd::cloneable_ptr<const SymRepBuilderInterface> CASM::AnisoValTraits::m_symrep_builder
protected

Definition at line 235 of file AnisoValTraits.hh.

◆ m_variable_descriptions

std::vector<std::string> CASM::AnisoValTraits::m_variable_descriptions
protected

Definition at line 233 of file AnisoValTraits.hh.

◆ UNIT_LENGTH

const unsigned char CASM::AnisoValTraits::UNIT_LENGTH = (1u << 1)
static

Definition at line 29 of file AnisoValTraits.hh.


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