Skip to content

Commit

Permalink
include/libint2/boys.h
Browse files Browse the repository at this point in the history
include/libint2/diis.h
include/libint2/engine.h
include/libint2/engine.impl.h
include/libint2/lcao/1body.h
include/libint2/shell.h
include/libint2/solidharmonics.h
include/libint2/util/array_adaptor.h
include/libint2/util/compressed_pair.h
include/libint2/util/intpart_iter.h
  • Loading branch information
e-kwsm committed Oct 31, 2023
1 parent ebb8677 commit 8b14bc8
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 100 deletions.
16 changes: 8 additions & 8 deletions include/libint2/boys.h
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,7 @@ namespace libint2 {
}
}

typedef typename std::vector<std::pair<AnyReal, AnyReal> >::const_iterator citer;
using citer = typename std::vector<std::pair<AnyReal, AnyReal> >::const_iterator;
const citer gend = geminal.end();
for(citer i=geminal.begin(); i!= gend; ++i) {

Expand Down Expand Up @@ -1582,7 +1582,7 @@ namespace libint2 {
template <typename GmEvalFunction>
struct GenericGmEval : private GmEvalFunction {

typedef typename GmEvalFunction::value_type Real;
using Real = typename GmEvalFunction::value_type;

GenericGmEval(int mmax, Real precision) : GmEvalFunction(mmax, precision),
mmax_(mmax), precision_(precision) {}
Expand Down Expand Up @@ -1640,7 +1640,7 @@ namespace libint2 {
/// core integral evaluator delta function kernels
template <typename Real>
struct delta_gm_eval {
typedef Real value_type;
using value_type = Real;

delta_gm_eval(unsigned int, Real) {}
void operator()(Real* Gm, Real rho, Real T, int mmax) const {
Expand All @@ -1661,8 +1661,8 @@ namespace libint2 {
template <typename Real>
struct r12_xx_K_gm_eval<Real, 1>
: private detail::CoreEvalScratch<r12_xx_K_gm_eval<Real, 1>> {
typedef detail::CoreEvalScratch<r12_xx_K_gm_eval<Real, 1>> base_type;
typedef Real value_type;
using base_type = detail::CoreEvalScratch<r12_xx_K_gm_eval<Real, 1>>;
using value_type = Real;

#ifndef LIBINT_USER_DEFINED_REAL
using FmEvalType = libint2::FmEval_Chebyshev7<double>;
Expand Down Expand Up @@ -1694,7 +1694,7 @@ namespace libint2 {
/// core integral evaluator for \f$ \mathrm{erf}(\omega r) / r \f$ kernel
template <typename Real>
struct erf_coulomb_gm_eval {
typedef Real value_type;
using value_type = Real;

#ifndef LIBINT_USER_DEFINED_REAL
using FmEvalType = libint2::FmEval_Chebyshev7<double>;
Expand Down Expand Up @@ -1735,8 +1735,8 @@ namespace libint2 {
template <typename Real>
struct erfc_coulomb_gm_eval : private
detail::CoreEvalScratch<erfc_coulomb_gm_eval<Real>> {
typedef detail::CoreEvalScratch<erfc_coulomb_gm_eval<Real>> base_type;
typedef Real value_type;
using base_type = detail::CoreEvalScratch<erfc_coulomb_gm_eval<Real>>;
using value_type = Real;

#ifndef LIBINT_USER_DEFINED_REAL
using FmEvalType = libint2::FmEval_Chebyshev7<double>;
Expand Down
10 changes: 5 additions & 5 deletions include/libint2/diis.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ namespace libint2 {

template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
struct traits<Eigen::Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols >> {
typedef Eigen::Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > D;
typedef typename D::Scalar element_type;
using D = Eigen::Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols >;
using element_type = typename D::Scalar;
};

template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
Expand Down Expand Up @@ -131,7 +131,7 @@ namespace libint2 {
template <typename D>
class DIIS {
public:
typedef typename diis::traits<D>::element_type value_type;
using value_type = typename diis::traits<D>::element_type;

/// Constructor

Expand Down Expand Up @@ -330,8 +330,8 @@ namespace libint2 {
value_type damping_factor;
value_type mixing_fraction;

typedef Eigen::Matrix<value_type, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> EigenMatrixX;
typedef Eigen::Matrix<value_type, Eigen::Dynamic, 1> EigenVectorX;
using EigenMatrixX = Eigen::Matrix<value_type, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
using EigenVectorX = Eigen::Matrix<value_type, Eigen::Dynamic, 1>;

EigenMatrixX B_; //!< B(i,j) = <ei|ej>

Expand Down
66 changes: 28 additions & 38 deletions include/libint2/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace libint2 {
/// contracted Gaussian geminal = \f$ \sum_i c_i \exp(- \alpha r_{12}^2) \f$,
/// represented as a vector of
/// {\f$ \alpha_i \f$, \f$ c_i \f$ } pairs
typedef std::vector<std::pair<double, double>> ContractedGaussianGeminal;
using ContractedGaussianGeminal = std::vector<std::pair<double, double>>;

constexpr size_t num_geometrical_derivatives(size_t ncenter,
size_t deriv_order) {
Expand Down Expand Up @@ -181,8 +181,8 @@ inline constexpr int rank(Operator oper) {

namespace detail {
struct default_operator_traits {
typedef struct {
} oper_params_type;
struct oper_params_type {
};
static oper_params_type default_params() { return oper_params_type{}; }
static constexpr auto nopers = 1u;
struct _core_eval_type {
Expand All @@ -207,13 +207,12 @@ template <>
struct operator_traits<Operator::nuclear>
: public detail::default_operator_traits {
/// point charges and their positions
typedef std::vector<std::pair<scalar_type, std::array<scalar_type, 3>>>
oper_params_type;
using oper_params_type = std::vector<std::pair<scalar_type, std::array<scalar_type, 3>>>;
static oper_params_type default_params() { return oper_params_type{}; }
#ifndef LIBINT_USER_DEFINED_REAL
typedef const libint2::FmEval_Chebyshev7<scalar_type> core_eval_type;
using core_eval_type = const libint2::FmEval_Chebyshev7<scalar_type>;
#else
typedef const libint2::FmEval_Reference<scalar_type> core_eval_type;
using core_eval_type = const libint2::FmEval_Reference<scalar_type>;
#endif
};

Expand All @@ -222,35 +221,32 @@ struct operator_traits<Operator::erf_nuclear>
: public detail::default_operator_traits {
/// the attenuation parameter (0 = zero potential, +infinity = no attenuation)
/// + point charges and positions
typedef std::tuple<
scalar_type, typename operator_traits<Operator::nuclear>::oper_params_type>
oper_params_type;
using oper_params_type = std::tuple<
scalar_type, typename operator_traits<Operator::nuclear>::oper_params_type>;
static oper_params_type default_params() {
return std::make_tuple(0,operator_traits<Operator::nuclear>::default_params());
}
typedef const libint2::GenericGmEval<libint2::os_core_ints::erf_coulomb_gm_eval<scalar_type>>
core_eval_type;
using core_eval_type = const libint2::GenericGmEval<libint2::os_core_ints::erf_coulomb_gm_eval<scalar_type>>;
};

template <>
struct operator_traits<Operator::erfc_nuclear>
: public detail::default_operator_traits {
/// the attenuation parameter (0 = no attenuation, +infinity = zero potential)
/// + point charges and positions
typedef typename operator_traits<Operator::erf_nuclear>::oper_params_type oper_params_type;
using oper_params_type = typename operator_traits<Operator::erf_nuclear>::oper_params_type;
static oper_params_type default_params() {
return std::make_tuple(0,operator_traits<Operator::nuclear>::default_params());
}
typedef const libint2::GenericGmEval<libint2::os_core_ints::erfc_coulomb_gm_eval<scalar_type>>
core_eval_type;
using core_eval_type = const libint2::GenericGmEval<libint2::os_core_ints::erfc_coulomb_gm_eval<scalar_type>>;
};

template <>
struct operator_traits<Operator::emultipole1>
: public detail::default_operator_traits {
/// Cartesian coordinates of the origin with respect to which the dipole
/// moment is defined
typedef std::array<double, 3> oper_params_type;
using oper_params_type = std::array<double, 3>;
static oper_params_type default_params() {
return oper_params_type{{0,0,0}};
}
Expand Down Expand Up @@ -280,16 +276,16 @@ template <>
struct operator_traits<Operator::coulomb>
: public detail::default_operator_traits {
#ifndef LIBINT_USER_DEFINED_REAL
typedef const libint2::FmEval_Chebyshev7<scalar_type> core_eval_type;
using core_eval_type = const libint2::FmEval_Chebyshev7<scalar_type>;
#else
typedef const libint2::FmEval_Reference<scalar_type> core_eval_type;
using core_eval_type = const libint2::FmEval_Reference<scalar_type>;
#endif
};
namespace detail {
template <int K>
struct cgtg_operator_traits : public detail::default_operator_traits {
typedef libint2::GaussianGmEval<scalar_type, K> core_eval_type;
typedef ContractedGaussianGeminal oper_params_type;
using core_eval_type = libint2::GaussianGmEval<scalar_type, K>;
using oper_params_type = ContractedGaussianGeminal;
};
} // namespace detail
template <>
Expand All @@ -305,62 +301,56 @@ struct operator_traits<Operator::delcgtg2>
template <>
struct operator_traits<Operator::delta>
: public detail::default_operator_traits {
typedef const libint2::GenericGmEval<libint2::os_core_ints::delta_gm_eval<scalar_type>>
core_eval_type;
using core_eval_type = const libint2::GenericGmEval<libint2::os_core_ints::delta_gm_eval<scalar_type>>;
};

template <>
struct operator_traits<Operator::r12>
: public detail::default_operator_traits {
typedef const libint2::GenericGmEval<libint2::os_core_ints::r12_xx_K_gm_eval<scalar_type, 1>>
core_eval_type;
using core_eval_type = const libint2::GenericGmEval<libint2::os_core_ints::r12_xx_K_gm_eval<scalar_type, 1>>;
};

template <>
struct operator_traits<Operator::erf_coulomb>
: public detail::default_operator_traits {
/// the attenuation parameter (0 = zero potential, +infinity = no attenuation)
typedef scalar_type oper_params_type;
using oper_params_type = scalar_type;
static oper_params_type default_params() {
return oper_params_type{0};
}
typedef const libint2::GenericGmEval<libint2::os_core_ints::erf_coulomb_gm_eval<scalar_type>>
core_eval_type;
using core_eval_type = const libint2::GenericGmEval<libint2::os_core_ints::erf_coulomb_gm_eval<scalar_type>>;
};
template <>
struct operator_traits<Operator::erfc_coulomb>
: public detail::default_operator_traits {
/// the attenuation parameter (0 = no attenuation, +infinity = zero potential)
typedef scalar_type oper_params_type;
using oper_params_type = scalar_type;
static oper_params_type default_params() {
return oper_params_type{0};
}
typedef const libint2::GenericGmEval<libint2::os_core_ints::erfc_coulomb_gm_eval<scalar_type>>
core_eval_type;
using core_eval_type = const libint2::GenericGmEval<libint2::os_core_ints::erfc_coulomb_gm_eval<scalar_type>>;
};

template <>
struct operator_traits<Operator::stg>
: public detail::default_operator_traits {
/// the attenuation parameter (0 = constant, infinity = delta-function)
typedef scalar_type oper_params_type;
using oper_params_type = scalar_type;
static oper_params_type default_params() {
return oper_params_type{0};
}
typedef const libint2::TennoGmEval<scalar_type>
core_eval_type;
using core_eval_type = const libint2::TennoGmEval<scalar_type>;
};

template <>
struct operator_traits<Operator::stg_x_coulomb>
: public detail::default_operator_traits {
/// the attenuation parameter (0 = coulomb, infinity = delta-function)
typedef scalar_type oper_params_type;
using oper_params_type = scalar_type;
static oper_params_type default_params() {
return oper_params_type{0};
}
typedef const libint2::TennoGmEval<scalar_type>
core_eval_type;
using core_eval_type = const libint2::TennoGmEval<scalar_type>;
};

/// the runtime version of \c operator_traits<oper>::default_params()
Expand Down Expand Up @@ -411,8 +401,8 @@ constexpr size_t nderivorders_2body = LIBINT2_MAX_DERIV_ORDER + 1;
*/
class Engine {
private:
typedef struct {
} empty_pod;
struct empty_pod {
};

public:

Expand Down
14 changes: 6 additions & 8 deletions include/libint2/engine.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1796,9 +1796,8 @@ __libint2_engine_inline const Engine::target_ptr_vec& Engine::compute2(
constexpr auto using_scalar_real = sizeof(value_type) == sizeof(scalar_type);
static_assert(using_scalar_real,
"Libint2 C++11 API only supports scalar real types");
typedef Eigen::Matrix<scalar_type, Eigen::Dynamic, Eigen::Dynamic,
Eigen::RowMajor>
Matrix;
using Matrix = Eigen::Matrix<scalar_type, Eigen::Dynamic, Eigen::Dynamic,
Eigen::RowMajor>;

// a 2-d view of the 4-d source tensor
const auto nr1_cart = bra1.cartesian_size();
Expand Down Expand Up @@ -1894,11 +1893,10 @@ __libint2_engine_inline const Engine::target_ptr_vec& Engine::compute2(

for (auto r1 = 0; r1 != nr1; ++r1) {
for (auto r2 = 0; r2 != nr2; ++r2, src_row_ptr += ncol) {
typedef Eigen::Map<const Matrix> ConstMap;
typedef Eigen::Map<Matrix> Map;
typedef Eigen::Map<Matrix, Eigen::Unaligned,
Eigen::Stride<Eigen::Dynamic, Eigen::Dynamic>>
StridedMap;
using ConstMap = Eigen::Map<const Matrix>;
using Map = Eigen::Map<Matrix>;
using StridedMap = Eigen::Map<Matrix, Eigen::Unaligned,
Eigen::Stride<Eigen::Dynamic, Eigen::Dynamic>>;

// represent this source row as a matrix
ConstMap src_blk_mat(src_row_ptr, nc1, nc2);
Expand Down
42 changes: 20 additions & 22 deletions include/libint2/lcao/1body.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,19 @@
#include <omp.h>
#endif

typedef btas::RangeNd<CblasRowMajor, std::array<long, 2>> Range2;
typedef btas::RangeNd<CblasRowMajor, std::array<long, 3>> Range3;
typedef btas::RangeNd<CblasRowMajor, std::array<long, 4>> Range4;
typedef btas::Tensor<double, Range2> Tensor2d;
typedef btas::Tensor<double, Range3> Tensor3d;
typedef btas::Tensor<double, Range3> Tensor4d;

typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
Matrix; // import dense, dynamically sized Matrix type from Eigen;
// this is a matrix with row-major storage
// (http://en.wikipedia.org/wiki/Row-major_order)
using Range2 = btas::RangeNd<CblasRowMajor, std::array<long, 2>>;
using Range3 = btas::RangeNd<CblasRowMajor, std::array<long, 3>>;
using Range4 = btas::RangeNd<CblasRowMajor, std::array<long, 4>>;
using Tensor2d = btas::Tensor<double, Range2>;
using Tensor3d = btas::Tensor<double, Range3>;
using Tensor4d = btas::Tensor<double, Range3>;

// import dense, dynamically sized Matrix type from Eigen;
// this is a matrix with row-major storage
// (http://en.wikipedia.org/wiki/Row-major_order)
using Matrix = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
// to meet the layout of the integrals returned by the Libint integral library
typedef Eigen::DiagonalMatrix<double, Eigen::Dynamic, Eigen::Dynamic>
DiagonalMatrix;
using DiagonalMatrix = Eigen::DiagonalMatrix<double, Eigen::Dynamic, Eigen::Dynamic>;

using libint2::Shell;
using libint2::libint2::Atom;
Expand Down Expand Up @@ -151,8 +150,8 @@ struct DFFockEngine {
DFFockEngine(const BasisSet& _obs, const BasisSet& _dfbs)
: obs(_obs), dfbs(_dfbs) {}

typedef btas::RangeNd<CblasRowMajor, std::array<long, 3>> Range3d;
typedef btas::Tensor<double, Range3d> Tensor3d;
using Range3d = btas::RangeNd<CblasRowMajor, std::array<long, 3>>;
using Tensor3d = btas::Tensor<double, Range3d>;
Tensor3d xyK;

// a DF-based builder, using coefficients of occupied MOs
Expand Down Expand Up @@ -853,8 +852,7 @@ std::array<Matrix, libint2::operator_traits<obtype>::nopers> compute_1body_ints(
const auto n = obs.nbf();
const auto nshells = obs.size();
using libint2::nthreads;
typedef std::array<Matrix, libint2::operator_traits<obtype>::nopers>
result_type;
using result_type = std::array<Matrix, libint2::operator_traits<obtype>::nopers>;
const unsigned int nopers = libint2::operator_traits<obtype>::nopers;
result_type result;
for (auto& r : result) r = Matrix::Zero(n, n);
Expand Down Expand Up @@ -928,7 +926,7 @@ std::vector<Matrix> compute_1body_ints_deriv(unsigned deriv_order,
constexpr auto nopers = libint2::operator_traits<obtype>::nopers;
const auto nresults =
nopers * libint2::num_geometrical_derivatives(atoms.size(), deriv_order);
typedef std::vector<Matrix> result_type;
using result_type = std::vector<Matrix>;
result_type result(nresults);
for (auto& r : result) r = Matrix::Zero(n, n);

Expand Down Expand Up @@ -2019,10 +2017,10 @@ Matrix DFFockEngine::compute_2body_fock_dfC(const Matrix& Cocc) {
std::vector<libint2::Timers<5>> timers(nthreads);
for(auto& timer: timers) timer.set_now_overhead(25);

typedef btas::RangeNd<CblasRowMajor, std::array<long, 1>> Range1d;
typedef btas::RangeNd<CblasRowMajor, std::array<long, 2>> Range2d;
typedef btas::Tensor<double, Range1d> Tensor1d;
typedef btas::Tensor<double, Range2d> Tensor2d;
using Range1d = btas::RangeNd<CblasRowMajor, std::array<long, 1>>;
using Range2d = btas::RangeNd<CblasRowMajor, std::array<long, 2>>;
using Tensor1d = btas::Tensor<double, Range1d>;
using Tensor2d = btas::Tensor<double, Range2d>;

// using first time? compute 3-center ints and transform to inv sqrt
// representation
Expand Down
Loading

0 comments on commit 8b14bc8

Please sign in to comment.