PSCF v1.5.0
PerturbationDerivative.tpp
1#ifndef RP_PERTURBATION_DERIVATIVE_TPP
2#define RP_PERTURBATION_DERIVATIVE_TPP
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2026, David Morse (morse012@um.edu) and co-authors
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include "PerturbationDerivative.h"
12
13#include <rp/fts/simulator/Simulator.h>
14#include <rp/fts/perturbation/Perturbation.h>
15#include <rp/fts/analyzer/PerturbationDerivative.tpp>
16#include <rp/system/System.h>
17#include <rp/field/WFields.h>
18#include <rp/field/CFields.h>
19
20namespace Pscf {
21namespace Rp {
22
23 using namespace Util;
24
25 /*
26 * Constructor.
27 */
28 template <int D, class T>
34
35 /*
36 * Compute and return derivative df.
37 */
38 template <int D, class T>
40 {
41 UTIL_CHECK(system().w().hasData());
42 UTIL_CHECK(simulator().hasPerturbation());
43
44 if (!system().c().hasData()) {
45 system().compute();
46 }
47 if (!simulator().hasWc()){
48 simulator().computeWc();
49 }
50 if (!simulator().hasHamiltonian()) {
51 simulator().computeHamiltonian();
52 }
53
54 return simulator().perturbation().df();
55 }
56
57} // namespace Rp
58} // namespace Pscf
59#endif
Simulator< D, T > & simulator()
Get the parent Simulator by reference.
Definition Analyzer.h:233
System< D, T > & system()
Get the parent System by reference.
Definition Analyzer.h:243
AverageAnalyzer(Simulator< D, T > &simulator, System< D, T > &system)
Constructor.
PerturbationDerivative(Simulator< D, T > &simulator, System< D, T > &system)
Constructor.
double compute() override
Compute and return the derivative of H w/ respect to lambda.
Base class for field theoretic PS-FTS simulator.
Definition Simulator.h:93
Base class template for classes that represent a complete system.
void setClassName(const char *className)
Set class name string.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
Code for programs that simulate real-valued periodic fields.
Definition param_pc.dox:2
PSCF package top-level namespace.