Skip to content

Commit

Permalink
Support fractional nuclear charges
Browse files Browse the repository at this point in the history
  • Loading branch information
sunqm committed Dec 1, 2019
1 parent bdf84cf commit 837ad98
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 4 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Version 3.0.19 (2019-11-30):
* support fractional nuclear charges
Version 3.0.18 (2019-07-02):
* Fix undefined varialbe in nabla-rinv integral
* Add integral < i | nabla-rinv | j >
Expand Down
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
libcint
=======

version 3.0.18
2019-07-02
version 3.0.19
2019-11-30


What is libcint
Expand Down
1 change: 1 addition & 0 deletions include/cint.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
#define ANG_MAX 12 // l = 0..11
#define POINT_NUC 1
#define GAUSSIAN_NUC 2
#define FRAC_CHARGE_NUC 3

#define bas(SLOT,I) bas[BAS_SLOTS * (I) + (SLOT)]
#define atm(SLOT,I) atm[ATM_SLOTS * (I) + (SLOT)]
Expand Down
9 changes: 8 additions & 1 deletion src/cint1e.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ FINT CINT1e_drv(double *out, FINT *dims, CINTEnvVars *envs,
FINT n;
FINT has_value = 0;
FINT *atm = envs->atm;
double *env = envs->env;
double charge_fac;

CINTdset0(nc*n_comp, gctr);
Expand All @@ -245,8 +246,14 @@ FINT CINT1e_drv(double *out, FINT *dims, CINTEnvVars *envs,
break;
default:
for (n = 0; n < envs->natm; n++) {
if (atm(CHARGE_OF,n) != 0) {
if (atm(NUC_MOD_OF,n) == FRAC_CHARGE_NUC) {
charge_fac = -env[atm(PTR_FRAC_CHARGE,n)];
} else if (atm(CHARGE_OF,n) != 0) {
charge_fac = -abs(atm(CHARGE_OF,n));
} else {
charge_fac = 0;
}
if (charge_fac != 0) {
has_value = CINT1e_nuc_loop(gctr, envs, charge_fac, n, cache)
|| has_value;
}
Expand Down
10 changes: 9 additions & 1 deletion src/cint3c1e.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,22 @@ FINT CINT3c1e_cart_drv(double *out, FINT *dims, CINTEnvVars *envs, CINTOpt *opt,
FINT buf_filled;
double fac;
double *buf;
double *env = envs->env;
MALLOC_INSTACK(gctr, double, nc*n_comp);
MALLOC_INSTACK(buf, double, nc*n_comp);
for (i = 0; i < nc*n_comp; i++) {
gctr[i] = 0;
}
for (n = 0; n < envs->natm; n++) {
if (atm(CHARGE_OF,n) != 0) {
if (atm(NUC_MOD_OF,n) == FRAC_CHARGE_NUC) {
fac = -env[atm(PTR_FRAC_CHARGE,n)];
} else if (atm(CHARGE_OF,n) != 0) {
fac = -abs(atm(CHARGE_OF,n));
} else {
fac = 0;
}

if (fac != 0) {
buf_filled = CINT3c1e_nuc_loop_nopt(buf, envs, fac, n, cache);
if (buf_filled) {
for (i = 0; i < nc*n_comp; i++) {
Expand Down
2 changes: 2 additions & 0 deletions src/cint_const.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#define PTR_COORD 1
#define NUC_MOD_OF 2
#define PTR_ZETA 3
#define PTR_FRAC_CHARGE 3
#define RESERVE_ATMLOT1 4
#define RESERVE_ATMLOT2 5
#define ATM_SLOTS 6
Expand Down Expand Up @@ -113,3 +114,4 @@

#define POINT_NUC 1
#define GAUSSIAN_NUC 2
#define FRAC_CHARGE_NUC 3

0 comments on commit 837ad98

Please sign in to comment.