CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
CASM::ConfigMapper Class Reference

#include <ConfigMapping.hh>

Detailed Description

A class for mapping an arbitrary crystal structure as a configuration of a crystal template as described by a PrimClex. ConfigMapper manages options for the mapping algorithm and mapping cost function It also caches some information about supercell lattices so that batch imports are more efficient

Definition at line 18 of file ConfigMapping.hh.

Public Types

enum  NullInitializer { null_initializer }
 
enum  Options { none = 0, rotate = (1u << 0), strict = (1u << 1), robust = (1u << 2) }
 

Public Member Functions

 ConfigMapper (NullInitializer)
 Default construction not allowed – this constructor provides an override. More...
 
 ConfigMapper (PrimClex &_pclex, double _lattice_weight, double _max_volume_change=0.5, int _options=robust, double _tol=TOL)
 Construct and initialize a ConfigMapper. More...
 
PrimClexprimclex () const
 
void set_primclex (PrimClex &_pclex)
 
double lattice_weight () const
 
void set_lattice_weight (double _lw)
 
double min_va_frac () const
 
void set_min_va_frac (double _min_va)
 
double max_va_frac () const
 
void set_max_va_frac (double _max_va)
 
bool import_structure_occupation (const fs::path &pos_path, std::string &imported_name, jsonParser &relaxation_properties, std::vector< Index > &best_assignment, Eigen::Matrix3d &cart_op) const
 imports structure specified by 'pos_path' into primclex() by finding optimal mapping and then setting displacements and strain to zero (only the mapped occupation is preserved) More...
 
bool import_structure_occupation (BasicStructure< Site > &_struc, std::string &imported_name, jsonParser &relaxation_properties, std::vector< Index > &best_assignment, Eigen::Matrix3d &cart_op, bool update_struc=false) const
 imports structure specified by '_struc' into primclex() More...
 
bool import_structure_occupation (BasicStructure< Site > &_struc, const Configuration *hint_ptr, std::string &imported_name, jsonParser &relaxation_properties, std::vector< Index > &best_assignment, Eigen::Matrix3d &cart_op, bool update_struc=false) const
 imports structure specified by '_struc' into primclex() More...
 
bool import_structure (const fs::path &pos_path, std::string &imported_name, jsonParser &relaxation_properties, std::vector< Index > &best_assignment, Eigen::Matrix3d &cart_op) const
 imports structure specified by 'pos_path' into primclex() by finding optimal mapping unlike import_structure_occupation, displacements and strain are preserved More...
 
bool import_structure (const BasicStructure< Site > &_struc, std::string &imported_name, jsonParser &relaxation_properties, std::vector< Index > &best_assignment, Eigen::Matrix3d &cart_op) const
 imports structure specified by '_struc' into primclex() by finding optimal mapping unlike import_structure_occupation, displacements and strain are preserved More...
 
bool struc_to_configdof (const BasicStructure< Site > &_struc, ConfigDoF &mapped_configdof, Lattice &mapped_lat) const
 Low-level routine to map a structure onto a ConfigDof. More...
 
bool struc_to_configdof (const BasicStructure< Site > &_struc, ConfigDoF &mapped_configdof, Lattice &mapped_lat, std::vector< Index > &best_assignment, Eigen::Matrix3d &cart_op, double best_cost=1e20) const
 Low-level routine to map a structure onto a ConfigDof. More...
 
bool ideal_struc_to_configdof (const BasicStructure< Site > &struc, ConfigDoF &mapped_config_dof, Lattice &mapped_lat, std::vector< Index > &best_assignment, Eigen::Matrix3d &cart_op) const
 Low-level routine to map a structure onto a ConfigDof if it is known to be ideal. More...
 
bool deformed_struc_to_configdof (const BasicStructure< Site > &_struc, ConfigDoF &mapped_config_dof, Lattice &mapped_lat, std::vector< Index > &best_assignment, Eigen::Matrix3d &cart_op, double best_cost=1e20) const
 Low-level routine to map a structure onto a ConfigDof. Does not assume structure is ideal. More...
 
