File: cvector_3.h

package info (click to toggle)
lammps 0~20181211.gitad1b1897d%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 318,860 kB
  • sloc: cpp: 729,569; python: 40,508; xml: 14,919; fortran: 12,142; ansic: 7,454; sh: 5,565; perl: 4,105; f90: 2,700; makefile: 2,117; objc: 238; lisp: 163; tcl: 61; csh: 16; awk: 14
file content (75 lines) | stat: -rw-r--r-- 1,902 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*s***************************************************************************
 *
 *   Copyright (c), Ilya Valuev 2005        All Rights Reserved.
 *
 *   Author  : Ilya Valuev, MIPT, Moscow, Russia
 *
 *   Project  : GridMD, ivutils
 *
 *   
 *
 *****************************************************************************/
/*r @file vector_3.h @brief      
*/ 

# ifndef CVECTOR_3A_H
# define CVECTOR_3A_H

# include <complex>
# include <cmath>
# include "vector_3.h"

using namespace std;

typedef complex<vec_type>     cdouble;
typedef Vector_Nt<cdouble,3>  cVector_3;

//------------------------------------------------------
// Overloads for cdouble
//------------------------------------------------------

inline cdouble operator*(int a, const cdouble &b){
  return ((double)a)*b;
}
inline cdouble operator*(const cdouble &b,int a){
  return a*b;
}
inline cdouble operator/(const cdouble &b,int a){
  return (1./a)*b;
}

inline cdouble operator/(int a, const cdouble &b){
  return (a)*(1./b);
}

//------------------------------------------------------
// Overloads for cVector_3
//------------------------------------------------------

inline cVector_3 operator*(const cdouble &a, const Vector_3 &v){
  return cVector_3(a*v[0], a*v[1], a*v[2]);  // a*cVector_3(v);
}

inline cVector_3 operator*(const Vector_3 &v, const cdouble &a){
  return a*v;
}

inline Vector_3 real(const cVector_3 &cv){
  return Vector_3(cv[0].real(), cv[1].real(), cv[2].real());
}

inline Vector_3 imag(const cVector_3 &cv){
  return Vector_3(cv[0].imag(), cv[1].imag(), cv[2].imag());
}

inline cVector_3 conj(const cVector_3 &cv){
  return cVector_3(conj(cv[0]), conj(cv[1]), conj(cv[2]));
}

inline cVector_3 rcell1(cVector_3& cv, Vector_3 &cell, int flags=0xffff) {
  return cVector_3( real(cv).rcell1(cell, flags) ) + cdouble(0,1)*imag(cv);
}


# endif // __CVECTOR_3A_H