PSCF v1.2
rpc/fts/perturbation/Perturbation.tpp
1#ifndef RPC_PERTURBATION_TPP
2#define RPC_PERTURBATION_TPP
3
4#include "Perturbation.h"
5#include <rpc/fts/simulator/Simulator.h>
6#include <prdc/cpu/RField.h>
7
8#include <util/containers/DArray.h>
9#include <util/global.h>
10
11namespace Pscf {
12namespace Rpc {
13
14 using namespace Util;
15
16 /*
17 * Constructor.
18 */
19 template <int D>
22 lambda_(1.0),
23 simulatorPtr_(&simulator),
24 systemPtr_(&(simulator.system()))
25 {}
26
27 /*
28 * Destructor.
29 */
30 template <int D>
33
34 /*
35 * Read parameters from stream, empty default implementation.
36 */
37 template <int D>
38 void Perturbation<D>::readParameters(std::istream& in)
39 {}
40
41 /*
42 * Setup before simulation, empty default implementation.
43 */
44 template <int D>
47
48 /*
49 * Compute and return perturbation, default implementation.
50 */
51 template <int D>
52 double Perturbation<D>::hamiltonian(double unperturbedHamiltonian)
53 { return 0.0; }
54
55 /*
56 * Modify functional derivatives, empty default implementation.
57 */
58 template <int D>
61
62 /*
63 * Save any internal variables.
64 */
65 template <int D>
68
69 /*
70 * Restored any saved internal variables.
71 */
72 template <int D>
75
76 /*
77 * Compute and return derivative of free energy
78 */
79 template <int D>
81 { return 0.0; }
82
83 /*
84 * Set a new value for the lambda_ parameter.
85 */
86 template <int D>
87 void Perturbation<D>::setLambda(double lambda)
88 { lambda_ = lambda; }
89
90}
91}
92#endif
Field of real double precision values on an FFT mesh.
Perturbation(Simulator< D > &simulator)
Constructor.
virtual void setup()
Complete any required initialization.
void setLambda(double lambda)
Set the perturbation parameter value.
virtual void saveState()
Save any required internal state variables.
virtual double hamiltonian(double unperturbedHamiltonian)
Compute and return the perturbation to the Hamiltonian.
virtual void restoreState()
Restore any required internal state variables.
virtual double df()
Compute and return derivative of H w/ respect to parameter lambda.
virtual void incrementDc(DArray< RField< D > > &dc)
Modify the generalized forces to include perturbation.
virtual void readParameters(std::istream &in)
Read parameters from archive.
Field theoretic simulator (base class).
Definition rpc/System.h:38
Dynamically allocatable contiguous array template.
An object that can read multiple parameters from file.
File containing preprocessor macros for error handling.
PSCF package top-level namespace.
Definition param_pc.dox:1
Utility classes for scientific computation.