bool deformed_struc_to_configdof_of_lattice (const BasicStructure< Site > &struc, const Lattice &imposed_lat, double &best_cost, ConfigDoF &mapped_configdof, Lattice &mapped_lat, std::vector< Index > &best_assignment, Eigen::Matrix3d &cart_op) const
 Low-level routine to map a structure onto a ConfigDof assuming a specific Lattice, without assuming structure is ideal Will only identify mappings better than best_cost, and best_cost is updated to reflect cost of best mapping identified. More...
 

Private Member Functions

const std::vector< Lattice > & _lattices_of_vol (Index prim_vol) const
 

Private Attributes

PrimClexm_pclex
 
std::map< Index, std::vector
< Lattice > > 
m_superlat_map
 
double m_lattice_weight
 
double m_max_volume_change
 
double m_min_va_frac
 
double m_max_va_frac
 
bool m_robust_flag
 
bool m_strict_flag
 
bool m_rotate_flag
 
double m_tol
 
std::vector< std::pair
< std::string, Index > > 
m_fixed_components
 

Constructor & Destructor Documentation

CASM::ConfigMapper::ConfigMapper ( NullInitializer  )
inline

Default construction not allowed – this constructor provides an override.

Definition at line 28 of file ConfigMapping.hh.

CASM::ConfigMapper::ConfigMapper ( PrimClex _pclex,
double  _lattice_weight,
double  _max_volume_change = 0.5,
int  _options = robust,
double  _tol = TOL 
)

Construct and initialize a ConfigMapper.

Parameters
_pclexthe PrimClex that describes the crystal template
_lattice_weightfree parameter 'w' in the cost function: total_cost = w*lattice_deformation+(1-w)*basis_deformation can vary between 0 (completely basis-focused) and 1 (completely lattice-focused)
Parameters
_max_volume_changeconstrains the search space by assuming a limit on allowed volume change only taken into account when non-interstitial vacancies are allowed
Parameters
_optionsspecify a combination of ConfigMapper::Options using bitwise OR: Ex. _options=ConfigMapper::rotate|ConfigMapper::strict Options are: 'rotate': removes rigid rotation of the imported crystal, in a least-squares sense (i.e., yields a symmetric deformation tensor) 'robust': does not assume the imported structure might be ideal ('robust' is much slower for importing ideal structures, but if 'robust' is not set and a non-ideal structure is passed, this will be almost always be detected and robust methods will be used instead. Thus, 'robust' is slightly faster if imported Structures are not ideal) 'strict': prevents transformation into canonical form. Tries to preserve original orientation of imported structure if possible
Parameters
_toltolerance for mapping comparisons

Definition at line 91 of file ConfigMapping.cc.

Member Function Documentation

const std::vector< Lattice > & CASM::ConfigMapper::_lattices_of_vol ( Index  prim_vol) const
private

Definition at line 743 of file ConfigMapping.cc.

bool CASM::ConfigMapper::deformed_struc_to_configdof ( const BasicStructure< Site > &  _struc,
ConfigDoF mapped_config_dof,
Lattice mapped_lat,
std::vector< Index > &  best_assignment,
Eigen::Matrix3d &  cart_op,
double  best_cost = 1e20 
) const

Low-level routine to map a structure onto a ConfigDof. Does not assume structure is ideal.

Parameters
mapped_configdof[out]ConfigDoF that is result of mapping procedure
mapped_lat[out]Ideal supercell lattice (in Niggli form) of mapped configuration
best_assignment[out]populated by the permutation of sites in the imported structure that maps them onto sites of the ideal crystal (excluding vacancies)
best_cost[in]optional parameter. Method will return false of no mapping is found better than 'best_cost'

Definition at line 478 of file ConfigMapping.cc.

bool CASM::ConfigMapper::deformed_struc_to_configdof_of_lattice ( const BasicStructure< Site > &  struc,
const Lattice imposed_lat,
double &  best_cost,
ConfigDoF mapped_configdof,
Lattice mapped_lat,
std::vector< Index > &  best_assignment,
Eigen::Matrix3d &  cart_op 
) const

Low-level routine to map a structure onto a ConfigDof assuming a specific Lattice, without assuming structure is ideal Will only identify mappings better than best_cost, and best_cost is updated to reflect cost of best mapping identified.

Parameters
imposed_lat[in]Supercell Lattice onto which struc will be mapped
best_costImposes an upper bound on cost of any mapping considered, and is updated to reflect best mapping encountered
mapped_configdof[out]ConfigDoF that is result of mapping procedure
best_assignment[out]populated by the permutation of sites in the imported structure that maps them onto sites of the ideal crystal (excluding vacancies)

