PSCF v1.5.0
Perturbation.tpp
1#ifndef RP_PERTURBATION_TPP
2#define RP_PERTURBATION_TPP
3
4#include "Perturbation.h"
5#include <rp/fts/simulator/Simulator.h>
6#include <pscf/field/RField.h>
7#include <util/containers/DArray.h>
8#include <util/global.h>
9
10namespace Pscf {
11namespace Rp {
12
13 using namespace Util;
14
15 /*
16 * Constructor.
17 */
18 template <int D, class T>
21 lambda_(1.0),
22 simulatorPtr_(&simulator),
23 systemPtr_(&(simulator.system()))
24 {}
25
26 /*
27 * Read parameters from stream, empty default implementation.
28 */
29 template <int D, class T>
30 void Perturbation<D,T>::readParameters(std::istream& in)
31 {}
32
33 /*
34 * Setup before simulation, empty default implementation.
35 */
36 template <int D, class T>
39
40 /*
41 * Compute and return Hamiltonian perturbation, default implementation.
42 */
43 template <int D, class T>
44 double Perturbation<D,T>::hamiltonian(double unperturbedHamiltonian)
45 { return 0.0; }
46
47 /*
48 * Modify functional derivatives, empty default implementation.
49 */
50 template <int D, class T>
53
54 /*
55 * Save any internal state variables.
56 */
57 template <int D, class T>
60
61 /*
62 * Restore any saved internal variables.
63 */
64 template <int D, class T>
67
68 /*
69 * Compute and return derivative of free energy.
70 */
71 template <int D, class T>
73 { return 0.0; }
74
75 /*
76 * Set a new value for the lambda_ parameter.
77 */
78 template <int D, class T>
81
82}
83}
84#endif
double lambda() const
Get the perturbation parameter.
Perturbation(Simulator< D, T > &simulator)
Constructor.
virtual double df()
Compute and return derivative of H w/ respect to parameter lambda.
Simulator< D, T > const & simulator() const
Get parent Simulator<D,T> by const reference.
double lambda_
Strength of the perturbation.
virtual void restoreState()
Restore any required internal state variables.
virtual double hamiltonian(double unperturbedHamiltonian)
Compute and return the perturbation to the Hamiltonian.
void setLambda(double lambda)
Set the perturbation parameter value.
System< D, T > const & system() const
Get parent System<D,T> by const reference.
virtual void setup()
Complete any required initialization.
virtual void incrementDc(DArray< RField< D, T > > &dc)
Modify the generalized forces to include perturbation.
virtual void saveState()
Save any required internal state variables.
virtual void readParameters(std::istream &in)
Read parameters from archive.
Base class for field theoretic PS-FTS simulator.
Definition Simulator.h:93
Dynamically allocatable contiguous array template.
Definition DArray.h:32
ParamComposite()
Constructor.
File containing preprocessor macros for error handling.
Code for programs that simulate real-valued periodic fields.
Definition param_pc.dox:2
PSCF package top-level namespace.