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