1#ifndef RP_CHI_DERIVATIVE_TPP
2#define RP_CHI_DERIVATIVE_TPP
11#include "BinaryChiDerivative.h"
13#include <rp/system/System.h>
14#include <rp/fts/simulator/Simulator.h>
15#include <rp/solvers/Mixture.h>
16#include <rp/field/Domain.h>
17#include <rp/field/WFields.h>
18#include <rp/field/CFields.h>
20#include <pscf/interaction/Interaction.h>
30 template <
int D,
class T>
40 template <
int D,
class T>
45 const int nMonomer =
system().mixture().nMonomer();
49 const double vSystem =
system().domain().unitCell().volume();
50 const double vMonomer =
system().mixture().vMonomer();
51 const double nMonomerSystem = vSystem / vMonomer;
52 const int meshSize =
system().domain().mesh().size();
53 const double chi = -
simulator().chiEval(0);
56 if (!
system().c().hasData()) {
67 double hField =
simulator().fieldHamiltonian();
68 hField /= (double)nMonomerSystem;
71 double dfdchi = -(hField - 0.5*
simulator().sc(nMonomer - 1))/chi
75 dfdchi *= (double)nMonomerSystem;
78 dfdchi += double(meshSize)/(2.0 * chi);
Simulator< D, T > & simulator()
Get the parent Simulator by reference.
System< D, T > & system()
Get the parent System by reference.
AverageAnalyzer(Simulator< D, T > &simulator, System< D, T > &system)
Constructor.
double compute() override
Compute and return the derivative of H w/ respect to chi.
BinaryChiDerivative(Simulator< D, T > &simulator, System< D, T > &system)
Constructor.
Base class for field theoretic PS-FTS simulator.
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.
Code for programs that simulate real-valued periodic fields.
PSCF package top-level namespace.