PSCF v1.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 <prdc/system/ScftReal.tpp>
10#include <pscf/inter/Interaction.h>
11
12namespace Pscf {
13 namespace Prdc {
14 template class ScftReal<1, Rpc::System<1> >;
15 template class ScftReal<2, Rpc::System<2> >;
16 template class ScftReal<3, Rpc::System<3> >;
17 }
18 namespace Rpc {
19
20 /*
21 * Constructor
22 */
23 template <int D>
27
28 /*
29 * Inner product of r-grid fields.
30 */
31 template <int D>
33 FieldT const & B) const
34 {
35 const int meshSize = Base::domain().mesh().size();
36 UTIL_CHECK(meshSize == A.capacity())
37 UTIL_CHECK(meshSize == B.capacity())
38 double sum = 0.0;
39 for (int k = 0; k < meshSize; ++k) {
40 sum += A[k]*B[k];
41 }
42 return sum;
43 };
44
45 // Explicit instantiation
46 template class ScftThermo<1>;
47 template class ScftThermo<2>;
48 template class ScftThermo<3>;
49 }
50}
Base class for SCFT thermodynamic property calculator.
Definition ScftReal.h:25
Computes SCFT free energies.
ScftThermo(System< D > const &system)
Constructor.
typename Base::FieldT FieldT
Alias for r-grid field type.
double innerProduct(FieldT const &A, FieldT const &B) const override
Inner product of fields (sum of elements on a grid).
ScftReal< D, System< D > > Base
Alias for base class.
Main class, representing one complete 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.
Definition param_pc.dox:1