PSCF v1.4.0
Kernel.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 "Kernel.h"
9#include <cmath>
10
11namespace Pscf {
12namespace Cp {
13
14 using namespace Util;
15
16 /*
17 * Constructor.
18 */
20 : range_(1.0),
21 cg_(0.25),
22 cf_(0.5)
23 { setClassName("Kernel"); }
24
25 /*
26 * Destructor.
27 */
30
31 /*
32 * Read parameters from file.
33 */
34 void Kernel::readParameters(std::istream& in)
35 {
36 read(in, "range", range_);
37
38 cg_ = -0.25/(range_ * range_);
39 cf_ = 2.0*cg_;
40 }
41
42 /*
43 * Compute & return Fourier-space kernel for pair interactions.
44 */
45 double Kernel::f(double kSq) const
46 {
47 return std::exp(cf_ * kSq);
48 }
49
50 /*
51 * Compute & return Fourier-space kernel for particle smearing.
52 */
53 double Kernel::g(double kSq) const
54 {
55 return std::exp(cg_ * kSq);
56 }
57
58} // namespace Cp
59} // namespace Pscf
virtual ~Kernel()
Destructor.
Definition Kernel.cpp:28
virtual void readParameters(std::istream &in)
Read model parameters.
Definition Kernel.cpp:34
double g(double kSq) const
Compute the Fourier-space kernel for pair interactions.
Definition Kernel.cpp:53
Kernel()
Constructor.
Definition Kernel.cpp:19
double f(double kSq) const
Compute the Fourier-space kernel for particle smearing.
Definition Kernel.cpp:45
ScalarParam< Type > & read(std::istream &in, const char *label, Type &value)
Add and read a new required ScalarParam < Type > object.
void setClassName(const char *className)
Set class name string.
Complex-valued periodic fields (class templates).
Definition cp.mod:6
PSCF package top-level namespace.