MercuryDPM  0.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
p3statistics.cpp File Reference
#include <iostream>
#include <iomanip>
#include <string.h>
#include <stdlib.h>
#include <sstream>
#include "StatisticsVector.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 This code (p3dstatistics.cpp) can be used to create statistics from p3d files. More...
 

Function Documentation

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

Definition at line 35 of file p3statistics.cpp.

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

35  {
36 
37  if (argc>1&&strcmp(argv[1],"-help")) std::cout << std::endl << "Get statistics for " << argv[1] << std::endl;
38 
39  //check for '-stattype' option
40  StatType T = XYZ;
41  for (int i = 2; i<argc; i++) {
42  if (!strcmp(argv[i],"-stattype")) {
43  if (!strcmp(argv[i+1],"XYZ")) T = XYZ;
44  else if (!strcmp(argv[i+1],"RAZ")) T = RAZ;
45  else if (!strcmp(argv[i+1],"RA")) T = RA;
46  else if (!strcmp(argv[i+1],"RZ")) T = RZ;
47  else if (!strcmp(argv[i+1],"AZ")) T = AZ;
48  else if (!strcmp(argv[i+1],"R")) T = R;
49  else if (!strcmp(argv[i+1],"A")) T = A;
50  else if (!strcmp(argv[i+1],"YZ")) T = YZ;
51  else if (!strcmp(argv[i+1],"XZ")) T = XZ;
52  else if (!strcmp(argv[i+1],"XY")) T = XY;
53  else if (!strcmp(argv[i+1],"X")) T = X;
54  else if (!strcmp(argv[i+1],"Y")) T = Y;
55  else if (!strcmp(argv[i+1],"Z")) T = Z;
56  else if (!strcmp(argv[i+1],"O")) T = O;
57  else {std::cerr << "stattype unknown" << std::endl; exit(-1);}
58  }
59  }
60  if (T==XY) { // averaging in z-direction
61  std::cout << "averaging in z-direction" << std::endl;
62  StatisticsVector<XY> stats(argc, argv);
63  stats.setDoPeriodicWalls(false);
64  stats.statistics_from_p3();
65  } else if (T==XZ) { // averaging in y-direction
66  std::cout << "averaging in y-direction" << std::endl;
67  StatisticsVector<XZ> stats(argc, argv);
68  stats.setDoPeriodicWalls(false);
69  stats.statistics_from_p3();
70  } else if (T==YZ) { // averaging in x-direction
71  std::cout << "averaging in x-direction" << std::endl;
72  StatisticsVector<YZ> stats(argc, argv);
73  stats.setDoPeriodicWalls(false);
74  stats.statistics_from_p3();
75  } else if (T==X) { // averaging in yz-direction
76  std::cout << "averaging in yz-direction" << std::endl;
77  StatisticsVector<X> stats(argc, argv);
78  stats.setDoPeriodicWalls(false);
79  stats.statistics_from_p3();
80  } else if (T==Y) { // averaging in yz-direction
81  std::cout << "averaging in xz-direction" << std::endl;
82  StatisticsVector<Y> stats(argc, argv);
83  stats.setDoPeriodicWalls(false);
84  stats.statistics_from_p3();
85  } else if (T==Z) { // averaging in yz-direction
86  std::cout << "averaging in xy-direction" << std::endl;
87  StatisticsVector<Z> stats(argc, argv);
88  stats.setDoPeriodicWalls(false);
89  stats.statistics_from_p3();
90  } else if (T==O) { // averaging in all directions
91  std::cout << "averaging in xyz-direction" << std::endl;
92  StatisticsVector<O> stats(argc, argv);
93  stats.setDoPeriodicWalls(false);
94  stats.statistics_from_p3();
95 // } else if (T==RAZ) { //no averaging
96 // std::cout << "cylindrical, no averaging" << std::endl;
97 // StatisticsVector<RAZ> stats(argc, argv);
98 // stats.statistics_from_p3();
99 // } else if (T==RA) { //no averaging
100 // std::cout << "cylindrical, Z averaging" << std::endl;
101 // StatisticsVector<RA> stats(argc, argv);
102 // stats.statistics_from_p3();
103 // } else if (T==RZ) { //no averaging
104 // std::cout << "cylindrical, A averaging" << std::endl;
105 // StatisticsVector<RZ> stats(argc, argv);
106 // stats.statistics_from_p3();
107 // } else if (T==AZ) { //no averaging
108 // std::cout << "cylindrical, R averaging" << std::endl;
109 // StatisticsVector<AZ> stats(argc, argv);
110 // stats.statistics_from_p3();
111 // } else if (T==A) { //no averaging
112 // std::cout << "cylindrical, RZ averaging" << std::endl;
113 // StatisticsVector<A> stats(argc, argv);
114 // stats.statistics_from_p3();
115 // } else if (T==R) { //no averaging
116 // std::cout << "cylindrical, AZ averaging" << std::endl;
117 // StatisticsVector<R> stats(argc, argv);
118 // stats.statistics_from_p3();
119  } else if (T==XYZ) { //no averaging
120  std::cout << "no averaging" << std::endl;
121  StatisticsVector<XYZ> stats(argc, argv);
122  std::cout << "stats" << std::endl;
123  stats.statistics_from_p3();
124  } else {std::cerr << "stattype not found" << std::endl; exit(-1); }
125  return 0;
126 }
StatType
Creates averaged statistics (only valid if density field is homogenous along averaged direction) ...
This class is used to extract statistical data from MD simulations.