DiagMC
Diagrammatic Monte Carlo simulation of a 2-level spin system in a magnetic field
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Diagram Class Reference

This is the main Diagram class, containing the variables defining the diagram - inherited from Diagram_core - and the functions to attempt the updates. More...

#include <diagram.h>

Inheritance diagram for Diagram:
Inheritance graph
[legend]
Collaboration diagram for Diagram:
Collaboration graph
[legend]

Public Member Functions

 Diagram (double beta, int s0, double H, double GAMMA, std::list< double > _vertices=std::list< double >(), unsigned int seed=std::chrono::system_clock::now().time_since_epoch().count())
 Construct a new Diagram object, setting its defining parameters. The list of vertices is optional: by default it is the empty list, corresponding to the 0-th order diagram [0]----—[beta]. Optionally, a seed for the Mersenne-Twister random number generator can be explicitly set. More...
 
bool attempt_add_segment ()
 Attemps the ADD_SEGMENT update for the current status of the diagram. More...
 
bool attempt_remove_segment ()
 Attemps the REMOVE_SEGMENT update for the current status of the diagram. More...
 
bool attempt_spin_flip ()
 Attemps the SPIN_FLIP update for the current status of the diagram. More...
 
void reset_diagram (double beta, int s0, double H, double GAMMA, std::list< double > vertices=std::list< double >(), unsigned int seed=std::chrono::system_clock::now().time_since_epoch().count())
 Reset all diagram parameters with the new values. 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...
 
- Public Member Functions inherited from 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]. 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...
 

Additional Inherited Members

- Protected Member Functions inherited from Diagram_core
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 inherited from Diagram_core
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...
 

Detailed Description

This is the main Diagram class, containing the variables defining the diagram - inherited from Diagram_core - and the functions to attempt the updates.

Definition at line 221 of file diagram.h.

Constructor & Destructor Documentation

◆ Diagram()

Diagram::Diagram ( double  beta,
int  s0,
double  H,
double  GAMMA,
std::list< double >  _vertices = std::list< double >(),
unsigned int  seed = std::chrono::system_clock::now().time_since_epoch().count() 
)

Construct a new Diagram object, setting its defining parameters. The list of vertices is optional: by default it is the empty list, corresponding to the 0-th order diagram [0]----—[beta]. Optionally, a seed for the Mersenne-Twister random number generator can be explicitly set.

Parameters
betaLength of the diagram (here representing the thermondinamical beta = 1/T). Must be > 0.
s0Spin of the 0-th segment of the diagram [0—t1]. Must be +1 or -1.
HValue of the longitudinal component of magnetic field
GAMMAValue of the transversal component of magnetic field. Must be != 0.
vertices(optional) List containing the times of diagram _vertices, with t1<t2<t3... (they need to be already sorted)
seed(optional) Seed to initialize the random number generator

Member Function Documentation

◆ attempt_add_segment()

bool Diagram::attempt_add_segment ( )

Attemps the ADD_SEGMENT update for the current status of the diagram.

Returns
true if update was accepted,
false if update was rejected

◆ attempt_remove_segment()

bool Diagram::attempt_remove_segment ( )

Attemps the REMOVE_SEGMENT update for the current status of the diagram.

Returns
true if update was accepted,
false if update was rejected

◆ attempt_spin_flip()

bool Diagram::attempt_spin_flip ( )

Attemps the SPIN_FLIP update for the current status of the diagram.

Returns
true if update was accepted,
false if update was rejected

◆ operator/()

double Diagram_core::operator/ ( const Diagram_core other) const

Returns the ratio of the weights of the two diagrams, i.e. this->value()/other.value()

Returns
double

◆ reset_diagram()

void Diagram::reset_diagram ( double  beta,
int  s0,
double  H,
double  GAMMA,
std::list< double >  vertices = std::list< double >(),
unsigned int  seed = std::chrono::system_clock::now().time_since_epoch().count() 
)

Reset all diagram parameters with the new values.

Parameters
betaLength of the diagram (here representing the thermondinamical beta = 1/T). Must be > 0.
s0Spin of the 0-th segment of the diagram [0—t1]. Must be +1 or -1.
HValue of the longitudinal component of magnetic field
GAMMAValue 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)
seed(optional) Seed to initialize the random number generator

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