PSCF v1.2
rpg/fts/perturbation/EinsteinCrystalPerturbation.h
1#ifndef RPG_EINSTEIN_CRYSTAL_PERTURBATION_H
2#define RPG_EINSTEIN_CRYSTAL_PERTURBATION_H
3
4#include "Perturbation.h" // base class
5#include <prdc/cuda/RField.h>
6#include <util/containers/DArray.h>
7
8namespace Pscf {
9namespace Rpg {
10
11 using namespace Util;
12 using namespace Prdc;
13 using namespace Prdc::Cuda;
14
15 template <int D> class Simulator;
16
22 template <int D>
24 {
25
26 public:
27
32
37
43 virtual void readParameters(std::istream& in);
44
48 virtual void setup();
49
55 virtual double hamiltonian(double unperturbedHamiltonian);
56
60 virtual void incrementDc(DArray< RField<D> >& dc);
61
65 virtual double df();
66
70 virtual void saveState();
71
75 virtual void restoreState();
76
77 // Inherited functions
82 using Perturbation<D>::system;
83 using Perturbation<D>::lambda;
84
85 protected:
86
87 // Inherited protected data members
88 using Perturbation<D>::lambda_;
89
90 private:
91
92 // Parameters used in Einstein crystal integration
93 DArray<double> epsilon_;
94
95 // Reference w field
97
98 // Eigenvector components of the reference w fields
99 DArray< RField<D> > wc0_;
100
101 // Current Einstein crystal Hamiltonian
102 double ecHamiltonian_;
103
104 // Current unperturbed Hamiltonian
105 double unperturbedHamiltonian_;
106
107 // Saved Einstein crystal Hamiltonian
108 double stateEcHamiltonian_;
109
110 // Saved unperturbed Hamiltonian
111 double stateUnperturbedHamiltonian_;
112
113 // Have epsilon values been set?
114 bool hasEpsilon_;
115
116 // Reference FieldFileName
117 std::string referenceFieldFileName_;
118
119 // Compute eigenvector components of the reference field
120 void computeWcReference();
121
122 };
123
124 #ifndef RPG_EINSTEIN_CRYSTAL_PERTURBATION_TPP
125 // Suppress implicit instantiation
126 extern template class EinsteinCrystalPerturbation<1>;
127 extern template class EinsteinCrystalPerturbation<2>;
128 extern template class EinsteinCrystalPerturbation<3>;
129 #endif
130
131}
132}
133#endif
Field of real double precision values on an FFT mesh.
Perturbation for Einstein crystal thermodynamic integration method.
virtual double df()
Compute and return derivative of free energy.
virtual double hamiltonian(double unperturbedHamiltonian)
Compute and return the perturbation to the Hamiltonian.
virtual void setup()
Complete any required initialization.
virtual void incrementDc(DArray< RField< D > > &dc)
Modify the generalized forces to include perturbation.
virtual void restoreState()
Restore any required internal state variables.
virtual void saveState()
Save any required internal state variables.
virtual void readParameters(std::istream &in)
Read parameters from archive.
Base class for additive perturbations of standard FTS Hamiltonian.
System< D > const & system() const
Get parent System<D> by const reference.
double lambda_
Strength of the perturbation.
double lambda() const
Get the perturbation parameter.
Simulator< D > const & simulator() const
Get parent Simulator<D> by const reference.
Field theoretic simulator (base class).
Definition rpg/System.h:41
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.