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

#include <Clexulator.hh>

Detailed Description

Evaluates correlations.

CASM generates code for very efficient calculation of basis functions via the print_clexulator function. This source code may be compiled, linked, and used at runtime via Clexulator.

Definition at line 240 of file Clexulator.hh.

Public Types

typedef
Clexulator_impl::Base::size_type 
size_type
 

Public Member Functions

 Clexulator ()
 
 Clexulator (std::string name, boost::filesystem::path dirpath, PrimNeighborList &nlist, const Logging &logging, std::string compile_options, std::string so_options)
 Construct a Clexulator. More...
 
 Clexulator (const Clexulator &B)
 Copy constructor. More...
 
 Clexulator (Clexulator &&B)
 Move constructor. More...
 
 ~Clexulator ()
 
Clexulatoroperator= (Clexulator B)
 Assignment operator. More...
 
bool initialized () const
 Is runtime library loaded? More...
 
std::string name () const
 Name. More...
 
size_type nlist_size () const
 Neighbor list size. More...
 
size_type corr_size () const
 Number of correlations. More...
 
const std::set< UnitCellCoord > & neighborhood () const
 The UnitCellCoord involved in calculating the basis functions, relative origin UnitCell. More...
 
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. More...
 
const
PrimNeighborList::Matrix3Type
weight_matrix () const
 The weight matrix used for ordering the neighbor list. More...
 
void set_config_occ (const int *_occ_ptr)
 Set pointer to data structure containing occupation variables. More...
 
void set_nlist (const long int *_nlist_ptr)
 Set pointer to neighbor list. More...
 
void calc_global_corr_contribution (double *corr_begin) const
 Calculate contribution to global correlations from one unit cell. More...
 
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. More...
 
void calc_point_corr (int b_index, double *corr_begin) const
 Calculate point correlations about basis site 'b_index'. More...
 
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'. More...
 
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. More...
 
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. More...
 

Private Attributes

std::string m_name
 
std::unique_ptr
< Clexulator_impl::Base
m_clex
 
std::shared_ptr< RuntimeLibrarym_lib
 

Friends

void swap (Clexulator &first, Clexulator &second)
 Swap. More...
 

Member Typedef Documentation

Constructor & Destructor Documentation

CASM::Clexulator::Clexulator ( )
inline

Definition at line 247 of file Clexulator.hh.

CASM::Clexulator::Clexulator ( std::string  name,
boost::filesystem::path  dirpath,
PrimNeighborList nlist,
const Logging logging,
std::string  compile_options,
std::string  so_options 
)
inline

Construct a Clexulator.

Parameters
nameClass name for the Clexulator, typically 'X_Clexulator', with X referring to the system of interest (i.e. 'NiAl_Clexulator')
dirpathDirectory containing the source code and compiled object file.
nlist,APrimNeighborList to be updated to include the neighborhood of this Clexulator
loggingPrint messages to inform users that compilation is occuring
compile_optionsCompilation options
so_optionsShared library compilation options

If 'name' is 'X_Clexulator', and 'dirpath' is '/path/to':

  • Looks for '/path/to/X_Clexulator.so' and tries to load it.
  • If not found, looks for 'path/to/X_Clexulator.cc' and tries to compile and load it.
  • If unsuccesful, will throw std::runtime_error.

The Clexulator has shared ownership of the loaded library, so it is preferrable to duplicate the Clexulator using it's copy constructor rather than construct another using this constructor which will re-load the library.

Definition at line 269 of file Clexulator.hh.

CASM::Clexulator::Clexulator ( const Clexulator B)
inline

Copy constructor.

Definition at line 317 of file Clexulator.hh.

CASM::Clexulator::Clexulator ( Clexulator &&  B)
inline

Move constructor.

Definition at line 327 of file Clexulator.hh.

CASM::Clexulator::~Clexulator ( )
inline

Definition at line 331 of file Clexulator.hh.

Member Function Documentation

void CASM::Clexulator::calc_delta_point_corr ( int  b_index,
int  occ_i,
int  occ_f,
double *  corr_begin 
) const
inline

