Simpatico  v1.10
ddMd/analyzers/AnalyzerFactory.cpp
1 /*
2 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
3 *
4 * Copyright 2010 - 2017, The Regents of the University of Minnesota
5 * Distributed under the terms of the GNU General Public License.
6 */
7 
8 #include "AnalyzerFactory.h" // Class header
9 
10 //#include <ddMd/simulation/Simulation.h>
11 
12 // Config and Trajectory Writers
13 #include "trajectory/ConfigWriter.h"
14 #include "trajectory/DdMdTrajectoryWriter.h"
15 #include "trajectory/DdMdGroupTrajectoryWriter.h"
16 #include "trajectory/LammpsDumpWriter.h"
17 
18 // Energy analyzers
19 #include "energy/LogEnergy.h"
20 #include "energy/EnergyAnalyzer.h"
21 #include "energy/OutputEnergy.h"
22 #include "energy/KineticEnergyAnalyzer.h"
23 #include "energy/OutputTemperature.h"
24 #include "energy/PairEnergyAnalyzer.h"
25 #include "energy/OutputPairEnergies.h"
26 #include "energy/PairEnergyAverage.h"
27 #ifdef SIMP_EXTERNAL
28 #include "energy/ExternalEnergyAnalyzer.h"
29 #include "energy/ExternalEnergyAverage.h"
30 #endif
31 
32 // Stress and box dimension analyzers
33 #include "stress/PressureAnalyzer.h"
34 #include "stress/OutputPressure.h"
35 #include "stress/OutputBoxdim.h"
36 #include "stress/StressAnalyzer.h"
37 #include "stress/VirialStressAnalyzer.h"
38 #include "stress/OutputStressTensor.h"
39 #include "stress/VirialStressTensorAverage.h"
40 #include "stress/StressAutoCorr.h"
41 #include "stress/StressAutoCorrelation.h"
42 
43 // Scattering analyzers
44 #include "scattering/StructureFactor.h"
45 #include "scattering/StructureFactorGrid.h"
46 #include "scattering/VanHove.h"
47 
48 // Miscellaneous analyzers
49 #include "misc/OrderParamNucleation.h"
50 #ifdef SIMP_BOND
51 #include "misc/BondTensorAutoCorr.h"
52 #endif
53 
54 namespace DdMd
55 {
56 
57  using namespace Util;
58 
59  /*
60  * Constructor.
61  */
63  : simulationPtr_(&simulation)
64  {}
65 
66  /*
67  * Return a pointer to an instance of Analyzer subclass className.
68  */
69  Analyzer* AnalyzerFactory::factory(const std::string &className) const
70  {
71  Analyzer* ptr = 0;
72 
73  // Try subfactories first (if any)
74  ptr = trySubfactories(className);
75  if (ptr) return ptr;
76 
77  // Energy Analyzers
78  if (className == "LogEnergy") {
79  ptr = new LogEnergy(simulation());
80  } else
81  if (className == "EnergyAnalyzer") {
82  ptr = new EnergyAnalyzer(simulation());
83  } else
84  if (className == "OutputEnergy") {
85  ptr = new OutputEnergy(simulation());
86  } else
87  if (className == "KineticEnergyAnalyzer") {
88  ptr = new KineticEnergyAnalyzer(simulation());
89  } else
90  if (className == "OutputTemperature") {
91  ptr = new OutputTemperature(simulation());
92  } else
93  if (className == "PairEnergyAnalyzer") {
94  ptr = new PairEnergyAnalyzer(simulation());
95  } else
96  if (className == "PairEnergyAverage") {
97  ptr = new PairEnergyAverage(simulation());
98  } else
99  if (className == "OutputPairEnergies") {
100  ptr = new OutputPairEnergies(simulation());
101  } else
102  #ifdef SIMP_EXTERNAL
103  if (className == "ExternalEnergyAnalyzer") {
104  ptr = new ExternalEnergyAnalyzer(simulation());
105  } else
106  if (className == "ExternalEnergyAverage") {
107  ptr = new ExternalEnergyAverage(simulation());
108  } else
109  #endif
110  // Pressure, Stress and Box Dimensions
111  if (className == "OutputBoxdim") {
112  ptr = new OutputBoxdim(simulation());
113  } else
114  if (className == "PressureAnalyzer") {
115  ptr = new PressureAnalyzer(simulation());
116  } else
117  if (className == "OutputPressure") {
118  ptr = new OutputPressure(simulation());
119  } else
120  if (className == "StressAnalyzer") {
121  ptr = new StressAnalyzer(simulation());
122  } else
123  if (className == "VirialStressAnalyzer") {
124  ptr = new VirialStressAnalyzer(simulation());
125  } else
126  if (className == "OutputStressTensor") {
127  ptr = new OutputStressTensor(simulation());
128  } else
129  if (className == "VirialStressTensorAverage") {
131  } else
132  if (className == "StressAutoCorr") {
133  ptr = new StressAutoCorr(simulation());
134  } else
135  if (className == "StressAutoCorrelation") {
136  ptr = new StressAutoCorrelation(simulation());
137  } else
138  // Scattering
139  if (className == "StructureFactor") {
140  ptr = new StructureFactor(simulation());
141  } else
142  if (className == "StructureFactorGrid") {
143  ptr = new StructureFactorGrid(simulation());
144  } else
145  if (className == "VanHove") {
146  ptr = new VanHove(simulation());
147  } else
148  // Trajectory writers
149  if (className == "ConfigWriter") {
150  ptr = new ConfigWriter(simulation());
151  } else
152  if (className == "DdMdTrajectoryWriter") {
153  ptr = new DdMdTrajectoryWriter(simulation());
154  } else
155  if (className == "DdMdGroupTrajectoryWriter") {
157  } else
158  if (className == "LammpsDumpWriter") {
159  ptr = new LammpsDumpWriter(simulation());
160  } else
161  // Miscellaneous
162  #ifdef SIMP_BOND
163  if (className == "BondTensorAutoCorr") {
164  ptr = new BondTensorAutoCorr(simulation());
165  } else
166  #endif
167  if (className == "OrderParamNucleation") {
168  ptr = new OrderParamNucleation(simulation());
169  }
170  return ptr;
171  }
172 
173 }
Abstract base for periodic output and/or analysis actions.
Compute average of pair energy.
Evaluates the van Hove function S(k,t) for one or more wavevector k.
Periodically write simulation configuration to a new file.
Output and evaluate average of stress tensor.
Sample and evaluate average of total pressure.
Periodically write (scalar) pressure to file.
Compute averages and output block averages of energy components.
Output and evaluate average of virial stress tensor.
Compute and analyze pair energies.
Calculate stress autocorrelation function.
Periodically write simulation energies to Log output.
Definition: LogEnergy.h:29
Parallel domain decomposition (DD) MD simulation.
Periodically write Boundary dimensions to file.
Definition: OutputBoxdim.h:26
Main object for a domain-decomposition MD simulation.
Periodically write simulation energies to Log output.
Native binary trajectory format for ddSim, for one group.
Periodically write (tensor) StressTensor to file.
Compute stress autocorrelation function for a liquid.
Analyzer * trySubfactories(const std::string &className) const
Search through subfactories for match.
Periodically write pair energies to file.
Utility classes for scientific computation.
Definition: accumulators.mod:1
Compute average and output block averages of virial stress tensor.
Compute the shear stress autocorrelation function.
virtual Analyzer * factory(const std::string &className) const
Return pointer to a new Analyzer object.
Output and evaluate average of kinetic energy.
Native binary trajectory format for ddSim.
StructureFactor evaluates structure factors in Fourier space.
Output and evaluate average of external energy.
Write a trajectory in the Lammps dump format.
Periodically write simulation energies to file.
Definition: OutputEnergy.h:26
StructureFactorGrid evaluates structure factors in Fourier space.
Simulation & simulation() const
Return reference to parent Simulation.
Periodically output kinetic temperature to file.
OrderParamNucleation is designed to evaluate a sort of composition profile in the specific case of nu...
AnalyzerFactory(Simulation &simulation)
Constructor.