Skip to content

Commit

Permalink
saving memory in SO projector
Browse files Browse the repository at this point in the history
  • Loading branch information
fbischoff committed Apr 10, 2024
1 parent 55db4a0 commit a112c57
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
9 changes: 7 additions & 2 deletions src/madness/chem/projector.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,13 @@ namespace madness {
FunctionDefaults<2*NDIM>::set_thresh(tight_thresh);

Function<T, 2 * NDIM> result = copy(f);
result -= hartree_product(ket1_, h2);
result -= hartree_product(h1, ket2_);
auto left=append(ket1_,h1);
auto right=append(h2,ket2_);
auto tmp=hartree_product(left,right);
tmp.truncate();
result-=tmp;
// result -= hartree_product(ket1_, h2);
// result -= hartree_product(h1, ket2_);
result.truncate().reduce_rank();
result.set_thresh(FunctionDefaults<2 * NDIM>::get_thresh());
FunctionDefaults<2*NDIM>::set_thresh(thresh);
Expand Down
28 changes: 14 additions & 14 deletions src/madness/chem/test_ccpairfunction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@ int test_projector(World& world, std::shared_ptr<NuclearCorrelationFactor> ncf,
n1 = inner(SOp, vp3);
print("SO: n1, n2, n3", n1, n2, n3, fabs(n1 - n2));
double zero=fabs(n1-n2) + fabs(n1-n3) + fabs(n2-n3);
t1.checkpoint(zero < FunctionDefaults<3>::get_thresh(), "SO operator on "+s);
t1.checkpoint(zero, FunctionDefaults<3>::get_thresh(), "SO operator on "+s);
}
}
return t1.end();
Expand Down Expand Up @@ -1315,20 +1315,20 @@ int main(int argc, char **argv) {
auto data4=data<double,4>(world,ccparam);
auto data6=data<double,6>(world,ccparam);

isuccess+=test_constructor<double,2>(world, ncf, data2, ccparam);
isuccess+=test_load_store<double,2>(world,ncf,data2,ccparam);
isuccess+=test_operator_apply<double,2>(world, ncf, data2, ccparam);
isuccess+=test_transformations<double,2>(world, ncf, data2, ccparam);
isuccess+=test_multiply_with_f12<double,2>(world, ncf, data2, ccparam);
isuccess+=test_inner<double,2>(world, ncf, data2, ccparam);
isuccess+=test_multiply<double,2>(world, ncf, data2, ccparam);
isuccess+=test_swap_particles<double,2>(world, ncf, data2, ccparam);
isuccess+=test_scalar_multiplication<double,2>(world, ncf, data2, ccparam);
// isuccess+=test_constructor<double,2>(world, ncf, data2, ccparam);
// isuccess+=test_load_store<double,2>(world,ncf,data2,ccparam);
// isuccess+=test_operator_apply<double,2>(world, ncf, data2, ccparam);
// isuccess+=test_transformations<double,2>(world, ncf, data2, ccparam);
// isuccess+=test_multiply_with_f12<double,2>(world, ncf, data2, ccparam);
// isuccess+=test_inner<double,2>(world, ncf, data2, ccparam);
// isuccess+=test_multiply<double,2>(world, ncf, data2, ccparam);
// isuccess+=test_swap_particles<double,2>(world, ncf, data2, ccparam);
// isuccess+=test_scalar_multiplication<double,2>(world, ncf, data2, ccparam);
isuccess+=test_projector<double,2>(world, ncf, data2, ccparam);
isuccess+=test_partial_inner_3d<double,2>(world, ncf, data2, ccparam);
isuccess+=test_partial_inner_6d<double,2>(world, ncf, data2, ccparam);
isuccess+=test_apply<double,2>(world, ncf, data2, ccparam);
isuccess+=test_consolidate<double,2>(world, ncf, data2, ccparam);
// isuccess+=test_partial_inner_3d<double,2>(world, ncf, data2, ccparam);
// isuccess+=test_partial_inner_6d<double,2>(world, ncf, data2, ccparam);
// isuccess+=test_apply<double,2>(world, ncf, data2, ccparam);
// isuccess+=test_consolidate<double,2>(world, ncf, data2, ccparam);


// isuccess+=test_constructor<double,4>(world, ncf, data4, ccparam);
Expand Down

0 comments on commit a112c57

Please sign in to comment.