PSCF v1.3.1
rpg/solvers/Solvent.h
1#ifndef RPG_SOLVENT_H
2#define RPG_SOLVENT_H
3
4/*
5* PSCF - Polymer Self-Consistent Field
6*
7* Copyright 2015 - 2025, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <pscf/chem/SolventSpecies.h> // base class
12#include <rpg/solvers/Propagator.h> // typedefs
13#include <prdc/cuda/RField.h> // member variable
14
15// Forward declaration
16namespace Pscf {
17 template <int D> class Mesh;
18}
19
20namespace Pscf {
21namespace Rpg {
22
23 using namespace Util;
24 using namespace Pscf::Prdc;
25 using namespace Pscf::Prdc::Cuda;
26
32 template <int D>
33 class Solvent : public SolventSpecies
34 {
35 public:
36
40 Solvent();
41
45 ~Solvent();
46
54 void associate(Mesh<D> const & mesh);
55
61 void allocate();
62
80 void compute(RField<D> const & wField, double phiTot = 1.0);
81
85 RField<D> const & cField() const;
86
87 private:
88
90 RField<D> cField_;
91
93 Mesh<D> const * meshPtr_;
94
95 };
96
97 /*
98 * Associate this object with a mesh.
99 */
100 template <int D>
101 inline void Solvent<D>::associate(Mesh<D> const & mesh)
102 {
103 UTIL_CHECK(mesh.size() > 1);
104 meshPtr_ = &mesh;
105 }
106
107 /*
108 * Allocate internal data containers.
109 */
110 template <int D>
112 {
113 UTIL_CHECK(meshPtr_);
114 cField_.allocate(meshPtr_->dimensions());
115 }
116
117 /*
118 * Get monomer concentration field for this solvent.
119 */
120 template <int D>
121 inline RField<D> const & Solvent<D>::cField() const
122 { return cField_; }
123
124}
125}
126#endif
Description of a regular grid of points in a periodic domain.
Definition Mesh.h:61
int size() const
Get total number of grid points.
Definition Mesh.h:229
Field of real double precision values on an FFT mesh.
Definition cpu/RField.h:29
RField< D > const & cField() const
Get the monomer concentration field for this solvent.
void compute(RField< D > const &wField, double phiTot=1.0)
Compute monomer concentration field, q and phi and/or mu.
void allocate()
Allocate internal data containers.
void associate(Mesh< D > const &mesh)
Associate this object with a mesh.
SolventSpecies()
Constructor.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
Definition global.h:68
Fields, FFTs, and utilities for periodic boundary conditions (CUDA)
Definition Reduce.cpp:14
Periodic fields and crystallography.
Definition CField.cpp:11
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.
Definition param_pc.dox:1