PSCF v1.4.0
BinaryStructureFactor.cpp
1/*
2* PSCF - Polymer Self-Consistent Field
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 "BinaryStructureFactor.h"
9
10#include <rpc/fts/simulator/Simulator.h>
11#include <rpc/system/System.h>
12#include <rpc/solvers/Mixture.h>
13#include <rpc/field/Domain.h>
14#include <rpc/field/WFields.h>
15
16#include <prdc/cpu/FFT.h>
17#include <prdc/cpu/WaveList.h>
18
19#include <pscf/cpu/VecOp.h>
20#include <pscf/cpu/VecOpCx.h>
21#include <pscf/cpu/complex.h>
22
23#include <rp/fts/analyzer/BinaryStructureFactor.tpp>
24
25namespace Pscf {
26namespace Rpc {
27
28 using namespace Util;
29 using namespace Pscf::Prdc;
30
31 /*
32 * Constructor.
33 */
34 template <int D>
36 Simulator<D>& simulator,
37 System<D>& system)
38 : Rp::BinaryStructureFactor< D, Types<D> >(simulator, system)
39 {}
40
41 /*
42 * Setup before entering main loop.
43 */
44 template <int D>
46 {
47 allocate();
48 Cpu::WaveList<D> const & waveList = AnalyzerT::system().waveList();
49 findWaveBunches(waveList.kSq(), waveList.implicitInverse());
50 }
51
52 /*
53 * Compute structure factors for all wavevectors and bunches.
54 */
55 template <int D>
57 {
58 if (AnalyzerT::isAtInterval(iStep)) {
59 computeW();
61 }
62 }
63
64}
65}
66
67// Explicit instantiation definitions
68namespace Pscf {
69 namespace Rp {
70 template class BinaryStructureFactor<1, Rpc::Types<1> >;
71 template class BinaryStructureFactor<2, Rpc::Types<2> >;
72 template class BinaryStructureFactor<3, Rpc::Types<3> >;
73 }
74 namespace Rpc {
75 template class BinaryStructureFactor<1>;
76 template class BinaryStructureFactor<2>;
77 template class BinaryStructureFactor<3>;
78 }
79}
Class to compute and store properties associated with wavevectors.
RField< D > const & kSq() const
Get the kSq array on the device by const reference.
DArray< bool > const & implicitInverse() const
Get the implicitInverse array by reference.
void computeS(Array< typename Types< D >::Complex > const &wk)
void findWaveBunches(Array< double > const &kSq, Array< bool > const &implicit)
Spherically averaged structure factor for a two-monomer system.
BinaryStructureFactor(Simulator< D > &simulator, System< D > &system)
Constructor.
void sample(long iStep) override
Compute structure factors and add to accumulators.
void setup() override
Setup before the main loop.
Field theoretic simulator (base class).
A complete physical system.
Aliases for types used in the Rpc program-level namespace.
Periodic fields and crystallography.
Definition complex.cpp:11
Class templates for real-valued periodic fields.
Real periodic fields, SCFT and PS-FTS (CPU).
Definition param_pc.dox:2
PSCF package top-level namespace.