p4statistics.cpp File Reference
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <sstream>
#include "StatisticsVector.h"

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

This code (p3dstatistics.cpp) can be used to create statistics from p3d files. It is a modified version of fstatistics.cpp

35  {
36 
37  if (argc>1&&strcmp(argv[1],"-help") != 0)
38  logger(INFO, "Get statistics from %.* files", argv[1]);
39 
40  //check for '-stattype' option
41  StatType T = XYZ;
42  for (int i = 2; i<argc; i++) {
43  if (!strcmp(argv[i],"-stattype")) {
44  if (!strcmp(argv[i+1],"XYZ")) T = XYZ;
45  else if (!strcmp(argv[i+1],"RAZ")) T = RAZ;
46  else if (!strcmp(argv[i+1],"RA")) T = RA;
47  else if (!strcmp(argv[i+1],"RZ")) T = RZ;
48  else if (!strcmp(argv[i+1],"AZ")) T = AZ;
49  else if (!strcmp(argv[i+1],"R")) T = R;
50  else if (!strcmp(argv[i+1],"A")) T = A;
51  else if (!strcmp(argv[i+1],"YZ")) T = YZ;
52  else if (!strcmp(argv[i+1],"XZ")) T = XZ;
53  else if (!strcmp(argv[i+1],"XY")) T = XY;
54  else if (!strcmp(argv[i+1],"X")) T = X;
55  else if (!strcmp(argv[i+1],"Y")) T = Y;
56  else if (!strcmp(argv[i + 1], "Z")) T = Z;
57  else if (!strcmp(argv[i + 1], "O")) T = O;
58  else
59  {
60  logger(ERROR, "stattype unknown");
61  }
62  }
63  }
64  if (T==XY) { // averaging in z-direction
65  logger(INFO, "Creating xy-statistics, averaged in z");
66  StatisticsVector<XY> stats(argc, argv);
67  stats.setDoPeriodicWalls(false);
68  stats.statistics_from_p3();
69  } else if (T==XZ) { // averaging in y-direction
70  logger(INFO, "Creating xz-statistics, averaged in y");
71  StatisticsVector<XZ> stats(argc, argv);
72  stats.setDoPeriodicWalls(false);
73  stats.statistics_from_p3();
74  } else if (T==YZ) { // averaging in x-direction
75  logger(INFO, "Creating yz-statistics, averaged in x");
76  StatisticsVector<YZ> stats(argc, argv);
77  stats.setDoPeriodicWalls(false);
78  stats.statistics_from_p3();
79  } else if (T==X) { // averaging in yz-direction
80  logger(INFO, "Creating x-statistics, averaged in yz");
81  StatisticsVector<X> stats(argc, argv);
82  stats.setDoPeriodicWalls(false);
83  stats.statistics_from_p3();
84  } else if (T==Y) { // averaging in yz-direction
85  logger(INFO, "Creating y-statistics, averaged in xz");
86  StatisticsVector<Y> stats(argc, argv);
87  stats.setDoPeriodicWalls(false);
88  stats.statistics_from_p3();
89  } else if (T==Z) { // averaging in yz-direction
90  logger(INFO, "Creating z-statistics, averaged in xy");
91  StatisticsVector<Z> stats(argc, argv);
92  stats.setDoPeriodicWalls(false);
93  stats.statistics_from_p3();
94  } else if (T==O) { // averaging in all directions
95  logger(INFO, "Creating global statistics, averaged in xyz");
96  StatisticsVector<O> stats(argc, argv);
97  stats.setDoPeriodicWalls(false);
98  stats.statistics_from_p3();
99 // } else if (T==RAZ) { //no averaging
100 // std::cout << "cylindrical, no averaging" << std::endl;
101 // StatisticsVector<RAZ> stats(argc, argv);
102 // stats.statistics_from_p3();
103 // } else if (T==RA) { //no averaging
104 // std::cout << "cylindrical, Z averaging" << std::endl;
105 // StatisticsVector<RA> stats(argc, argv);
106 // stats.statistics_from_p3();
107 // } else if (T==RZ) { //no averaging
108 // std::cout << "cylindrical, A averaging" << std::endl;
109 // StatisticsVector<RZ> stats(argc, argv);
110 // stats.statistics_from_p3();
111 // } else if (T==AZ) { //no averaging
112 // std::cout << "cylindrical, R averaging" << std::endl;
113 // StatisticsVector<AZ> stats(argc, argv);
114 // stats.statistics_from_p3();
115 // } else if (T==A) { //no averaging
116 // std::cout << "cylindrical, RZ averaging" << std::endl;
117 // StatisticsVector<A> stats(argc, argv);
118 // stats.statistics_from_p3();
119 // } else if (T==R) { //no averaging
120 // std::cout << "cylindrical, AZ averaging" << std::endl;
121 // StatisticsVector<R> stats(argc, argv);
122 // stats.statistics_from_p3();
123  }
124  else if (T == XYZ)
125  { //no averaging
126  logger(INFO, "Creating non-averaged statistics");
127  StatisticsVector<XYZ> stats(argc, argv);
128  //std::cout << "stats" << std::endl;
129  stats.statistics_from_p3();
130  }
131  else
132  {
133  logger(ERROR, "stattype not found");
134  }
135  return 0;
136 }
LL< Log::INFO > INFO
Info log level.
Definition: Logger.cc:55
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
LL< Log::ERROR > ERROR
Error log level.
Definition: Logger.cc:53
StatType
Creates averaged statistics (only valid if density field is homogenous along averaged direction)
Definition: StatisticsVector.h:41
@ AZ
Definition: StatisticsVector.h:42
@ XY
Definition: StatisticsVector.h:42
@ XZ
Definition: StatisticsVector.h:42
@ R
Definition: StatisticsVector.h:42
@ RA
Definition: StatisticsVector.h:42
@ YZ
Definition: StatisticsVector.h:42
@ A
Definition: StatisticsVector.h:42
@ Y
Definition: StatisticsVector.h:42
@ X
Definition: StatisticsVector.h:42
@ Z
Definition: StatisticsVector.h:42
@ XYZ
Definition: StatisticsVector.h:42
@ RAZ
Definition: StatisticsVector.h:42
@ RZ
Definition: StatisticsVector.h:42
@ O
Definition: StatisticsVector.h:42
This class is used to extract statistical data from MD simulations.
Definition: StatisticsVector.h:62
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51

References A, AZ, ERROR, constants::i, INFO, logger, O, R, RA, RAZ, RZ, StatisticsVector< T >::setDoPeriodicWalls(), StatisticsVector< T >::statistics_from_p3(), X, XY, XYZ, XZ, Y, YZ, and Z.