Definition at line 624 of file ConfigMapping.cc.

bool CASM::ConfigMapper::ideal_struc_to_configdof ( const BasicStructure< Site > &  struc,
ConfigDoF mapped_config_dof,
Lattice mapped_lat,
std::vector< Index > &  best_assignment,
Eigen::Matrix3d &  cart_op 
) const

Low-level routine to map a structure onto a ConfigDof if it is known to be ideal.

Parameters
mapped_configdof[out]ConfigDoF that is result of mapping procedure
mapped_lat[out]Ideal supercell lattice (in Niggli form) of mapped configuration
best_assignment[out]populated by the permutation of sites in the imported structure that maps them onto sites of the ideal crystal (excluding vacancies)

Definition at line 420 of file ConfigMapping.cc.

bool CASM::ConfigMapper::import_structure ( const fs::path &  pos_path,
std::string &  imported_name,
jsonParser relaxation_properties,
std::vector< Index > &  best_assignment,
Eigen::Matrix3d &  cart_op 
) const

imports structure specified by 'pos_path' into primclex() by finding optimal mapping unlike import_structure_occupation, displacements and strain are preserved

Parameters
imported_name[out]populated by the configname given to the imported structure (or an existing equivalent structure if one exists)
Parameters
relaxation_properties[out]populated by relaxation properties: 'lattice_deformation': lattice mapping score 'basis_deformation': atomic mapping score 'volume_change': V/V_ideal 'relaxation_deformation': Not recorded in this case, because it is a DoF
Parameters
best_assignment[out]populated by the permutation of sites in the imported structure that maps them onto sites of the ideal crystal (excluding vacancies)
Parameters
cart_op[out]populated by the cartesian isometry that rotates the imported structure onto the coordinate system of the ideal crystal

Definition at line 289 of file ConfigMapping.cc.

bool CASM::ConfigMapper::import_structure ( const BasicStructure< Site > &  _struc,
std::string &  imported_name,
jsonParser relaxation_properties,
std::vector< Index > &  best_assignment,
Eigen::Matrix3d &  cart_op 
) const

imports structure specified by '_struc' into primclex() by finding optimal mapping unlike import_structure_occupation, displacements and strain are preserved

Definition at line 310 of file ConfigMapping.cc.

bool CASM::ConfigMapper::import_structure_occupation ( const fs::path &  pos_path,
std::string &  imported_name,
jsonParser relaxation_properties,
std::vector< Index > &  best_assignment,
Eigen::Matrix3d &  cart_op 
) const

imports structure specified by 'pos_path' into primclex() by finding optimal mapping and then setting displacements and strain to zero (only the mapped occupation is preserved)

Parameters
imported_nameis populated by the configname given to the imported structure (or an existing equivalent structure if one exists)
relaxation_propertiesis populated by relaxation properties: 'lattice_deformation': lattice mapping score 'basis_deformation': atomic mapping score 'volume_relaxation': V/V_ideal 'relaxation_deformation': 3x3 tensor describing cell relaxation
best_assignmentis populated by the permutation of sites in the imported structure that maps them onto sites of the ideal crystal (excluding vacancies)
cart_opis populated by the cartesian isometry that rotates the imported structure onto the coordinate system of the ideal crystal

Definition at line 114 of file ConfigMapping.cc.

bool CASM::ConfigMapper::import_structure_occupation ( BasicStructure< Site > &  _struc,
std::string &  imported_name,
jsonParser relaxation_properties,
std::vector< Index > &  best_assignment,
Eigen::Matrix3d &  cart_op,
bool  update_struc = false 
) const

imports structure specified by '_struc' into primclex()

Parameters
update_strucif true, applies lattice similarity and/or rotation to _struc. If false, _struc is unchanged update_struc=true is useful for preserving mapping info that is lost when only the occupation is imported

Definition at line 137 of file ConfigMapping.cc.

bool CASM::ConfigMapper::import_structure_occupation ( BasicStructure< Site > &  _struc,
const Configuration hint_ptr,
std::string &  imported_name,
jsonParser relaxation_properties,
std::vector< Index > &  best_assignment,
Eigen::Matrix3d &  cart_op,
bool  update_struc = false 
) const

