p3statistics.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 no argument is provided
38  if (argc==1) {
39  logger(ERROR,"No arguments; use p3statistics.exe filename [-options]");
40  }
41  else {
42  // if you don't use the -help argument and if at least one argument is given
43  if (strcmp(argv[1],"-help") != 0)
44  logger(INFO,"Getting statistics from %.p3* (or .p4*) files ...",argv[1]);
45  }
46 
47 
48 
49  //check for '-stattype' option
50  StatType T = XYZ;
51  for (int i = 2; i<argc; i++) {
52  if (!strcmp(argv[i],"-stattype")) {
53  if (!strcmp(argv[i+1],"XYZ")) T = XYZ;
54  else if (!strcmp(argv[i+1],"RAZ")) T = RAZ;
55  else if (!strcmp(argv[i+1],"RA")) T = RA;
56  else if (!strcmp(argv[i+1],"RZ")) T = RZ;
57  else if (!strcmp(argv[i+1],"AZ")) T = AZ;
58  else if (!strcmp(argv[i+1],"R")) T = R;
59  else if (!strcmp(argv[i+1],"A")) T = A;
60  else if (!strcmp(argv[i+1],"YZ")) T = YZ;
61  else if (!strcmp(argv[i+1],"XZ")) T = XZ;
62  else if (!strcmp(argv[i+1],"XY")) T = XY;
63  else if (!strcmp(argv[i+1],"X")) T = X;
64  else if (!strcmp(argv[i+1],"Y")) T = Y;
65  else if (!strcmp(argv[i+1],"Z")) T = Z;
66  else if (!strcmp(argv[i+1],"O")) T = O;
67  else {
68  logger(ERROR,"Stattype unknown");
69  }
70  }
71  }
72  logger(INFO,"stattype %",T);
73 
74  if (T==XY) { // averaging in z-direction
75  StatisticsVector<XY> stats(argc, argv);
76  } else if (T==XZ) { // averaging in y-direction
77  StatisticsVector<XZ> stats(argc, argv);
78  stats.setDoPeriodicWalls(false);
79  stats.statistics_from_p3();
80  } else if (T==YZ) { // averaging in x-direction
81  StatisticsVector<YZ> stats(argc, argv);
82  stats.setDoPeriodicWalls(false);
83  stats.statistics_from_p3();
84  } else if (T==X) { // averaging in yz-direction
85  StatisticsVector<X> stats(argc, argv);
86  stats.setDoPeriodicWalls(false);
87  stats.statistics_from_p3();
88  } else if (T==Y) { // averaging in yz-direction
89  StatisticsVector<Y> stats(argc, argv);
90  stats.setDoPeriodicWalls(false);
91  stats.statistics_from_p3();
92  } else if (T==Z) { // averaging in yz-direction
93  StatisticsVector<Z> stats(argc, argv);
94  stats.setDoPeriodicWalls(false);
95  stats.statistics_from_p3();
96  } else if (T==O) { // averaging in all directions
97  StatisticsVector<O> stats(argc, argv);
98  stats.setDoPeriodicWalls(false);
99  stats.statistics_from_p3();
100  } else if (T==XYZ) { //no averaging
101  StatisticsVector<XYZ> stats(argc, argv);
102  stats.statistics_from_p3();
103  } else {
104  logger(ERROR,"stattype not found");
105  }
106 
107  return 0;
108 }
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.