DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
DataTypeOverloads.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (c) 2017-2025 The Regents of the University of Michigan and DFT-FE
4// authors.
5//
6// This file is part of the DFT-FE code.
7//
8// The DFT-FE code is free software; you can use it, redistribute
9// it, and/or modify it under the terms of the GNU Lesser General
10// Public License as published by the Free Software Foundation; either
11// version 2.1 of the License, or (at your option) any later version.
12// The full text of the license can be found in the file LICENSE at
13// the top level of the DFT-FE distribution.
14//
15// ---------------------------------------------------------------------
16
17
18#ifndef dftfeDataTypeOverloads_h
19#define dftfeDataTypeOverloads_h
20
21#include <complex>
22
23namespace dftfe
24{
25 namespace utils
26 {
27 inline double
28 realPart(const double x)
29 {
30 return x;
31 }
32
33 inline float
34 realPart(const float x)
35 {
36 return x;
37 }
38
39 inline double
40 realPart(const std::complex<double> x)
41 {
42 return x.real();
43 }
44
45 inline float
46 realPart(const std::complex<float> x)
47 {
48 return x.real();
49 }
50
51 inline double
52 imagPart(const double x)
53 {
54 return 0;
55 }
56
57
58 inline float
59 imagPart(const float x)
60 {
61 return 0;
62 }
63
64 inline double
65 imagPart(const std::complex<double> x)
66 {
67 return x.imag();
68 }
69
70 inline float
71 imagPart(const std::complex<float> x)
72 {
73 return x.imag();
74 }
75
76 inline double
77 complexConj(const double x)
78 {
79 return x;
80 }
81
82 inline float
83 complexConj(const float x)
84 {
85 return x;
86 }
87
88 inline std::complex<double>
89 complexConj(const std::complex<double> x)
90 {
91 return std::conj(x);
92 }
93
94 inline std::complex<float>
95 complexConj(const std::complex<float> x)
96 {
97 return std::conj(x);
98 }
99 } // namespace utils
100} // namespace dftfe
101
102#endif
Definition Cell.h:36
double complexConj(const double x)
Definition DataTypeOverloads.h:77
double imagPart(const double x)
Definition DataTypeOverloads.h:52
double realPart(const double x)
Definition DataTypeOverloads.h:28
Definition pseudoPotentialToDftfeConverter.cc:34