1 #ifndef CASM_Canonical_HH
2 #define CASM_Canonical_HH
62 std::pair<ConfigDoF, std::string>
set_state(
67 void set_state(
const CondType &new_conditions,
69 const std::string &msg =
"");
75 bool check(
const EventType &event);
78 void accept(
const EventType &event);
81 void reject(
const EventType &event);
84 std::cout <<
"corr:" << std::endl;
86 std::cout <<
"OK corr" << std::endl;
156 std::string colheader,
157 bool all_correlations)
const;
183 std::vector<OccSwap>::const_iterator begin,
184 std::vector<OccSwap>::const_iterator end);
void _print_correlations(const Eigen::VectorXd &corr, std::string title, std::string colheader, bool all_correlations) const
Print correlations to _log()
CanonicalEvent m_event
Event to propose, check, accept/reject:
ConfigDoF _enforce_conditions(const ConfigDoF &configdof)
Enforce composition by repeatedly applying grand canonical events.
CanonicalConditions m_condition
Conditions (T, mu). Initially determined by m_settings, but can be changed halfway through the run...
std::pair< ConfigDoF, std::string > set_state(const CanonicalConditions &new_conditions, const CanonicalSettings &settings)
Set configdof and conditions and clear previously collected data.
void _update_deltas(CanonicalEvent &event) const
Calculate delta properties for an event and update the event with those properties.
CanonicalSettings SettingsType
void set_conditions(const CondType &new_conditions)
Set conditions and clear previously collected data.
ConfigDoF & _configdof() const
Access current microstate.
const Eigen::VectorXd & comp_n() const
Number of atoms of each type, normalized per primitive cell.
Clexulator & clexulator(Log &status_log=null_log()) const
void set_configdof(const ConfigDoF &configdof, const std::string &msg="")
Set configdof and clear previously collected data.
Eigen::VectorXd & _corr()
Correlations, normalized per primitive cell.
const Configuration & config() const
const Access current microstate
Eigen::VectorXd * m_corr
Correlations, normalized per primitive cell.
ENSEMBLE
Monte Carlo ensemble type.
const ConfigDoF & configdof() const
const Access current microstate
OccLocation m_occ_loc
Keeps track of what sites have which occupants.
bool m_use_deltas
If the supercell is large enough, calculate delta correlations directly.
const double & potential_energy() const
Potential energy, normalized per primitive cell.
std::pair< ConfigDoF, std::string > _auto_motif(const CanonicalConditions &cond) const
Generate minimum potential energy ConfigDoF.
CanonicalConditions CondType
double * m_potential_energy
Potential energy, normalized per primitive cell.
std::pair< ConfigDoF, std::string > _restricted_auto_motif(const CanonicalConditions &cond) const
Generate minimum potential energy ConfigDoF for this supercell.
void write_results(Index cond_index) const
Write results to files.
bool check(const EventType &event)
Based on a random number, decide if the change in energy from the proposed event is low enough to be ...
double * m_formation_energy
Formation energy, normalized per primitive cell.
void _make_possible_swaps(const CanonicalSettings &settings)
Construct m_candidate, m_cand_to_index, m_occ_loc, m_canonical_swaps, m_grand_canonical_swaps.
bool m_all_correlations
If true, calculate all correlations; if false, calculate correlations with non-zero eci...
const Supercell & supercell() const
const Access the Supercell that *this is based on
EigenIndex Index
For long integer indexing:
Canonical(PrimClex &primclex, const SettingsType &settings, Log &_log)
Constructs a Canonical object and prepares it for running based on MonteSettings. ...
A container class for the different degrees of freedom a Configuration might have.
Eigen::VectorXd & _comp_n()
Number of atoms of each type, normalized per primitive cell.
const PrimClex & primclex() const
const Access the PrimClex that *this is based on
Clex m_formation_energy_clex
Holds Clexulator and ECI references.
void accept(const EventType &event)
Accept proposed event. Change configuration accordingly and update energies etc.
PrimClex is the top-level data structure for a CASM project.
std::vector< OccSwap >::const_iterator _find_grand_canonical_swap(const Configuration &config, std::vector< OccSwap >::const_iterator begin, std::vector< OccSwap >::const_iterator end)
Find a OccSwap to help enforce composition.
Data structure for storing information regarding a proposed grand canonical Monte Carlo event...
double & _formation_energy()
Formation energy, normalized per primitive cell.
const Eigen::VectorXd & corr() const
Correlations, normalized per primitive cell.
Conversions m_convert
Convert sublat/asym_unit and species/occ index.
List of asym / species_index pairs indicating allowed variable occupation dof.
ConfigIO::GenericConfigFormatter< std::string > configname()
Constructs DataFormmaterDictionary containing all Configuration DatumFormatters.
Interface base class for all types of Monte Carlo simulations (not meant to be used polymorphically) ...
const EventType & propose()
Propose a new event, calculate delta properties, and return reference to it.
const CondType & conditions() const
Return current conditions.
Eigen::VectorXd * m_comp_n
Number of atoms of each type, normalized per primitive cell.
OccCandidateList m_cand
Convert sublat/asym_unit and species/occ index.
Index steps_per_pass() const
Return number of steps per pass. Equals number of sites with variable occupation. ...
double & _potential_energy()
Potential energy, normalized per primitive cell.
void _calc_delta_point_corr(Index l, int new_occ, Eigen::VectorXd &dCorr_comp) const
ConfigDoF _configname_motif(const std::string &configname) const
Generate supercell filling ConfigDoF from configuration.
const ECIContainer & eci() const
void _set_nlist(Index l) const
void reject(const EventType &event)
Nothing needs to be done to reject a CanonicalEvent.
ConfigDoF _default_motif() const
Generate supercell filling ConfigDoF from default configuration.
Stores data to enable efficient proposal and update of occupation mutation.
static const Monte::ENSEMBLE ensemble
const ECIContainer & _eci() const
Clexulator & _clexulator() const
void _update_properties()
Calculate properties given current conditions.
Data structure used for cluster expansions.
Eigen::VectorXd correlations_vec(const ConfigDoF &configdof, const Supercell &scel, Clexulator &clexulator)
Returns correlations using 'clexulator'. Supercell needs a correctly populated neighbor list...
const MonteSettings & settings() const
const Access settings used for construction
A Configuration represents the values of all degrees of freedom in a Supercell.
const double & formation_energy() const
Formation energy, normalized per primitive cell.
void _set_dCorr(CanonicalEvent &event) const
Calculate delta correlations for an event.
A sparse container of ECI values and their corresponding orbit indices.