Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for segv when no integral primitive screening is used. #10

Merged
merged 6 commits into from
Jul 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions generator/ostei/OSTEIDeriv1_Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ void OSTEIDeriv1_Writer::Write_Full_(void) const
os_ << indent3 << "for(i = istart; i < iend; ++i)\n";
os_ << indent3 << "{\n";
os_ << indent4 << "SIMINT_DBLTYPE bra_screen_max; // only used if check_screen\n\n";
os_ << indent4 << "bra_screen_max = SIMINT_DBLSET1(0.);\n";

os_ << indent4 << "if(check_screen)\n";
os_ << indent4 << "{\n";
Expand Down
8 changes: 5 additions & 3 deletions generator/ostei/OSTEI_Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ void OSTEI_Writer::Write_Full_(void) const
os_ << indent3 << "for(i = istart; i < iend; ++i)\n";
os_ << indent3 << "{\n";
os_ << indent4 << "SIMINT_DBLTYPE bra_screen_max; // only used if check_screen\n\n";
os_ << indent4 << "bra_screen_max = SIMINT_DBLSET1(0.);\n";

os_ << indent4 << "if(check_screen)\n";
os_ << indent4 << "{\n";
Expand Down Expand Up @@ -547,11 +548,12 @@ void OSTEI_Writer::Write_Full_(void) const
WriteShellOffsets();


os_ << indent5 << "// Do we have to compute this vector (or has it been screened out)?\n";
os_ << indent5 << "// (not_screened != 0 means we have to do this vector)\n";
os_ << indent5 << "SIMINT_DBLTYPE prim_screen_res = SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j));\n";
os_ << indent5 << "SIMINT_DBLTYPE prim_screen_res = SIMINT_DBLSET1(0.);\n";
os_ << indent5 << "if(check_screen)\n";
os_ << indent5 << "{\n";
os_ << indent6 << "// Do we have to compute this vector (or has it been screened out)?\n";
os_ << indent6 << "// (not_screened != 0 means we have to do this vector)\n";
os_ << indent6 << "prim_screen_res = SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j));\n";
os_ << indent6 << "const double vmax = vector_max(prim_screen_res);\n";
os_ << indent6 << "if(vmax < screen_tol)\n";
os_ << indent6 << "{\n";
Expand Down
9 changes: 8 additions & 1 deletion skel/ostei_s_s_s_s.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ int ostei_s_s_s_s(struct simint_multi_shellpair const P,
for(i = istart; i < iend; ++i)
{
SIMINT_DBLTYPE bra_screen_max; // only used if check_screen
bra_screen_max = SIMINT_DBLSET1(0.);

if(check_screen)
{
Expand Down Expand Up @@ -196,9 +197,15 @@ int ostei_s_s_s_s(struct simint_multi_shellpair const P,

// Do we have to compute this vector (or has it been screened out)?
// (not_screened != 0 means we have to do this vector)
SIMINT_DBLTYPE prim_screen_res = SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j));
SIMINT_DBLTYPE prim_screen_res = SIMINT_DBLSET1(0.);
if(check_screen)
{
if(jend -j < SIMINT_SIMD_LEN ){
//initialize remainders when vlen < SIMD_LEN
for(n = jend; n < j+SIMINT_SIMD_LEN; n++)
Q.screen[n] = 0.;
}
prim_screen_res = SIMINT_MUL(bra_screen_max, SIMINT_DBLLOAD(Q.screen, j));
const double vmax = vector_max(prim_screen_res);
if(vmax < screen_tol)
{
Expand Down
3 changes: 1 addition & 2 deletions skel/simint/shell/shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ void simint_fill_multi_shellpair2(int npair, struct simint_shell const * AB,
P->nshell12 = npair;
P->nshell12_clip = npair; // by default, it's the same
P->nprim = 0;
P->screen_max = 1.e99;

// zero out
// This is not really needed, and can be expensive in
Expand All @@ -454,8 +455,6 @@ void simint_fill_multi_shellpair2(int npair, struct simint_shell const * AB,
double m = simint_primscreen(A, B, P->screen + idx, screen_method);
P->screen_max = (m > P->screen_max ? m : P->screen_max);
}
else
P->screen_max = 0.0;

// are these the same shells?
const int same_shell = compare_shell(A, B);
Expand Down