Calculate the change in point correlations due to changing an occupant.

b_index Basis site index about which to calculate correlations occ_i,occ_f Initial and final occupant variable corr_begin Pointer to beginning of data structure where difference in correlations are written

Call using:

myclexulator.set_config_occ(my_configdof.occupation().begin());
UnitCellCoord bijk(b,i,j,k); // b,i,j,k of site to get delta point correlations
int l_index = my_supercell.find(bijk); // Linear index of site in Configuration
myclexulator.set_nlist(my_supercell.get_nlist(l_index).begin());
int occ_i=0, occ_f=1; // Swap from occupant 0 to occupant 1
myclexulator.calc_delta_point_corr(b, occ_i, occ_f, correlation_array.begin());

Definition at line 507 of file Clexulator.hh.

void CASM::Clexulator::calc_global_corr_contribution ( double *  corr_begin) const
inline

Calculate contribution to global correlations from one unit cell.

Parameters
corr_beginPointer to beginning of data structure where correlations are written

Call using:

myclexulator.set_config_occ(my_configdof.occupation().begin());
UnitCellCoord bijk(0,i,j,k); // i,j,k of unit cell to get contribution from
int l_index = my_supercell.find(bijk); // Linear index of site in Configuration
myclexulator.set_nlist(my_supercell.get_nlist(l_index).begin());
myclexulator.calc_global_corr_contribution(correlation_array.begin());

Definition at line 430 of file Clexulator.hh.

void CASM::Clexulator::calc_point_corr ( int  b_index,
double *  corr_begin 
) const
inline

Calculate point correlations about basis site 'b_index'.

b_index Basis site index about which to calculate correlations corr_begin Pointer to beginning of data structure where correlations are written

Call using:

myclexulator.set_config_occ(my_configdof.occupation().begin());
UnitCellCoord bijk(b,i,j,k); // b,i,j,k of site to get point correlations
int l_index = my_supercell.find(bijk); // Linear index of site in Configuration
myclexulator.set_nlist(my_supercell.get_nlist(l_index).begin());
myclexulator.calc_point_corr(b, correlation_array.begin());

Definition at line 467 of file Clexulator.hh.

void CASM::Clexulator::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
inline

Calculate the change in select point correlations due to changing an occupant.

b_index Basis site index about which to calculate correlations occ_i,occ_f Initial and final occupant variable corr_begin Pointer to beginning of data structure where difference in correlations are written

Parameters
ind_list_begin,ind_list_endPointers to range indicating which correlations should be calculated

Call using:

myclexulator.set_config_occ(my_configdof.occupation().begin());
UnitCellCoord bijk(b,i,j,k); // b,i,j,k of site to get delta point correlations
int l_index = my_supercell.find(bijk); // Linear index of site in Configuration
myclexulator.set_nlist(my_supercell.get_nlist(l_index).begin());
int occ_i=0, occ_f=1; // Swap from occupant 0 to occupant 1
std::vector<int> ind_list = {0, 2, 4, 6}; // Get contribution to correlations 0, 2, 4, and 6
myclexulator.calc_restricted_delta_point_corr(b, occ_i, occ_f, correlation_array.begin(), ind_list.begin(), ind_list.end());

Definition at line 529 of file Clexulator.hh.

void CASM::Clexulator::calc_restricted_global_corr_contribution ( double *  corr_begin,
size_type const *  ind_list_begin,
size_type const *  ind_list_end 
) const
inline

Calculate contribution to select global correlations from one unit cell.

Parameters
corr_beginPointer to beginning of data structure where correlations are written
ind_list_begin,ind_list_endPointers to range indicating which correlations should be calculated

Call using:

myclexulator.set_config_occ(my_configdof.occupation().begin());
UnitCellCoord bijk(0,i,j,k); // i,j,k of unit cell to get contribution from
int l_index = my_supercell.find(bijk); // Linear index of site in Configuration
myclexulator.set_nlist(my_supercell.get_nlist(l_index).begin());
std::vector<int> ind_list = {0, 2, 4, 6}; // Get contribution to correlations 0, 2, 4, and 6
myclexulator.calc_restricted_global_corr_contribution(correlation_array.begin(), ind_list.begin(), ind_list.end());

