CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
ConfigEnumInterpolation.cc
Go to the documentation of this file.
2 
3 extern "C" {
6  }
7 }
8 
9 namespace CASM {
10 
11  const std::string ConfigEnumInterpolation::enumerator_name = "ConfigEnumInterpolation";
12 
13  const std::string ConfigEnumInterpolation::interface_help =
14  "ConfigEnumInterpolation: \n\n"
15 
16  " ... include help documentation here ... \n\n";
17 
20  const jsonParser &_kwargs,
21  const Completer::EnumOption &enum_opt) {
22  throw std::runtime_error("ConfigEnumAllOccupations::run is not implemented");
23  }
24 
35  const value_type &_initial,
36  const value_type &_final,
37  Index _size):
39  m_current(_initial),
40  m_initial(_initial),
41  m_final(_final) {
42 
46 
47  // interpolated configurations must be compatible in the following ways:
48  if(m_initial.size() != m_final.size()
52 
53  std::string s = "Error: " + this->name() + " attempting to"
54  "interpolate between incompatible Configurations";
55 
56  throw std::runtime_error(s);
57  }
58 
61  }
62 
64  m_deformation_inc = (m_final.deformation() - m_initial.deformation()) / ((double) size() - 1);
65  }
66 
67  this->_initialize(&m_current);
68  _current().set_source(this->source(step()));
69  }
70 
73  if(current().has_displacement())
75 
76  if(current().has_deformation())
78 
79  _current().set_source(this->source(step()));
80  return &_current();
81  }
82 
83 }
84 
void reset_properties(ConfigDoF &_dof)
Definition: ConfigDoF.hh:202
ConfigEnumInterpolation(const value_type &_initial, const value_type &_final, Index _size)
Constructor.
void set_deformation(const Eigen::Matrix3d &_deformation)
Set applied strain.
const Array< int > & occupation() const
Occupant variables.
Configuration * at_step(step_type n) override
Implements goto_step.
PrimClex * primclex
Definition: settings.cc:101
CASM::EnumInterfaceBase * make_ConfigEnumInterpolation_interface()
Base class for generic use of enumerators that may be accessed through the API.
Definition: Enumerator.hh:418
virtual jsonParser source(step_type step) const
Definition: Enumerator.hh:131
void set_displacement(const displacement_matrix_t &_disp)
Set occupant displacements.
Main CASM namespace.
Definition: complete.cpp:8
static const std::string enumerator_name
Template class to be specialized for each enumerator that may be accessed via the API...
Definition: Enumerator.hh:521
value_type & _current()
Access the current ObjectType by reference.
Definition: Enumerator.hh:244
EigenIndex Index
For long integer indexing:
bool has_deformation() const
True if Configuration has strain DoF.
step_type step() const
Increments with each enumerated object.
Definition: Enumerator.hh:113
Base class for implementing specialized random access enumerators.
PrimClex is the top-level data structure for a CASM project.
Definition: PrimClex.hh:52
static const std::string interface_help
static int run(PrimClex &primclex, const jsonParser &kwargs, const Completer::EnumOption &enum_opt)
Index size() const
Returns number of sites, NOT the number of primitives that fit in here.
size_type size() const
Number of elements in enumerator.
void set_source(const jsonParser &source)
const displacement_matrix_t & displacement() const
Occupant displacements.
const Eigen::Matrix3d & deformation() const
Applied strain.
reference current() const
Access the current ObjectType by reference.
Definition: Enumerator.hh:232
std::string name() const override
Derived enumerators must implement name, via ENUM_MEMBERS.
bool has_displacement() const
True if Configuration has displacement DoF.
value_type::displacement_matrix_t m_displacement_inc
A Configuration represents the values of all degrees of freedom in a Supercell.