PSCF v1.3
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
15namespace Pscf {
16 template <int D> class Mesh;
17}
18
19namespace Pscf {
20namespace Rpg {
21
22 using namespace Util;
23 using namespace Pscf::Prdc;
24 using namespace Pscf::Prdc::Cuda;
25
31 template <int D>
32 class Solvent : public SolventSpecies
33 {
34 public:
35
39 Solvent();
40
44 ~Solvent();
45
53 void associate(Mesh<D> const & mesh);
54
60 void allocate();
61
79 void compute(RField<D> const & wField, double phiTot = 1.0);
80
84 RField<D> const & cField() const;
85
86 // Inherited public accessor functions
89 using Pscf::Species::q;
93
94 protected:
95
96 #if 0
97 // Inherited protected data members
98 using Pscf::Species::phi_;
99 using Pscf::Species::mu_;
100 using Pscf::Species::q_;
101 using Pscf::Species::ensemble_;
102 using Pscf::SolventSpecies::monomerId_;
103 using Pscf::SolventSpecies::size_;
104 #endif
105
106 private:
107
109 RField<D> cField_;
110
112 Mesh<D> const * meshPtr_;
113
114 };
115
116 /*
117 * Associate this object with a mesh.
118 */
119 template <int D>
120 inline void Solvent<D>::associate(Mesh<D> const & mesh)
121 {
122 UTIL_CHECK(mesh.size() > 1);
123 meshPtr_ = &mesh;
124 }
125
126 /*
127 * Allocate internal data containers.
128 */
129 template <int D>
131 {
132 UTIL_CHECK(meshPtr_);
133 cField_.allocate(meshPtr_->dimensions());
134 }
135
136 /*
137 * Get monomer concentration field for this solvent.
138 */
139 template <int D>
140 inline RField<D> const & Solvent<D>::cField() const
141 { return cField_; }
142
143}
144}
145#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.
int monomerId() const
Get the monomer type id.
double size() const
Get the size (number of monomers) in this solvent.
double phi() const
Get the overall volume fraction for this species.
Definition Species.h:149
double mu() const
Get the chemical potential for this species (units kT=1).
Definition Species.h:155
Ensemble ensemble() const
Get the statistical ensemble for this species (open or closed).
Definition Species.h:167
double q() const
Get the molecular partition function for this species.
Definition Species.h:161
#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