PSCF v1.4.0
Mixture.cu
1/*
2* PSCF - Polymer Self-Consistent Field Theory
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 "Mixture.h" // class header
9
10#include "Polymer.h"
11#include "Solvent.h"
12#include "Block.h"
13#include "Propagator.h"
14#include <rpg/field/FieldIo.h>
15#include <prdc/cuda/FFT.h>
16#include <prdc/cuda/RField.h>
17#include <pscf/cuda/VecOp.h>
18
19#include <rp/solvers/Mixture.tpp> // base class template implementation
20
21namespace Pscf {
22namespace Rpg {
23
24 using namespace Prdc;
25
26 /*
27 * Constructor
28 */
29 template <int D>
31 : Rp::Mixture<D, Types<D> >(),
32 useBatchedFFT_(true)
33 {}
34
35 /*
36 * Read all parameters and initialize.
37 */
38 template <int D>
39 void Mixture<D>::readParameters(std::istream& in)
40 {
41 RpMixtureT::readParameters(in);
42
43 // Optionally read useBatchedFFT boolean
44 useBatchedFFT_ = true;
45 ParamComposite::readOptional(in, "useBatchedFFT", useBatchedFFT_);
46 }
47
48 /*
49 * Allocate memory for all blocks.
50 */
51 template <int D>
52 void Mixture<D>::allocateBlocks()
53 {
54 const double ds = RpMixtureT::ds();
55 const int np = MixtureBase<cudaReal>::nPolymer();
56 int i, j;
57 for (i = 0; i < np; ++i) {
58 for (j = 0; j < polymer(i).nBlock(); ++j) {
59 polymer(i).block(j).allocate(ds, useBatchedFFT_);
60 }
61 }
62 }
63
64} // namespace Rpg
65} // namespace Pscf
66
67// Explicit instantiation definitions
68namespace Pscf {
72 namespace Rp {
73 template class Mixture<1, Rpg::Types<1> >;
74 template class Mixture<2, Rpg::Types<2> >;
75 template class Mixture<3, Rpg::Types<3> >;
76 }
77 namespace Rpg {
78 template class Mixture<1>;
79 template class Mixture<2>;
80 template class Mixture<3>;
81 }
82}
int nPolymer() const
Get number of polymer species.
Solvers for a mixture of polymer and solvent species.
Definition MixtureTmpl.h:27
Solver and descriptor for a mixture of polymers and solvents.
Solver and descriptor for a mixture of polymers and solvents.
void readParameters(std::istream &in) override
Read body of parameter file block and initialize.
Definition Mixture.cu:39
Mixture()
Constructor.
Definition Mixture.cu:30
Solver and descriptor for a solvent species.
List of aliases for types used in the Rpg program-level namespace.
ScalarParam< Type > & readOptional(std::istream &in, const char *label, Type &value)
Add and read a new optional ScalarParam < Type > object.
Periodic fields and crystallography.
Definition complex.cpp:11
Class templates for real-valued periodic fields.
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.