Skip to content

Commit

Permalink
Version 4.0.0
Browse files Browse the repository at this point in the history
Add polynomial fitting scheme for erfc integral rys roots
Bug fixes of erfc integral rys roots
  • Loading branch information
sunqm committed Sep 27, 2020
1 parent 01f7ff3 commit 7711c90
Show file tree
Hide file tree
Showing 17 changed files with 357,816 additions and 250 deletions.
21 changes: 15 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required (VERSION 2.6)
project (cint C)
set(cint_VERSION_MAJOR "3")
set(cint_VERSION_MINOR "1")
set(cint_VERSION_PATCH "1")
set(cint_VERSION_MAJOR "4")
set(cint_VERSION_MINOR "0")
set(cint_VERSION_PATCH "0")
set(cint_VERSION_TWEAK "0")
set(cint_VERSION "${cint_VERSION_MAJOR}.${cint_VERSION_MINOR}.${cint_VERSION_PATCH}")
set(cint_SOVERSION "${cint_VERSION_MAJOR}")
Expand Down Expand Up @@ -71,6 +71,7 @@ if(WITH_RANGE_COULOMB)
# defined in config.h
# add_definitions(-DWITH_RANGE_COULOMB)
message("Enabled WITH_RANGE_COULOMB")
set(cintSrc ${cintSrc} src/erfc_roots.c src/polyfits.c)
endif(WITH_RANGE_COULOMB)

if(WITH_COULOMB_ERF)
Expand Down Expand Up @@ -99,11 +100,16 @@ else()
message("P orbitals convention (px, py, pz)")
endif(PYPZPX)

if(DEFINED MIN_EXPCUTOFF)
if(MIN_EXPCUTOFF)
message("Minimal cutoff in exponent for integral screening ${MIN_EXPCUTOFF}")
add_definitions(-DMIN_EXPCUTOFF=${MIN_EXPCUTOFF})
endif()

if(KEEP_GOING)
message("Whether to trigger hard exit for numerical issues in Rys quadrature")
add_definitions(-DKEEP_GOING)
endif()

option(WITH_FORTRAN "Fortran interface" on)
if(WITH_FORTRAN)
add_definitions(-DWITH_FORTRAN)
Expand Down Expand Up @@ -143,12 +149,15 @@ if(QUADMATH_FOUND)
endif()
target_link_libraries(cint "-lm")

install(TARGETS cint DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" COMPONENT "lib")

set(CintHeaders
${PROJECT_SOURCE_DIR}/include/cint_funcs.h
${PROJECT_BINARY_DIR}/include/cint.h)

install(TARGETS cint DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" COMPONENT "lib")
install(FILES ${CintHeaders} DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR} COMPONENT "dev")


if(ENABLE_EXAMPLE)
enable_language(Fortran)
find_package(OpenMP)
Expand Down Expand Up @@ -202,7 +211,7 @@ set("CPACK_DEBIAN_DEV_PACKAGE_NAME" "${CPACK_DEBIAN_LIB_PACKAGE_NAME}-dev")
set(CPACK_DEBIAN_LIB_PACKAGE_DEPENDS "libopenblas0-pthread")
set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS "${CPACK_DEBIAN_LIB_PACKAGE_NAME},libopenblas-pthread-dev")
if(HAVE_QUADMATH)
set(CPACK_DEBIAN_LIB_PACKAGE_DEPENDS "${CPACK_DEBIAN_LIB_PACKAGE_DEPENDS},libquadmath0")
set(CPACK_DEBIAN_LIB_PACKAGE_DEPENDS "${CPACK_DEBIAN_LIB_PACKAGE_DEPENDS},libquadmath0")
endif()

set(CPACK_COMPONENTS_GROUPING "IGNORE")
Expand Down
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 4.0.0 (2020-09-23):
* API Change. PTR_LIGHT_SPEED is replaced with PTR_EXPCUTOFF.
Integral screening parameter can be passed through env[PTR_EXPCUTOFF]
* Add short-range integrals for range-separation
* Handle linear dependency in Rys polynomial
* Avoid calling exit function (issue #41)
Version 3.1.1 (2020-08-25):
* Fix bug in (py, pz, px) order
Version 3.1.0 (2020-08-25):
Expand Down
5 changes: 3 additions & 2 deletions README
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
libcint
=======

version 3.1.1
2020-08-25
version 4.0.0
2020-09-23


What is libcint
Expand All @@ -28,6 +28,7 @@ Features
- Gaunt interaction
- Breit interaction
- 2-center, 3-center and 4-center integrals
- Long-range part and short-range part of range-separated Coulomb
* Common lisp script to generate C code for new integrals.
* Thread safe.
* Uniform API for all kind of integrals.
Expand Down
5 changes: 4 additions & 1 deletion include/cint.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
#define FINT int
#endif

// This field is not required. Leave here as a placehold for backward compatibility
#define PTR_EXPCUTOFF 0
#define PTR_COMMON_ORIG 1
#define PTR_RINV_ORIG 4
#define PTR_RINV_ZETA 7
// omega parameter in range-separated coulomb operator erf(omega*r12)/r12
// omega parameter in range-separated coulomb operator
// LR interaction: erf(omega*r12)/r12 if omega > 0
// SR interaction: erfc(omega*r12)/r12 if omega < 0
#define PTR_RANGE_OMEGA 8
// Yukawa potential and slater-type geminal e^{-zeta r}
#define PTR_F12_ZETA 9
Expand Down
3 changes: 1 addition & 2 deletions src/cint_const.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
*/

// global parameters in env

// Overall cutoff for integral prescreening, value needs to be ~ln(threshold)
#define PTR_EXPCUTOFF 0
// R_C of (r-R_C) in dipole, GIAO operators
#define PTR_COMMON_ORIG 1
Expand All @@ -22,6 +20,7 @@
#define PTR_F12_ZETA 9
// Gaussian type geminal e^{-zeta r^2}
#define PTR_GTG_ZETA 10
// Overall cutoff for integral prescreening, value needs to be ~ln(threshold)
#define PTR_ENV_START 20

// slots of atm
Expand Down
48 changes: 48 additions & 0 deletions src/erfc_roots.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// This function is implemented based on libslater library
// https://github.com/nubakery/libslater

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "rys_roots.h"
#include "erfc_roots_xw.dat"

void _CINT_clenshaw_d1(double *rr, const double *x, double u, FINT nroot);
void _CINT_clenshaw_dc(double *rr, const double *x, double u, FINT nroot);
void _CINT_matmul_14_14(double *imc, double *im, FINT nroot);

void CINTerfc_rys_polyfits(FINT nroots, double x, double lower, double* u, double* w)
{
const double* dx = DATA_X + (nroots-1)*nroots/2 * 1960;
const double* dw = DATA_W + (nroots-1)*nroots/2 * 1960;
double ll, t, tt;
FINT k, it;
FINT offset;
double im [14*nroots];
double imc[14*nroots];

t = x;
if (t > 19682.99) t = 19682.99;
if (t > 1.0) {
tt = log(t) * 0.9102392266268373 + 1.0; // log(3)+1
} else {
tt = sqrt(t);
}

it = (FINT)tt;
tt = tt - it;
tt = 2.0 * tt - 1.0;
ll = 2.0 * lower - 1.0;

offset = nroots * 196 * it;
_CINT_clenshaw_dc(im, dx+offset, ll, nroots);
_CINT_matmul_14_14(imc, im, nroots);
_CINT_clenshaw_d1(u, imc, tt, nroots);
_CINT_clenshaw_dc(im, dw+offset, ll, nroots);
_CINT_matmul_14_14(imc, im, nroots);
_CINT_clenshaw_d1(w, imc, tt, nroots);

for (k = 0; k < nroots; k++) {
u[k] = u[k] / (1 - u[k]);
}
}
Loading

0 comments on commit 7711c90

Please sign in to comment.