imports structure specified by '_struc' into primclex()

Parameters
hint_ptr[in]provides a suggestion for which Configuration _struc should map onto The hint is used to reduce search times, but may be used in the future in combination with Option 'strict' to force mapping onto a particular configuration or be used to provide user reports of the form "Suggested mapping: 0.372; Optimal mapping: 0.002"
update_strucif true, applies lattice similarity and/or rotation to _struc. If false, _struc is unchanged update_struc=true is useful for preserving mapping info that is lost when only the occupation is imported

Definition at line 154 of file ConfigMapping.cc.

double CASM::ConfigMapper::lattice_weight ( ) const
inline

Definition at line 78 of file ConfigMapping.hh.

double CASM::ConfigMapper::max_va_frac ( ) const
inline

Definition at line 94 of file ConfigMapping.hh.

double CASM::ConfigMapper::min_va_frac ( ) const
inline

Definition at line 86 of file ConfigMapping.hh.

PrimClex& CASM::ConfigMapper::primclex ( ) const
inline

Definition at line 70 of file ConfigMapping.hh.

void CASM::ConfigMapper::set_lattice_weight ( double  _lw)
inline

Definition at line 82 of file ConfigMapping.hh.

void CASM::ConfigMapper::set_max_va_frac ( double  _max_va)
inline

Definition at line 98 of file ConfigMapping.hh.

void CASM::ConfigMapper::set_min_va_frac ( double  _min_va)
inline

Definition at line 90 of file ConfigMapping.hh.

void CASM::ConfigMapper::set_primclex ( PrimClex _pclex)
inline

Definition at line 74 of file ConfigMapping.hh.

bool CASM::ConfigMapper::struc_to_configdof ( const BasicStructure< Site > &  _struc,
ConfigDoF mapped_configdof,
Lattice mapped_lat 
) const

Low-level routine to map a structure onto a ConfigDof.

Parameters
mapped_configdof[out]ConfigDoF that is result of mapping procedure
mapped_lat[out]Ideal supercell lattice (in Niggli form) of mapped configuration

Definition at line 369 of file ConfigMapping.cc.

bool CASM::ConfigMapper::struc_to_configdof ( const BasicStructure< Site > &  _struc,
ConfigDoF mapped_configdof,
Lattice mapped_lat,
std::vector< Index > &  best_assignment,
Eigen::Matrix3d &  cart_op,
double  best_cost = 1e20 
) const

Low-level routine to map a structure onto a ConfigDof.

Parameters
mapped_configdof[out]ConfigDoF that is result of mapping procedure
mapped_lat[out]Ideal supercell lattice (in Niggli form) of mapped configuration
best_assignment[out]populated by the permutation of sites in the imported structure that maps them onto sites of the ideal crystal (excluding vacancies)
best_cost[in]optional parameter. Method will return false of no mapping is found better than 'best_cost'

Definition at line 377 of file ConfigMapping.cc.

Member Data Documentation

std::vector<std::pair<std::string, Index> > CASM::ConfigMapper::m_fixed_components
private

Definition at line 276 of file ConfigMapping.hh.

double CASM::ConfigMapper::m_lattice_weight
private

Definition at line 270 of file ConfigMapping.hh.

double CASM::ConfigMapper::m_max_va_frac
private

Definition at line 273 of file ConfigMapping.hh.

double CASM::ConfigMapper::m_max_volume_change
private

Definition at line 271 of file ConfigMapping.hh.

double CASM::ConfigMapper::m_min_va_frac
private

Definition at line 272 of file ConfigMapping.hh.

PrimClex* CASM::ConfigMapper::m_pclex
private

Definition at line 268 of file ConfigMapping.hh.

bool CASM::ConfigMapper::m_robust_flag
private

Definition at line 274 of file ConfigMapping.hh.

bool CASM::ConfigMapper::m_rotate_flag
private

Definition at line 274 of file ConfigMapping.hh.

bool CASM::ConfigMapper::m_strict_flag
private

Definition at line 274 of file ConfigMapping.hh.

std::map<Index, std::vector<Lattice> > CASM::ConfigMapper::m_superlat_map
mutableprivate

Definition at line 269 of file ConfigMapping.hh.

double CASM::ConfigMapper::m_tol
private

Definition at line 275 of file ConfigMapping.hh.


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