DiagMC
Diagrammatic Monte Carlo simulation of a 2-level spin system in a magnetic field
|
This class is the base class of Diagram, and should not be used directly, aside from testing functionalities. It contains the variables defining the diagram and the DETERMINISTIC part of the routines to perform updates, excluding the random number extraction, which is instead handled by the Diagram class. More...
#include <diagram.h>
Public Member Functions | |
Diagram_core (double beta, int s0, double H, double GAMMA, std::list< double > vertices=std::list< double >()) | |
Construct a new diagram, setting its defining parameters. The list of vertices is optional: by default it is the 0-th order diagram [0]----—[beta]. More... | |
bool | operator== (const Diagram_core &other) const |
operator to test wether two Diagram_core objects are equal. It is intended for TESTING purposes only, and not to be used within the program. It checks that all values defining a diagram (beta, s0, H, GAMMA and each vertex in the vertices list) of the two Diagram_core objects are within EPSILON = 1e-10 from each other. EPSILON is defined at the beginning of diagram.h More... | |
bool | operator!= (const Diagram_core &other) const |
operator to test wether two Diagram_core objects are different. It is the negation of operator==. It is intended for TESTING purposes only, and not to be used within the program. More... | |
double | operator/ (const Diagram_core &other) const |
Returns the ratio of the weights of the two diagrams, i.e. this->value()/other.value() More... | |
double | sum_deltatau () const |
Small helper function, performing the sum (... +t4-t3 + t2-t1) More... | |
double | value () const |
Returns the value ("weight") of the current diagram. More... | |
size_t | order () const |
Get the order of the diagram (number of _vertices) More... | |
double | get_beta () const |
Get the value of _beta (length of the diagram) More... | |
int | get_s0 () const |
Get the value of the spin of the 0-th segment of the diagram [0—t1]. More... | |
double | get_H () const |
Get the value of the longitudinal field _H. More... | |
double | get_GAMMA () const |
Get the value of the transverse field _GAMMA. More... | |
std::list< double > | get_vertices () const |
Get a copy of the list of _vertices. More... | |
double | acceptance_rate_add (double tau1, double tau2, double tau2max, double new_segment_spin) const |
Returns the acceptance rate for the ADD_SEGMENT update for the given parameters. More... | |
double | acceptance_rate_remove (double tau1, double tau2, double tau2max, double segment_toberemoved_spin) const |
Returns the acceptance rate for the REMOVE_SEGMENT update for the given parameters. More... | |
double | acceptance_rate_flip () const |
Returns the acceptance rate for the SPIN_FLIP update for the given parameter. More... | |
bool | attempt_add_segment (double RN1, double RN2, double RNacc) |
Attemps the ADD_SEGMENT update for the current status of the diagram, using the three random numbers given in input. More... | |
bool | attempt_remove_segment (double RN1, double RNacc) |
Attemps the REMOVE_SEGMENT update for the current status of the diagram, using the two random numbers given in input. More... | |
bool | attempt_spin_flip (double RNacc) |
Attemps the SPIN_FLIP update for the current status of the diagram, using the random number given in input. More... | |
Protected Member Functions | |
void | assert_parameters_validity (double beta, int s0, double H, double GAMMA, std::list< double > vertices) const |
Internal (non-public) member function that checks wether all the parameters are within the allowed values. Throws an std::invalid_argument exception otherwise. It is used in the Diagram_core constructor and in Diagram::reset_diagram. More... | |
Protected Attributes | |
double | _beta |
length of the diagram (here representing the thermondinamical beta = 1/T)). Must be > 0. More... | |
int | _s0 |
spin of the 0-th segment of the diagram [0—t1]. Must be +1 or -1 More... | |
double | _H |
value of the longitudinal component of magnetic field More... | |
double | _GAMMA |
Value of the transversal component of magnetic field. Must be != 0. More... | |
std::list< double > | _vertices |
list containing the times of the diagram vertices More... | |
This class is the base class of Diagram, and should not be used directly, aside from testing functionalities. It contains the variables defining the diagram and the DETERMINISTIC part of the routines to perform updates, excluding the random number extraction, which is instead handled by the Diagram class.
Diagram_core::Diagram_core | ( | double | beta, |
int | s0, | ||
double | H, | ||
double | GAMMA, | ||
std::list< double > | vertices = std::list< double >() |
||
) |
Construct a new diagram, setting its defining parameters. The list of vertices is optional: by default it is the 0-th order diagram [0]----—[beta].
beta | Length of the diagram (here representing the thermondinamical $\beta$ = 1/T). Must be > 0. |
s0 | Spin of the 0-th segment of the diagram [0—t1]. Must be +1 or -1. |
H | Value of the longitudinal component of magnetic field |
GAMMA | Value of the transversal component of magnetic field. Must be != 0. |
vertices | (optional) List containing the times of diagram _vertices, with t1<t2<t3... < _beta (they need to be already sorted) |
double Diagram_core::acceptance_rate_add | ( | double | tau1, |
double | tau2, | ||
double | tau2max, | ||
double | new_segment_spin | ||
) | const |
Returns the acceptance rate for the ADD_SEGMENT update for the given parameters.
tau1 | time of the first vertex of the segment to be added |
tau2 | time of the second vertex of the segment to be added |
tau2max | maximum value of tau2 for the random extraction |
new_segment_spin | spin of the segment to be added |
double Diagram_core::acceptance_rate_flip | ( | ) | const |
Returns the acceptance rate for the SPIN_FLIP update for the given parameter.
double Diagram_core::acceptance_rate_remove | ( | double | tau1, |
double | tau2, | ||
double | tau2max, | ||
double | segment_toberemoved_spin | ||
) | const |
Returns the acceptance rate for the REMOVE_SEGMENT update for the given parameters.
tau1 | time of the first vertex of the segment to be removed |
tau2 | time of the second vertex of the segment to be removed |
tau2max | maximum value of tau2 for the random extraction |
segment_toberemoved_spin | spin of the segment to be removed |
|
protected |
Internal (non-public) member function that checks wether all the parameters are within the allowed values. Throws an std::invalid_argument exception otherwise. It is used in the Diagram_core constructor and in Diagram::reset_diagram.
beta | Length of the diagram (here representing the thermondinamical $\beta$ = 1/T). Must be > 0. |
s0 | Spin of the 0-th segment of the diagram [0—t1]. Must be +1 or -1. |
H | Value of the longitudinal component of magnetic field |
GAMMA | Value of the transversal component of magnetic field. Must be != 0. |
vertices | (optional) List containing the times of diagram _vertices, with t1<t2<t3... < _beta (they need to be already sorted) |
bool Diagram_core::attempt_add_segment | ( | double | RN1, |
double | RN2, | ||
double | RNacc | ||
) |
Attemps the ADD_SEGMENT update for the current status of the diagram, using the three random numbers given in input.
RN1 | Random number for the extraction of tau1, must be in range [0, 1] |
RN2 | Random number for the extraction of tau2, must be in range [0, 1] |
RNacc | Random number for the acceptance, should be in range [0,1] |
bool Diagram_core::attempt_remove_segment | ( | double | RN1, |
double | RNacc | ||
) |
Attemps the REMOVE_SEGMENT update for the current status of the diagram, using the two random numbers given in input.
RN1 | Random number for the extraction of first vertex, must be in range [0, 1] |
RNacc | Random number for the acceptance, should be in range [0,1] |
bool Diagram_core::attempt_spin_flip | ( | double | RNacc | ) |
Attemps the SPIN_FLIP update for the current status of the diagram, using the random number given in input.
RNacc | Random number for the acceptance, should be in range [0,1] |
double Diagram_core::get_beta | ( | ) | const |
Get the value of _beta (length of the diagram)
double Diagram_core::get_GAMMA | ( | ) | const |
Get the value of the transverse field _GAMMA.
double Diagram_core::get_H | ( | ) | const |
Get the value of the longitudinal field _H.
int Diagram_core::get_s0 | ( | ) | const |
Get the value of the spin of the 0-th segment of the diagram [0—t1].
std::list< double > Diagram_core::get_vertices | ( | ) | const |
Get a copy of the list of _vertices.
bool Diagram_core::operator!= | ( | const Diagram_core & | other | ) | const |
operator to test wether two Diagram_core objects are different. It is the negation of operator==. It is intended for TESTING purposes only, and not to be used within the program.
other | other Diagram_core object |
double Diagram_core::operator/ | ( | const Diagram_core & | other | ) | const |
bool Diagram_core::operator== | ( | const Diagram_core & | other | ) | const |
operator to test wether two Diagram_core objects are equal. It is intended for TESTING purposes only, and not to be used within the program. It checks that all values defining a diagram (beta, s0, H, GAMMA and each vertex in the vertices list) of the two Diagram_core objects are within EPSILON = 1e-10 from each other. EPSILON is defined at the beginning of diagram.h
other | other Diagram_core object |
size_t Diagram_core::order | ( | ) | const |
Get the order of the diagram (number of _vertices)
double Diagram_core::sum_deltatau | ( | ) | const |
Small helper function, performing the sum (... +t4-t3 + t2-t1)
double Diagram_core::value | ( | ) | const |
Returns the value ("weight") of the current diagram.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |