Skip to content

Commit

Permalink
Implement LIBINT_DEPRECATED and deprecate global-scoped functions
Browse files Browse the repository at this point in the history
  • Loading branch information
e-kwsm committed Sep 13, 2021
1 parent e2d495c commit c5cc9aa
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
18 changes: 18 additions & 0 deletions include/libint2/cgshell_ordering.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ namespace libint2 {
namespace libint2 {
inline int INT_NCART(int am) { return ((am + 2) * (am + 1)) >> 1; }
}
LIBINT_DEPRECATED("please use libint2::INT_NCART instead")
inline int INT_NCART(int am) { return libint2::INT_NCART(am); }

/* For a given ang. mom., am, with n cartesian functions, compute the
* number of cartesian functions for am+1 or am-1
Expand All @@ -71,6 +73,10 @@ namespace libint2 {
inline int INT_NCART_DEC(int am, int n) { return n - am - 1; }
inline int INT_NCART_INC(int am, int n) { return n + am + 2; }
}
LIBINT_DEPRECATED("please use libint2::INT_NCART_DEC instead")
inline int INT_NCART_DEC(int am, int n) { return libint2::INT_NCART_DEC(am, n); }
LIBINT_DEPRECATED("please use libint2::INT_NCART_INC instead")
inline int INT_NCART_INC(int am, int n) { return libint2::INT_NCART_INC(am, n); }

//
// Macros that define orderings
Expand Down Expand Up @@ -99,6 +105,8 @@ inline int INT_CARTINDEX(unsigned int am, int i, int j) {
return (((am - i + 1) * (am - i)) >> 1) + am - i - j;
}
}
LIBINT_DEPRECATED("please use libint2::INT_CARTINDEX instead")
inline int INT_CARTINDEX(unsigned int am, int i, int j) { return libint2::INT_CARTINDEX(am, i, j); }

/* This sets up the above loop over cartesian exponents as follows
* int i, j, k;
Expand Down Expand Up @@ -139,6 +147,8 @@ inline int INT_CARTINDEX(unsigned int am, int i, int j) {
return ((((am + 1) << 1)- i) * (i + 1)) >> 1 - j - 1 ;
}
}
LIBINT_DEPRECATED("please use libint2::INT_CARTINDEX instead")
inline int INT_CARTINDEX(unsigned int am, int i, int j) { return libint2::INT_CARTINDEX(am, i, j); }

/* This sets up the above loop over cartesian exponents as follows
* FOR_CART(i,j,k,am)
Expand Down Expand Up @@ -166,6 +176,8 @@ inline int INT_CARTINDEX(unsigned int am, int i, int j) {
return libint2::CGShellInfo<libint2::CGShellOrderingData<libint2::CGShellOrdering_GAMESS>>::cartindex(am, i, j);
}
}
LIBINT_DEPRECATED("please use libint2::INT_CARTINDEX instead")
inline int INT_CARTINDEX(unsigned int am, int i, int j) { return libint2::INT_CARTINDEX(am, i, j); }

/* This sets up the above loop over cartesian exponents as follows
* FOR_CART(i,j,k,am)
Expand All @@ -192,6 +204,8 @@ inline int INT_CARTINDEX(unsigned int am, int i, int j) {
return libint2::CGShellInfo<libint2::CGShellOrderingData<libint2::CGShellOrdering_ORCA>>::cartindex(am, i, j);
}
}
LIBINT_DEPRECATED("please use libint2::INT_CARTINDEX instead")
inline int INT_CARTINDEX(unsigned int am, int i, int j) { return libint2::INT_CARTINDEX(am, i, j); }

/* This sets up the above loop over cartesian exponents as follows
* FOR_CART(i,j,k,am)
Expand Down Expand Up @@ -228,6 +242,8 @@ inline int INT_CARTINDEX(unsigned int am, int i, int j) {
return ((am + (i + j) + 2) * (am - (i + j) + 1) >> 1) - i -1;
}
}
LIBINT_DEPRECATED("please use libint2::INT_CARTINDEX instead")
inline int INT_CARTINDEX(unsigned int am, int i, int j) { return libint2::INT_CARTINDEX(am, i, j); }

/* This sets up the above loop over cartesian exponents as follows
* FOR_CART(i,j,k,am)
Expand All @@ -248,6 +264,8 @@ inline int INT_CARTINDEX_MOLDEN(unsigned int am, int i, int j) {
return libint2::CGShellInfo<libint2::CGShellOrderingData<libint2::CGShellOrdering_MOLDEN, 4u>>::cartindex(am, i, j);
}
}
LIBINT_DEPRECATED("please use libint2::INT_CARTINDEX_MOLDEN instead")
inline int INT_CARTINDEX_MOLDEN(unsigned int am, int i, int j) { return libint2::INT_CARTINDEX_MOLDEN(am, i, j); }

/* FOR_CART_MOLDEN(i,j,k,am)
* END_FOR_CART_MOLDEN
Expand Down
9 changes: 9 additions & 0 deletions include/libint2/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -347,4 +347,13 @@
#define LIBINT_PRAGMA_GCC(x)
#endif

#ifdef __has_cpp_attribute
#if __has_cpp_attribute(deprecated)
#define LIBINT_DEPRECATED(msg) [[deprecated(msg)]]
#endif
#endif
#ifndef LIBINT_DEPRECATED
#define LIBINT_DEPRECATED(msg) LIBINT_XPRAGMA( LIBINT_CONCAT(message, msg) )
#endif

#endif /* header guard */
6 changes: 6 additions & 0 deletions include/libint2/shgshell_ordering.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ enum SHGShellOrdering {
namespace libint2 {
inline int INT_SOLIDHARMINDEX(int l, int m) { return m + l; }
}
LIBINT_DEPRECATED("please use libint2::INT_SOLIDHARMINDEX instead")
inline int INT_SOLIDHARMINDEX(int l, int m) { return libint2::INT_SOLIDHARMINDEX(l, m); }

/* This sets up the above loop over cartesian exponents as follows
* int m;
Expand All @@ -72,6 +74,8 @@ inline int INT_SOLIDHARMINDEX(int l, int m) {
return 2 * std::abs(m) + (m > 0 ? -1 : 0);
}
}
LIBINT_DEPRECATED("please use libint2::INT_SOLIDHARMINDEX instead")
inline int INT_SOLIDHARMINDEX(int l, int m) { return libint2::INT_SOLIDHARMINDEX(l, m); }

/* This sets up the above loop over cartesian exponents as follows
* int m;
Expand All @@ -91,6 +95,8 @@ inline int INT_SOLIDHARMINDEX_MOLDEN(int l, int m) {
return 2 * std::abs(m) + (m > 0 ? -1 : 0);
}
}
LIBINT_DEPRECATED("please use libint2::INT_SOLIDHARMINDEX_MOLDEN instead")
inline int INT_SOLIDHARMINDEX_MOLDEN(int l, int m) { return libint2::INT_SOLIDHARMINDEX_MOLDEN(l, m); }

#define FOR_SOLIDHARM_MOLDEN(l, m) \
for ((m) = 0; (m) != (l) + 1; (m) = ((m) > 0 ? -(m) : 1 - (m))) {
Expand Down

0 comments on commit c5cc9aa

Please sign in to comment.