PSCF v1.3.3
rpc/solvers/Mixture.tpp
1#ifndef RPC_MIXTURE_TPP
2#define RPC_MIXTURE_TPP
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 "Mixture.h"
12#include "Polymer.h"
13#include "Solvent.h"
14#include "Block.h"
15#include "Propagator.h"
16#include <rpc/field/FieldIo.h>
17#include <prdc/solvers/MixturePrdc.tpp>
18#include <prdc/cpu/FFT.h>
19#include <prdc/cpu/RField.h>
20
21namespace Pscf {
22namespace Rpc {
23
24 using namespace Prdc;
25
26 template <int D>
27 void Mixture<D>::eqS(FieldT& A, double c) const
28 {
29 const int nx = mesh().size();
30 UTIL_CHECK(nx == A.capacity());
31 for (int i = 0; i < nx; ++i) {
32 A[i] = c;
33 }
34 }
35
36 template <int D>
37 void Mixture<D>::addEqV(FieldT& A, FieldT const & B) const
38 {
39 const int nx = mesh().size();
40 UTIL_CHECK(nx == A.capacity());
41 UTIL_CHECK(nx == B.capacity());
42 for (int i = 0; i < nx; ++i) {
43 A[i] += B[i];
44 }
45 }
46
47 /*
48 * Allocate memory for all blocks.
49 */
50 template <int D>
51 void Mixture<D>::allocateBlocks()
52 {
53 int i, j;
54 for (i = 0; i < nPolymer(); ++i) {
55 for (j = 0; j < polymer(i).nBlock(); ++j) {
56 polymer(i).block(j).allocate(ds());
57 }
58 }
59 }
60
61} // namespace Rpc
62} // namespace Pscf
63#endif
#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.