13 namespace Clexulator_impl {
23 Base(size_type _nlist_size, size_type _corr_size) :
40 std::unique_ptr<Base>
clone()
const {
41 return std::unique_ptr<Base>(
_clone());
52 const std::set<UnitCellCoord> &
neighborhood(size_type linear_orbit_index)
const {
134 virtual void calc_point_corr(
int b_index,
double *corr_begin)
const = 0;
152 virtual void calc_restricted_point_corr(
int b_index,
double *corr_begin, size_type
const *ind_list_begin, size_type
const *ind_list_end)
const = 0;
194 size_type
const *ind_list_begin,
195 size_type
const *ind_list_end)
const = 0;
273 std::string compile_options,
274 std::string so_options) {
276 namespace fs = boost::filesystem;
280 m_lib = std::make_shared<RuntimeLibrary>(
281 (dirpath /
name).
string(),
284 "compile time depends on how many basis functions are included");
286 catch(std::exception &e) {
287 logging.
log() <<
"Clexulator construction failed: could not construct runtime library." << std::endl;
292 std::function<Clexulator_impl::Base* (void)> factory;
300 std::cerr <<
"Error in Clexulator constructor: weight matrix of neighbor "
301 "list does not match the weight matrix used to print the "
302 "clexulator." << std::endl;
303 std::cerr <<
"nlist weight matrix: \n" << nlist.
weight_matrix() << std::endl;
304 std::cerr <<
"clexulator weight matrix: \n" <<
m_clex->weight_matrix() << std::endl;
305 throw std::runtime_error(
306 "Error in Clexulator constructor: weight matrix of neighbor list does "
307 "not match the weight matrix used to print the clexulator. Try 'casm bset -uf'.");
321 if(B.
m_clex.get() !=
nullptr) {
356 return m_lib.get() !=
nullptr;
366 return m_clex->nlist_size();
371 return m_clex->corr_size();
377 return m_clex->neighborhood();
382 const std::set<UnitCellCoord> &
neighborhood(size_type linear_orbit_index)
const {
383 return m_clex->neighborhood(linear_orbit_index);
388 return m_clex->weight_matrix();
401 return m_clex->set_config_occ(_occ_ptr);
414 return m_clex->set_nlist(_nlist_ptr);
431 m_clex->calc_global_corr_contribution(corr_begin);
450 m_clex->calc_restricted_global_corr_contribution(corr_begin, ind_list_begin, ind_list_end);
468 m_clex->calc_point_corr(b_index, corr_begin);
488 m_clex->calc_restricted_point_corr(b_index, corr_begin, ind_list_begin, ind_list_end);
508 m_clex->calc_delta_point_corr(b_index, occ_i, occ_f, corr_begin);
533 size_type
const *ind_list_begin,
534 size_type
const *ind_list_end)
const {
535 m_clex->calc_restricted_delta_point_corr(b_index, occ_i, occ_f, corr_begin, ind_list_begin, ind_list_end);
542 std::unique_ptr<Clexulator_impl::Base>
m_clex;
543 std::shared_ptr<RuntimeLibrary>
m_lib;
friend void swap(Clexulator &first, Clexulator &second)
Swap.
std::vector< std::set< UnitCellCoord > > m_orbit_neighborhood
The UnitCellCoord involved in calculating the basis functions for a particular orbit, relative origin UnitCell.
size_type m_nlist_size
The neighbor list size.
std::shared_ptr< RuntimeLibrary > m_lib
virtual void calc_delta_point_corr(int b_index, int occ_i, int occ_f, double *corr_begin) const =0
Calculate the change in point correlations due to changing an occupant.
const PrimNeighborList::Matrix3Type & weight_matrix() const
The weight matrix used for ordering the neighbor list.
Clexulator_impl::Base::size_type size_type
Clexulator(const Clexulator &B)
Copy constructor.
size_type m_corr_size
The number of correlations.
void set_config_occ(const int *_occ_ptr)
Set pointer to data structure containing occupation variables.
bool initialized() const
Is runtime library loaded?
size_type corr_size() const
Number of correlations.
size_type corr_size() const
Number of correlations.
virtual void calc_global_corr_contribution(double *corr_begin) const =0
Calculate contribution to global correlations from one unit cell.
void expand(UnitCellCoord uccoord)
Expand the neighbor list to include the given UnitCellCoord.
const std::set< UnitCellCoord > & neighborhood() const
The UnitCellCoord involved in calculating the basis functions, relative origin UnitCell.
size_type nlist_size() const
Neighbor list size.
PrimNeighborList::Matrix3Type m_weight_matrix
The weight matrix used for ordering the neighbor list.
void calc_point_corr(int b_index, double *corr_begin) const
Calculate point correlations about basis site 'b_index'.
Clexulator(std::string name, boost::filesystem::path dirpath, PrimNeighborList &nlist, const Logging &logging, std::string compile_options, std::string so_options)
Construct a Clexulator.
void calc_restricted_global_corr_contribution(double *corr_begin, size_type const *ind_list_begin, size_type const *ind_list_end) const
Calculate contribution to select global correlations from one unit cell.
void swap(ConfigDoF &A, ConfigDoF &B)
size_type nlist_size() const
Neighbor list size.
void set_config_occ(const int *_occ_ptr)
Set pointer to data structure containing occupation variables.
void calc_global_corr_contribution(double *corr_begin) const
Calculate contribution to global correlations from one unit cell.
void calc_delta_point_corr(int b_index, int occ_i, int occ_f, double *corr_begin) const
Calculate the change in point correlations due to changing an occupant.
std::unique_ptr< Clexulator_impl::Base > m_clex
const long int * m_nlist_ptr
Pointer to neighbor list.
std::string name() const
Name.
virtual void calc_restricted_global_corr_contribution(double *corr_begin, size_type const *ind_list_begin, size_type const *ind_list_end) const =0
Calculate contribution to select global correlations from one unit cell.
const PrimNeighborList::Matrix3Type & weight_matrix() const
The weight matrix used for ordering the neighbor list.
void calc_restricted_point_corr(int b_index, double *corr_begin, size_type const *ind_list_begin, size_type const *ind_list_end) const
Calculate select point correlations about basis site 'b_index'.
virtual void calc_restricted_point_corr(int b_index, double *corr_begin, size_type const *ind_list_begin, size_type const *ind_list_end) const =0
Calculate select point correlations about basis site 'b_index'.
const std::set< UnitCellCoord > & neighborhood() const
The UnitCellCoord involved in calculating the basis functions, relative origin UnitCell.
const std::set< UnitCellCoord > & neighborhood(size_type linear_orbit_index) const
The UnitCellCoord involved in calculating the basis functions for a particular orbit, relative origin UnitCell.
void calc_restricted_delta_point_corr(int b_index, int occ_i, int occ_f, double *corr_begin, size_type const *ind_list_begin, size_type const *ind_list_end) const
Calculate the change in select point correlations due to changing an occupant.
virtual void calc_point_corr(int b_index, double *corr_begin) const =0
Calculate point correlations about basis site 'b_index'.
const int * m_occ_ptr
Pointer to beginning of data structure containing occupation variables.
The PrimNeighborList gives the coordinates of UnitCell that are neighbors of the origin UnitCell...
virtual void calc_restricted_delta_point_corr(int b_index, int occ_i, int occ_f, double *corr_begin, size_type const *ind_list_begin, size_type const *ind_list_end) const =0
Calculate the change in select point correlations due to changing an occupant.
void set_nlist(const long int *_nlist_ptr)
Set pointer to neighbor list.
virtual Base * _clone() const =0
Clone the Clexulator.
void set_nlist(const long int *_nlist_ptr)
Set pointer to neighbor list.
Matrix3Type weight_matrix() const
Return the weighting matrix W used to define the canonical order.
Eigen::Matrix3l Matrix3Type
Abstract base class for cluster expansion correlation calculations.
std::unique_ptr< Base > clone() const
Clone the Clexulator.
Base(size_type _nlist_size, size_type _corr_size)
Clexulator(Clexulator &&B)
Move constructor.
Clexulator & operator=(Clexulator B)
Assignment operator.
std::set< UnitCellCoord > m_neighborhood
The UnitCellCoord involved in calculating the basis functions, relative origin UnitCell.
const std::set< UnitCellCoord > & neighborhood(size_type linear_orbit_index) const
The UnitCellCoord involved in calculating the basis functions for a particular orbit, relative origin UnitCell.