/**
 * @brief CODATA recommended values of fundamental physical constants: 2018
 *
 * @author Yunhai Li (liyunhai1016@hotmail.com)
 * @note Review of Modern Physics, 93, 025010 (2021)
 * https://journals.aps.org/rmp/abstract/10.1103/RevModPhys.93.025010
 *
 * @copyright Copyright (c) 2024, TBPLaS develop team.
 */

#ifndef TBPLAS_BASE_CONSTS_H
#define TBPLAS_BASE_CONSTS_H

#include "datatypes.h"

namespace tbplas::base {

/// @brief PI
constexpr double PI = 3.14159265358979323846;

/// @brief twice of PI
constexpr double TWOPI = 2.0 * PI;

/// @brief imaginary unit
constexpr complex_t UIMAG(0.0, 1.0);

/// @brief Scaling factor from bohr to angstrom
/// Table XXXI, pp. 45
constexpr double BOHR2ANG = 0.529177210903;

/// @brief Scaling factor from bohr to nm
constexpr double BOHR2NM = 0.1 * BOHR2ANG;

/// @brief Scaling factor from angstrom to bohr
constexpr double ANG2BOHR = 1.0 / BOHR2ANG;

/// @brief Scaling factor from nm to bohr
constexpr double NM2BOHR = 1.0 / BOHR2NM;

/// @brief Scaling factor from angstrom to nm
constexpr double ANG2NM = 0.1;

/// @brief Scaling factor from angstrom to nm
/// @note This constant is for compatibility with Python version.
constexpr double ANG = ANG2NM;

/// @brief Scaling factor from nm to angstrom
constexpr double NM2ANG = 1.0 / ANG2NM;

/// @brief Scaling factor from nm to nm
/// @note This constant is for compatibility with Python version.
constexpr double NM = 1.0;

/// @brief Scaling factor from Hartree to eV
/// Table XXXI, pp. 45
constexpr double HAR2EV = 27.211386245988;

/// @brief Scaling factor from eV to Hartree
constexpr double EV2HAR = 1.0 / HAR2EV;

/// @brief Scaling factor from Hartree to Joule
/// Table XXXI, pp. 45
constexpr double HAR2J = 4.3597447222071e-18;

/// @brief Scaling factor from Joule to Hartree
constexpr double J2HAR = 1.0 / HAR2J;

/// @brief Reduced Planck constant in J*s
/// Table XXXI, pp. 45
constexpr double HBAR_JS = 1.054571817e-34;

/// @brief Reduced Planck constant in eV*s
/// Table XXXI, pp. 45
constexpr double HBAR_EVS = 6.582119569e-16;

/// @brief Reduced Planck constant in Hartree*s
constexpr double HBAR_HARS = HBAR_EVS * EV2HAR;

/// @brief Boltzmann constant in J/K
/// Table XXXI, pp. 49
constexpr double KB_JK = 1.380649e-23;

/// @brief Boltzmann constant in eV/K
/// Table XXXI, pp. 49
constexpr double KB_EVK = 8.617333262e-5;

/// @brief Boltzmann const in Hartree/K
constexpr double KB_HARK = KB_EVK * EV2HAR;

/// @brief Scaling factor from a.u. time to femto-second
/// Table XXXIV, pp.51
constexpr double AU2FS = HBAR_JS / HAR2J * 1.0e15;

/// @brief Scaling factor from femto-second to a.u. time
constexpr double FS2AU = 1.0 / AU2FS;

/// @brief Criterion to compare to floats
constexpr double INFINITESIMAL = 1.0e-15;

/// @brief Elementary charge in SI units
constexpr double Q_SI = 1.602176634e-19;

/// @brief Vacuum electric permittivity in SI units
constexpr double EPSILON0_SI = 8.8541878128e-12;

/// @brief Dielectric constant of vacuum in eV/nm/q units
constexpr double EPSILON0 = 4 * PI * EPSILON0_SI / Q_SI * 1e-9;

/// @brief Field factor in Peierls substitution in nm/kg/s units
constexpr double PEIERLS_FACTOR = Q_SI / (2 * HBAR_JS) * 1e-18;

} // namespace tbplas::base

#endif