Simpatico  v1.10
modules/sliplink/mdSim.cpp
1 /*
2 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
3 *
4 * Copyright 2010 - 2014, The Regents of the University of Minnesota
5 * Distributed under the terms of the GNU General Public License.
6 */
7 
8 #include <mcMd/mdSimulation/MdSimulation.h>
9 #include "analyzers/SliplinkMdAnalyzerFactory.h"
10 
44 int main(int argc, char **argv)
45 {
46  #ifdef UTIL_MPI
47  MPI::Init();
48  McMd::MdSimulation simulation(MPI::COMM_WORLD);
49  #else
50  McMd::MdSimulation simulation;
51  #endif
52 
53  // Process command line options
54  simulation.setOptions(argc, argv);
55 
56  // Instantiate and set custom MdAnalyzerFactory
57  McMd::SliplinkMdAnalyzerFactory analyzerFactory(simulation,
58  simulation.system());
59  simulation.analyzerFactory().addSubfactory(analyzerFactory);
60 
61  // Read parameters from default parameter file
62  simulation.readParam();
63 
64  // Read command script to run simulation
65  simulation.readCommands();
66 
67  #if UTIL_MPI
68  if (MPI::Is_initialized()) {
69  MPI::Finalize();
70  }
71  #endif
72 
73  return 0;
74 }
Factory< Analyzer > & analyzerFactory()
Return the Analyzer factory by reference.
void addSubfactory(Factory< Data > &subfactory)
Add a new subfactory to the list.
Definition: Factory.h:204
Custom AnalyzerFactory for an MdSimulation.
void readCommands()
Read and execute commands from a default command file.
const MdSystem & system() const
Get the MdSystem being simulated by const reference.
Definition: MdSimulation.h:318
void readParam()
Read parameters from the default parameter istream.
void setOptions(int argc, char **argv)
Process command line options.
A molecular dynamics simulation of a single MdSystem.
Definition: MdSimulation.h:26