diff --git a/include/libint2/boys.h b/include/libint2/boys.h index 8c83ef75a..cc539f4df 100644 --- a/include/libint2/boys.h +++ b/include/libint2/boys.h @@ -1496,7 +1496,7 @@ namespace libint2 { } } - typedef typename std::vector >::const_iterator citer; + using citer = typename std::vector >::const_iterator; const citer gend = geminal.end(); for(citer i=geminal.begin(); i!= gend; ++i) { @@ -1582,7 +1582,7 @@ namespace libint2 { template 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) {} @@ -1640,7 +1640,7 @@ namespace libint2 { /// core integral evaluator delta function kernels template 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 { @@ -1661,8 +1661,8 @@ namespace libint2 { template struct r12_xx_K_gm_eval : private detail::CoreEvalScratch> { - typedef detail::CoreEvalScratch> base_type; - typedef Real value_type; + using base_type = detail::CoreEvalScratch>; + using value_type = Real; #ifndef LIBINT_USER_DEFINED_REAL using FmEvalType = libint2::FmEval_Chebyshev7; @@ -1694,7 +1694,7 @@ namespace libint2 { /// core integral evaluator for \f$ \mathrm{erf}(\omega r) / r \f$ kernel template struct erf_coulomb_gm_eval { - typedef Real value_type; + using value_type = Real; #ifndef LIBINT_USER_DEFINED_REAL using FmEvalType = libint2::FmEval_Chebyshev7; @@ -1735,8 +1735,8 @@ namespace libint2 { template struct erfc_coulomb_gm_eval : private detail::CoreEvalScratch> { - typedef detail::CoreEvalScratch> base_type; - typedef Real value_type; + using base_type = detail::CoreEvalScratch>; + using value_type = Real; #ifndef LIBINT_USER_DEFINED_REAL using FmEvalType = libint2::FmEval_Chebyshev7; diff --git a/include/libint2/diis.h b/include/libint2/diis.h index 5e0640971..0c1eb861b 100644 --- a/include/libint2/diis.h +++ b/include/libint2/diis.h @@ -57,8 +57,8 @@ namespace libint2 { template struct traits> { - 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 @@ -131,7 +131,7 @@ namespace libint2 { template class DIIS { public: - typedef typename diis::traits::element_type value_type; + using value_type = typename diis::traits::element_type; /// Constructor @@ -330,8 +330,8 @@ namespace libint2 { value_type damping_factor; value_type mixing_fraction; - typedef Eigen::Matrix EigenMatrixX; - typedef Eigen::Matrix EigenVectorX; + using EigenMatrixX = Eigen::Matrix; + using EigenVectorX = Eigen::Matrix; EigenMatrixX B_; //!< B(i,j) = diff --git a/include/libint2/engine.h b/include/libint2/engine.h index 179ed093b..110f1b017 100644 --- a/include/libint2/engine.h +++ b/include/libint2/engine.h @@ -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> ContractedGaussianGeminal; +using ContractedGaussianGeminal = std::vector>; constexpr size_t num_geometrical_derivatives(size_t ncenter, size_t deriv_order) { @@ -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 { @@ -207,13 +207,12 @@ template <> struct operator_traits : public detail::default_operator_traits { /// point charges and their positions - typedef std::vector>> - oper_params_type; + using oper_params_type = std::vector>>; static oper_params_type default_params() { return oper_params_type{}; } #ifndef LIBINT_USER_DEFINED_REAL - typedef const libint2::FmEval_Chebyshev7 core_eval_type; + using core_eval_type = const libint2::FmEval_Chebyshev7; #else - typedef const libint2::FmEval_Reference core_eval_type; + using core_eval_type = const libint2::FmEval_Reference; #endif }; @@ -222,14 +221,12 @@ struct operator_traits : 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::oper_params_type> - oper_params_type; + using oper_params_type = std::tuple< + scalar_type, typename operator_traits::oper_params_type>; static oper_params_type default_params() { return std::make_tuple(0,operator_traits::default_params()); } - typedef const libint2::GenericGmEval> - core_eval_type; + using core_eval_type = const libint2::GenericGmEval>; }; template <> @@ -237,12 +234,11 @@ struct operator_traits : public detail::default_operator_traits { /// the attenuation parameter (0 = no attenuation, +infinity = zero potential) /// + point charges and positions - typedef typename operator_traits::oper_params_type oper_params_type; + using oper_params_type = typename operator_traits::oper_params_type; static oper_params_type default_params() { return std::make_tuple(0,operator_traits::default_params()); } - typedef const libint2::GenericGmEval> - core_eval_type; + using core_eval_type = const libint2::GenericGmEval>; }; template <> @@ -250,7 +246,7 @@ struct operator_traits : public detail::default_operator_traits { /// Cartesian coordinates of the origin with respect to which the dipole /// moment is defined - typedef std::array oper_params_type; + using oper_params_type = std::array; static oper_params_type default_params() { return oper_params_type{{0,0,0}}; } @@ -280,16 +276,16 @@ template <> struct operator_traits : public detail::default_operator_traits { #ifndef LIBINT_USER_DEFINED_REAL - typedef const libint2::FmEval_Chebyshev7 core_eval_type; + using core_eval_type = const libint2::FmEval_Chebyshev7; #else - typedef const libint2::FmEval_Reference core_eval_type; + using core_eval_type = const libint2::FmEval_Reference; #endif }; namespace detail { template struct cgtg_operator_traits : public detail::default_operator_traits { - typedef libint2::GaussianGmEval core_eval_type; - typedef ContractedGaussianGeminal oper_params_type; + using core_eval_type = libint2::GaussianGmEval; + using oper_params_type = ContractedGaussianGeminal; }; } // namespace detail template <> @@ -305,62 +301,56 @@ struct operator_traits template <> struct operator_traits : public detail::default_operator_traits { - typedef const libint2::GenericGmEval> - core_eval_type; + using core_eval_type = const libint2::GenericGmEval>; }; template <> struct operator_traits : public detail::default_operator_traits { - typedef const libint2::GenericGmEval> - core_eval_type; + using core_eval_type = const libint2::GenericGmEval>; }; template <> struct operator_traits : 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> - core_eval_type; + using core_eval_type = const libint2::GenericGmEval>; }; template <> struct operator_traits : 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> - core_eval_type; + using core_eval_type = const libint2::GenericGmEval>; }; template <> struct operator_traits : 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 - core_eval_type; + using core_eval_type = const libint2::TennoGmEval; }; template <> struct operator_traits : 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 - core_eval_type; + using core_eval_type = const libint2::TennoGmEval; }; /// the runtime version of \c operator_traits::default_params() @@ -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: diff --git a/include/libint2/engine.impl.h b/include/libint2/engine.impl.h index a1ee9c1c7..a8e1bc373 100644 --- a/include/libint2/engine.impl.h +++ b/include/libint2/engine.impl.h @@ -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 - Matrix; + using Matrix = Eigen::Matrix; // a 2-d view of the 4-d source tensor const auto nr1_cart = bra1.cartesian_size(); @@ -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 ConstMap; - typedef Eigen::Map Map; - typedef Eigen::Map> - StridedMap; + using ConstMap = Eigen::Map; + using Map = Eigen::Map; + using StridedMap = Eigen::Map>; // represent this source row as a matrix ConstMap src_blk_mat(src_row_ptr, nc1, nc2); diff --git a/include/libint2/lcao/1body.h b/include/libint2/lcao/1body.h index cf0ad5480..f07a6336c 100644 --- a/include/libint2/lcao/1body.h +++ b/include/libint2/lcao/1body.h @@ -50,20 +50,19 @@ #include #endif -typedef btas::RangeNd> Range2; -typedef btas::RangeNd> Range3; -typedef btas::RangeNd> Range4; -typedef btas::Tensor Tensor2d; -typedef btas::Tensor Tensor3d; -typedef btas::Tensor Tensor4d; - -typedef Eigen::Matrix - 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>; +using Range3 = btas::RangeNd>; +using Range4 = btas::RangeNd>; +using Tensor2d = btas::Tensor; +using Tensor3d = btas::Tensor; +using Tensor4d = btas::Tensor; + +// 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; // to meet the layout of the integrals returned by the Libint integral library -typedef Eigen::DiagonalMatrix - DiagonalMatrix; +using DiagonalMatrix = Eigen::DiagonalMatrix; using libint2::Shell; using libint2::libint2::Atom; @@ -151,8 +150,8 @@ struct DFFockEngine { DFFockEngine(const BasisSet& _obs, const BasisSet& _dfbs) : obs(_obs), dfbs(_dfbs) {} - typedef btas::RangeNd> Range3d; - typedef btas::Tensor Tensor3d; + using Range3d = btas::RangeNd>; + using Tensor3d = btas::Tensor; Tensor3d xyK; // a DF-based builder, using coefficients of occupied MOs @@ -853,8 +852,7 @@ std::array::nopers> compute_1body_ints( const auto n = obs.nbf(); const auto nshells = obs.size(); using libint2::nthreads; - typedef std::array::nopers> - result_type; + using result_type = std::array::nopers>; const unsigned int nopers = libint2::operator_traits::nopers; result_type result; for (auto& r : result) r = Matrix::Zero(n, n); @@ -928,7 +926,7 @@ std::vector compute_1body_ints_deriv(unsigned deriv_order, constexpr auto nopers = libint2::operator_traits::nopers; const auto nresults = nopers * libint2::num_geometrical_derivatives(atoms.size(), deriv_order); - typedef std::vector result_type; + using result_type = std::vector; result_type result(nresults); for (auto& r : result) r = Matrix::Zero(n, n); @@ -2019,10 +2017,10 @@ Matrix DFFockEngine::compute_2body_fock_dfC(const Matrix& Cocc) { std::vector> timers(nthreads); for(auto& timer: timers) timer.set_now_overhead(25); - typedef btas::RangeNd> Range1d; - typedef btas::RangeNd> Range2d; - typedef btas::Tensor Tensor1d; - typedef btas::Tensor Tensor2d; + using Range1d = btas::RangeNd>; + using Range2d = btas::RangeNd>; + using Tensor1d = btas::Tensor; + using Tensor2d = btas::Tensor; // using first time? compute 3-center ints and transform to inv sqrt // representation diff --git a/include/libint2/shell.h b/include/libint2/shell.h index 0f7c6d51b..0ee614b79 100644 --- a/include/libint2/shell.h +++ b/include/libint2/shell.h @@ -79,7 +79,7 @@ namespace libint2 { * normalization-free primitives before computing integrals (see \c Shell::renorm() ). */ struct Shell { - typedef double real_t; + using real_t = double; /// contracted Gaussian = angular momentum + sph/cart flag + contraction coefficients struct Contraction { @@ -199,7 +199,7 @@ namespace libint2 { } struct defaultable_boolean { - typedef enum {false_value=0,true_value=1,default_value=2} value_t; + enum value_t {false_value=0,true_value=1,default_value=2}; defaultable_boolean() : value_(default_value) {} defaultable_boolean(bool v) : value_(static_cast(v?1:0)) {} bool is_default() const { return value_ == default_value; } @@ -392,7 +392,7 @@ namespace libint2 { /// ShellPair contains pre-computed shell-pair data, primitive pairs are screened to finite precision struct ShellPair { - typedef Shell::real_t real_t; + using real_t = Shell::real_t; // clang-format off /// PrimPairData contains pre-computed primitive pair data diff --git a/include/libint2/solidharmonics.h b/include/libint2/solidharmonics.h index e39f242db..161e21015 100644 --- a/include/libint2/solidharmonics.h +++ b/include/libint2/solidharmonics.h @@ -55,7 +55,7 @@ namespace libint2 { template class SolidHarmonicsCoefficients { public: - typedef ::libint2::value_type real_t; + using real_t = ::libint2::value_type; SolidHarmonicsCoefficients() : l_(-1) { } diff --git a/include/libint2/util/array_adaptor.h b/include/libint2/util/array_adaptor.h index 21a2e830a..212bd5294 100644 --- a/include/libint2/util/array_adaptor.h +++ b/include/libint2/util/array_adaptor.h @@ -44,7 +44,7 @@ class ext_stack_allocator { using propagate_on_container_move_assignment = std::true_type; static auto constexpr size = N; - typedef T array_type[N]; + using array_type = T[N]; private: T* stack_; // stack-allocated storage diff --git a/include/libint2/util/compressed_pair.h b/include/libint2/util/compressed_pair.h index 44aceba93..2b56e966c 100644 --- a/include/libint2/util/compressed_pair.h +++ b/include/libint2/util/compressed_pair.h @@ -29,16 +29,16 @@ namespace libint2 { class compressed_pair : private T1, private T2 { public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename std::add_const::type first_const_type; - typedef typename std::add_const::type second_const_type; - typedef typename std::add_lvalue_reference::type first_reference; - typedef typename std::add_lvalue_reference::type second_reference; - typedef typename std::add_lvalue_reference::type first_const_reference; - typedef typename std::add_lvalue_reference::type second_const_reference; - typedef typename std::add_rvalue_reference::type first_rvalue_reference; - typedef typename std::add_rvalue_reference::type second_rvalue_reference; + using first_type = T1; + using second_type = T2; + using first_const_type = typename std::add_const::type; + using second_const_type = typename std::add_const::type; + using first_reference = typename std::add_lvalue_reference::type; + using second_reference = typename std::add_lvalue_reference::type; + using first_const_reference = typename std::add_lvalue_reference::type; + using second_const_reference = typename std::add_lvalue_reference::type; + using first_rvalue_reference = typename std::add_rvalue_reference::type; + using second_rvalue_reference = typename std::add_rvalue_reference::type; compressed_pair() = default; compressed_pair(const first_type& x, const second_type& y) : diff --git a/include/libint2/util/intpart_iter.h b/include/libint2/util/intpart_iter.h index b8e0af2dc..e28cd2595 100644 --- a/include/libint2/util/intpart_iter.h +++ b/include/libint2/util/intpart_iter.h @@ -73,10 +73,10 @@ template ::is_integer>::type> struct FixedOrderedIntegerPartitionIterator { public: - typedef const Sequence& value_type; - typedef typename Sequence::value_type integer_type; - typedef typename std::make_unsigned::type unsigned_integer_type; - typedef typename Sequence::size_type size_type; + using value_type = const Sequence&; + using integer_type = typename Sequence::value_type; + using unsigned_integer_type = typename std::make_unsigned::type; + using size_type = typename Sequence::size_type; /// \param n the positive integer to be partitioned template