-
Notifications
You must be signed in to change notification settings - Fork 0
/
qoi2dmagneticsusceptibility.hh
74 lines (66 loc) · 2.12 KB
/
qoi2dmagneticsusceptibility.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef QOI2DMAGNETICSUSCEPTIBILITY_HH
#define QOI2DMAGNETICSUSCEPTIBILITY_HH QOI2DMAGNETICSUSCEPTIBILITY_HH
#include "action/qft/nonlinearsigmaaction.hh"
#include "common/samplestate.hh"
#include "lattice/lattice2d.hh"
#include "mpi/mpi_wrapper.hh"
#include "qoi/quantityofinterest.hh"
#include <memory>
/** @file qoi2dmagneticsusceptibility.hh
* @brief Header file for average squared magnetisation of non-linear O(3) sigma
* model
*/
/** @class QoI2DMagneticSusceptibility
*
* @brief class for calculating the magnetic susceptibility of the non-linear
* O(3) sigma model
*
* The returned magnetic susceptibility (average squared magnetisation) is
* defined as
*
* \f[
* \chi_t = 1/M*\langle \mu^2 \rangle
* \f]
*
* where the 3-vector \f$\mu\f$ is the sum of all spins on the lattice and
* \f$M\f$ is the number of lattice sites.
*
*/
class QoI2DMagneticSusceptibility : public QoI {
public:
/** @brief Create new instance
*
* @param[in] lattice_ Lattice
*/
QoI2DMagneticSusceptibility(const std::shared_ptr<Lattice2D> lattice_)
: lattice(lattice_) {}
/** @brief Destructor */
virtual ~QoI2DMagneticSusceptibility() {}
/** @brief Evaluate on a state
*
* @param[in] phi_state State \f$\phi\f$ on which to evaluate the QoI
*/
const double virtual evaluate(const std::shared_ptr<SampleState> phi_state);
private:
/** @brief underlying lattice */
const std::shared_ptr<Lattice2D> lattice;
};
/** @class QoI2DMagneticSusceptibilityFactory
*
* @brief Factory for constructing the QoI for a particular action
*/
class QoI2DMagneticSusceptibilityFactory : public QoIFactory {
public:
/** @brief Return QoI for a specific action
*
* @param[in] action Action to use
*/
virtual std::shared_ptr<QoI> get(std::shared_ptr<Action> action) {
std::shared_ptr<NonlinearSigmaAction> nonlinear_sigma_action;
nonlinear_sigma_action =
std::dynamic_pointer_cast<NonlinearSigmaAction>(action);
std::shared_ptr<Lattice2D> lattice = nonlinear_sigma_action->get_lattice();
return std::make_shared<QoI2DMagneticSusceptibility>(lattice);
}
};
#endif // QOI2DMAGNETICSUSCEPTIBILITY_HH