CASM
AClustersApproachtoStatisticalMechanics
|
#include <ConfigMapping.hh>
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... | |
PrimClex & | primclex () 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 | |
PrimClex * | m_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 |
|
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.
_pclex | the PrimClex that describes the crystal template |
_lattice_weight | free 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) |
_max_volume_change | constrains the search space by assuming a limit on allowed volume change only taken into account when non-interstitial vacancies are allowed |
_options | specify 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 |
_tol | tolerance for mapping comparisons |
Definition at line 91 of file ConfigMapping.cc.
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.
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.
imposed_lat[in] | Supercell Lattice onto which struc will be mapped |
best_cost | Imposes 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.
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
imported_name[out] | populated by the configname given to the imported structure (or an existing equivalent structure if one exists) |
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 |
best_assignment[out] | populated by the permutation of sites in the imported structure that maps them onto sites of the ideal crystal (excluding vacancies) |
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)
imported_name | is populated by the configname given to the imported structure (or an existing equivalent structure if one exists) |
relaxation_properties | is 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_assignment | is populated by the permutation of sites in the imported structure that maps them onto sites of the ideal crystal (excluding vacancies) |
cart_op | is 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()
update_struc | if 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()
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_struc | if 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.
|
inline |
Definition at line 78 of file ConfigMapping.hh.
|
inline |
Definition at line 94 of file ConfigMapping.hh.
|
inline |
Definition at line 86 of file ConfigMapping.hh.
|
inline |
Definition at line 70 of file ConfigMapping.hh.
|
inline |
Definition at line 82 of file ConfigMapping.hh.
|
inline |
Definition at line 98 of file ConfigMapping.hh.
|
inline |
Definition at line 90 of file ConfigMapping.hh.
|
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.
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.
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.
|
private |
Definition at line 276 of file ConfigMapping.hh.
|
private |
Definition at line 270 of file ConfigMapping.hh.
|
private |
Definition at line 273 of file ConfigMapping.hh.
|
private |
Definition at line 271 of file ConfigMapping.hh.
|
private |
Definition at line 272 of file ConfigMapping.hh.
|
private |
Definition at line 268 of file ConfigMapping.hh.
|
private |
Definition at line 274 of file ConfigMapping.hh.
|
private |
Definition at line 274 of file ConfigMapping.hh.
|
private |
Definition at line 274 of file ConfigMapping.hh.
Definition at line 269 of file ConfigMapping.hh.
|
private |
Definition at line 275 of file ConfigMapping.hh.