PSCF v1.4.0
AnalyzerFactory.cu
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 "AnalyzerFactory.h"
9
10// Subclasses of Analyzer
11#include "TrajectoryWriter.h"
12#include "ConcentrationWriter.h"
13#include "HamiltonianAnalyzer.h"
14#include "BinaryStructureFactor.h"
15#include "StepLogger.h"
16#include "PerturbationDerivative.h"
17#include "BinaryChiDerivative.h"
18#include "ConcentrationDerivative.h"
19#include "MaxOrderParameter.h"
20#include "FourthOrderParameter.h"
21#include "CubicLengthDerivative.h"
22
23namespace Pscf {
24namespace Rpg {
25
26 using namespace Util;
27
28 /*
29 * Constructor
30 */
31 template <int D>
33 : simPtr_(&simulator),
34 sysPtr_(&system)
35 {}
36
37 /*
38 * Return a pointer to a instance of Analyzer subclass className.
39 */
40 template <int D>
41 Analyzer<D>* AnalyzerFactory<D>::factory(const std::string &className) const
42 {
43 Analyzer<D>* ptr = 0;
44
45 // Try subfactories first
46 ptr = trySubfactories(className);
47 if (ptr) return ptr;
48
49 // Try to match classname
50 if (className == "TrajectoryWriter") {
51 ptr = new TrajectoryWriter<D>(*simPtr_, *sysPtr_);
52 } else if (className == "ConcentrationWriter") {
53 ptr =
54 new ConcentrationWriter<D>(*simPtr_, *sysPtr_);
55 } else if (className == "HamiltonianAnalyzer") {
56 ptr = new HamiltonianAnalyzer<D>(*simPtr_, *sysPtr_);
57 } else if (className == "BinaryStructureFactor") {
58 ptr = new BinaryStructureFactor<D>(*simPtr_, *sysPtr_);
59 } else if (className == "StepLogger") {
60 ptr = new StepLogger<D>(*simPtr_, *sysPtr_);
61 } else if (className == "PerturbationDerivative") {
62 ptr = new PerturbationDerivative<D>(*simPtr_,
63 *sysPtr_);
64 } else if (className == "BinaryChiDerivative") {
65 ptr = new BinaryChiDerivative<D>(*simPtr_, *sysPtr_);
66 } else if (className == "ConcentrationDerivative") {
67 ptr = new ConcentrationDerivative<D>(*simPtr_,
68 *sysPtr_);
69 } else if (className == "MaxOrderParameter") {
70 ptr = new MaxOrderParameter<D>(*simPtr_, *sysPtr_);
71 } else if (className == "FourthOrderParameter") {
72 ptr = new FourthOrderParameter<D>(*simPtr_, *sysPtr_);
73 } else if (className == "CubicLengthDerivative") {
74 ptr = new CubicLengthDerivative<D>(*simPtr_, *sysPtr_);
75 }
76
77 return ptr;
78 }
79
80 // Explicit instantiation definitions
81 template class AnalyzerFactory<1>;
82 template class AnalyzerFactory<2>;
83 template class AnalyzerFactory<3>;
84
85}
86}
Factory for subclasses of Analyzer.
Analyzer< D > * factory(const std::string &className) const
Method to create any Analyzer supplied with PSCF.
AnalyzerFactory(Simulator< D > &simulator, System< D > &system)
Constructor.
Abstract base for periodic output and/or analysis actions.
Evaluate the derivative of H with respect to chi.
Spherically averaged structure factor for a two-monomer system.
Evaluate and average the derivative of H with respect to chi.
Periodically write c-field snapshots to a trajectory file.
Evaluate the derivative of H with respect to cubic box length.
FourthOrderParameter is used to detect an order-disorder transition.
Compute averages and output block averages of Hamiltonian components.
Evaluates maximum squared Fourier amplitude for W_{-} field.
Evaluate derivative of H w/ respect to perturbation parameter lambda.
Field theoretic simulator (base class).
Periodically write the step index to a log file.
Main class, representing a complete physical system.
Periodically write the field configuration to a trajectory file.
Analyzer< D > * trySubfactories(const std::string &className) const
Definition Factory.h:425
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.