Definition at line 449 of file Clexulator.hh.

void CASM::Clexulator::calc_restricted_point_corr ( int  b_index,
double *  corr_begin,
size_type const *  ind_list_begin,
size_type const *  ind_list_end 
) const
inline

Calculate select point correlations about basis site 'b_index'.

b_index Basis site index about which to calculate correlations corr_begin Pointer to beginning of data structure where correlations are written

Parameters
ind_list_begin,ind_list_endPointers to range indicating which correlations should be calculated

Call using:

myclexulator.set_config_occ(my_configdof.occupation().begin());
UnitCellCoord bijk(b,i,j,k); // b,i,j,k of site to get point correlations
int l_index = my_supercell.find(bijk); // Linear index of site in Configuration
myclexulator.set_nlist(my_supercell.get_nlist(l_index).begin());
std::vector<int> ind_list = {0, 2, 4, 6}; // Get contribution to correlations 0, 2, 4, and 6
myclexulator.calc_restricted_point_corr(b, correlation_array.begin(), ind_list.begin(), ind_list.end());

Definition at line 487 of file Clexulator.hh.

size_type CASM::Clexulator::corr_size ( ) const
inline

Number of correlations.

Definition at line 370 of file Clexulator.hh.

bool CASM::Clexulator::initialized ( ) const
inline

Is runtime library loaded?

Definition at line 355 of file Clexulator.hh.

std::string CASM::Clexulator::name ( ) const
inline

Name.

Definition at line 360 of file Clexulator.hh.

const std::set<UnitCellCoord>& CASM::Clexulator::neighborhood ( ) const
inline

The UnitCellCoord involved in calculating the basis functions, relative origin UnitCell.

Definition at line 376 of file Clexulator.hh.

const std::set<UnitCellCoord>& CASM::Clexulator::neighborhood ( size_type  linear_orbit_index) const
inline

The UnitCellCoord involved in calculating the basis functions for a particular orbit, relative origin UnitCell.

Definition at line 382 of file Clexulator.hh.

size_type CASM::Clexulator::nlist_size ( ) const
inline

Neighbor list size.

Definition at line 365 of file Clexulator.hh.

Clexulator& CASM::Clexulator::operator= ( Clexulator  B)
inline

Assignment operator.

Definition at line 337 of file Clexulator.hh.

void CASM::Clexulator::set_config_occ ( const int *  _occ_ptr)
inline

Set pointer to data structure containing occupation variables.

Parameters
_occ_ptrPointer to beginning of data structure containing occupation variables

Call using:

myclexulator.set_config_occ(my_configdof.occupation().begin());

Definition at line 400 of file Clexulator.hh.

void CASM::Clexulator::set_nlist ( const long int *  _nlist_ptr)
inline

Set pointer to neighbor list.

Call using:

UnitCellCoord bijk(b,i,j,k); // UnitCellCoord of site in Configuration
int l_index = my_supercell.find(bijk); // Linear index of site in Configuration
myclexulator.set_nlist(my_supercell.get_nlist(l_index).begin());

Definition at line 413 of file Clexulator.hh.

const PrimNeighborList::Matrix3Type& CASM::Clexulator::weight_matrix ( ) const
inline

The weight matrix used for ordering the neighbor list.

Definition at line 387 of file Clexulator.hh.

Friends And Related Function Documentation

void swap ( Clexulator first,
Clexulator second 
)
friend

Swap.

Definition at line 345 of file Clexulator.hh.

Member Data Documentation

std::unique_ptr<Clexulator_impl::Base> CASM::Clexulator::m_clex
private

Definition at line 542 of file Clexulator.hh.

std::shared_ptr<RuntimeLibrary> CASM::Clexulator::m_lib
private

Definition at line 543 of file Clexulator.hh.

std::string CASM::Clexulator::m_name
private

Definition at line 541 of file Clexulator.hh.


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