CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
CASM_global_definitions.hh
Go to the documentation of this file.
1 #ifndef CASM_GLOBAL_DEFINTIONS_HH
2 #define CASM_GLOBAL_DEFINTIONS_HH
3 
4 #include <iostream>
5 #include <cmath>
6 #include <cstddef>
7 #include <complex>
8 #include <string>
9 #include <sstream>
10 #include <vector>
11 
12 
13 #include "casm/external/Eigen/Dense"
14 #include "casm/external/boost.hh"
15 
16 namespace CASM {
17 
18  namespace fs = boost::filesystem;
19  namespace po = boost::program_options;
20 
21  using std::swap;
22 
23  typedef unsigned int uint;
24  typedef unsigned long int ulint;
25  typedef long int lint;
26 
29 
30  //tolerance
31  const double TOL = 0.00001;
32 
33  //Boltzmann Constant
34  const double KB = 8.6173423E-05; //eV/K
35 
36  //Planck's Constant
37  const double PLANCK = 4.135667516E-15; //eV-s
38 
39  template<class T>
40  std::istream &operator>>(std::istream &_in, std::vector<T> &vec) {
41  std::string line;
42  std::getline(_in, line, '\n');
43  std::stringstream tss(line);
44  T tval;
45  while(_in) {
46  _in >> tval;
47  vec.push_back(tval);
48  }
49 
50  return _in;
51  }
52 
54  typedef EigenIndex Index;
55  bool valid_index(Index i);
56 
57  enum COORD_TYPE {FRAC = 0, CART = 1, COORD_DEFAULT = 2};
58  std::istream &operator>>(std::istream &sin, COORD_TYPE &coord);
59 
60 
61 
63 
64  enum CELL_TYPE {PRIM = 0, SCEL = 1};
65 
66  enum COMPLEX_OUTPUT_TYPE {REAL = 0, IMAG = 1, COMPLEX = 2}; // Added by Ivy
67 
68  enum CASMfileTypes {TYPEFILE, TYPEDIR, TYPEOTHER, IOERR}; // Moved from FileSystemInterface.cc by Ivy 01/16/14
69 
70  //************************************************************
71 
72  void print_splash(std::ostream &out);
73 
76  template<typename Object, typename Transform, typename...Args>
77  Object &apply(const Transform &f, Object &obj, Args &&...args) {
78  return obj.apply_sym(f, std::forward<Args>(args)...);
79  }
80 
83  template<typename Object, typename Transform, typename...Args>
84  Object copy_apply(const Transform &f, Object obj, Args &&...args) {
85  return apply(f, obj, std::forward<Args>(args)...);
86  }
87 
88 };
89 
90 namespace Eigen {
91 
92  typedef Matrix<long int, 3, 3> Matrix3l;
93  typedef Matrix<long int, 3, 1> Vector3l;
94  typedef Matrix<long int, Dynamic, Dynamic> MatrixXl;
95  typedef Matrix<long int, Dynamic, 1> VectorXl;
96 
97  template<typename Derived>
98  std::istream &operator >> (std::istream &s, MatrixBase<Derived> &m) {
99  for(int i = 0; i < m.rows(); ++i)
100  for(int j = 0; j < m.cols(); j++)
101  s >> m(i, j);
102  return s;
103  }
104 }
105 
106 
107 namespace std {
108  template<class T>
109  ostream &operator<<(ostream &out, const vector<T> &vec) {
110  if(vec.size() == 0)
111  out << "[empty] ";
112  for(auto it = vec.cbegin(); it != vec.cend(); ++it) {
113  out << *it << " ";
114  }
115  return out;
116  }
117 }
118 
119 
120 #endif
Matrix< long int, 3, 1 > Vector3l
Object copy_apply(const Transform &f, Object obj, Args &&...args)
Matrix< long int, Dynamic, Dynamic > MatrixXl
Main CASM namespace.
Definition: complete.cpp:8
const double TOL
std::istream & operator>>(std::istream &s, MatrixBase< Derived > &m)
void swap(ConfigDoF &A, ConfigDoF &B)
Definition: ConfigDoF.cc:195
Eigen::MatrixXd::Index EigenIndex
For integer indexing:
EigenIndex Index
For long integer indexing:
Matrix< long int, Dynamic, 1 > VectorXl
const double KB
unsigned long int ulint
void print_splash(std::ostream &out)
std::istream & operator>>(std::istream &_in, std::vector< T > &vec)
Matrix< long int, 3, 3 > Matrix3l
const double PLANCK
Object & apply(const Transform &f, Object &obj, Args &&...args)
unsigned int uint
bool valid_index(Index i)