PSCF v1.3.3
ScftThermo.cpp
1/*
2* PSCF - Polymer Self-Consistent Field
3*
4* Copyright 2015 - 2025, The Regents of the University of Minnesota
5* Distributed under the terms of the GNU General Public License.
6*/
7
8#include "ScftThermo.h"
9#include <rpc/solvers/Mixture.h>
10#include <rpc/solvers/Polymer.h>
11#include <rpc/solvers/Solvent.h>
12#include <rpc/field/Domain.h>
13#include <prdc/system/ScftThermoTmpl.tpp>
14#include <pscf/inter/Interaction.h>
15
16namespace Pscf {
17
18 namespace Prdc {
19
20 // Explicit instantiation of base class template
21 template class ScftThermoTmpl<1, Rpc::System<1> >;
22 template class ScftThermoTmpl<2, Rpc::System<2> >;
23 template class ScftThermoTmpl<3, Rpc::System<3> >;
24
25 }
26
27 namespace Rpc {
28
29 /*
30 * Constructor
31 */
32 template <int D>
36
37 /*
38 * Inner product of r-grid fields.
39 */
40 template <int D>
42 RFieldT const & B) const
43 {
44 const int meshSize = Base::domain().mesh().size();
45 UTIL_CHECK(meshSize == A.capacity())
46 UTIL_CHECK(meshSize == B.capacity())
47 double sum = 0.0;
48 for (int k = 0; k < meshSize; ++k) {
49 sum += A[k]*B[k];
50 }
51 return sum;
52 };
53
54 // Explicit instantiation
55 template class ScftThermo<1>;
56 template class ScftThermo<2>;
57 template class ScftThermo<3>;
58
59 }
60}
Base class for SCFT thermodynamic property calculators.
Computes SCFT free energies.
ScftThermo(System< D > const &system)
Constructor.
double innerProduct(RFieldT const &A, RFieldT const &B) const override
Inner product of fields (sum of elements on a grid).
typename Base::RFieldT RFieldT
Alias for r-grid field type.
ScftThermoTmpl< D, System< D > > Base
Alias for base class.
Main class, representing a complete physical system.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
Periodic fields and crystallography.
Definition CField.cpp:11
Real periodic fields, SCFT and PS-FTS (CPU).
Definition param_pc.dox:2
PSCF package top-level namespace.