PSCF v1.2
rpc/fts/perturbation/EinsteinCrystalPerturbation.h
1#ifndef RPC_EINSTEIN_CRYSTAL_PERTURBATION_H
2#define RPC_EINSTEIN_CRYSTAL_PERTURBATION_H
3
4#include "Perturbation.h" // base class
5
6namespace Util {
7 template <typename T> class DArray;
8}
9
10namespace Pscf {
11namespace Prdc{
12namespace Cpu{
13 template <int D> class RField;
14}
15}
16}
17
18namespace Pscf {
19namespace Rpc {
20
21 using namespace Util;
22 using namespace Prdc;
23 using namespace Prdc::Cpu;
24
25 template <int D> class Simulator;
26
38 template <int D>
40 {
41
42 public:
43
48
53
59 virtual void readParameters(std::istream& in);
60
64 virtual void setup();
65
71 virtual double hamiltonian(double unperturbedHamiltonian);
72
76 virtual void incrementDc(DArray< RField<D> >& dc);
77
81 virtual double df();
82
86 virtual void saveState();
87
91 virtual void restoreState();
92
93 // Inherited functions
98 using Perturbation<D>::system;
99 using Perturbation<D>::lambda;
100
101 protected:
102
103 // Inherited protected data members
104 using Perturbation<D>::lambda_;
105
106 private:
107
108 // Parameters used in Einstein crystal integration
109 DArray<double> epsilon_;
110
111 // Reference w field
112 DArray< RField<D> > w0_;
113
114 // Eigenvector components of the reference w fields
115 DArray< RField<D> > wc0_;
116
117 // Current Einstein crystal Hamiltonian
118 double ecHamiltonian_;
119
120 // Current unperturbed Hamiltonian
121 double unperturbedHamiltonian_;
122
123 // Saved Einstein crystal Hamiltonian
124 double stateEcHamiltonian_;
125
126 // Saved unperturbed Hamiltonian
127 double stateUnperturbedHamiltonian_;
128
129 // Reference FieldFileName
130 std::string referenceFieldFileName_;
131
132 // Have epsilon values been set?
133 bool hasEpsilon_;
134
135 // Compute eigenvector components of the reference field
136 void computeWcReference();
137
138 };
139
140 #ifndef RPC_EINSTEIN_CRYSTAL_PERTURBATION_TPP
141 // Suppress implicit instantiation
142 extern template class EinsteinCrystalPerturbation<1>;
143 extern template class EinsteinCrystalPerturbation<2>;
144 extern template class EinsteinCrystalPerturbation<3>;
145 #endif
146
147}
148}
149#endif
Field of real double precision values on an FFT mesh.
Perturbation for Einstein crystal thermodynamic integration method.
virtual void restoreState()
Restore any required internal state variables.
virtual void readParameters(std::istream &in)
Read parameters from archive.
virtual void saveState()
Save any required internal state variables.
virtual double df()
Compute and return derivative of free energy.
virtual void incrementDc(DArray< RField< D > > &dc)
Modify the generalized forces to include perturbation.
virtual void setup()
Complete any required initialization.
virtual double hamiltonian(double unperturbedHamiltonian)
Compute and return the perturbation to the Hamiltonian.
Base class for additive perturbations of standard FTS Hamiltonian.
Simulator< D > const & simulator() const
Get parent Simulator<D> by const reference.
double lambda() const
Get the perturbation parameter.
double lambda_
Strength of the perturbation.
System< D > const & system() const
Get parent System<D> by const reference.
Field theoretic simulator (base class).
Definition rpc/System.h:38
Dynamically allocatable contiguous array template.
DArrayParam< Type > & readOptionalDArray(std::istream &in, const char *label, DArray< Type > &array, int n)
Add and read an optional DArray < Type > parameter.
ScalarParam< Type > & read(std::istream &in, const char *label, Type &value)
Add and read a new required ScalarParam < Type > object.
void setClassName(const char *className)
Set class name string.
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.