Skip to content

Commit 2feb45e

Browse files
committed
set exp thresholds on the fly
1 parent f3d7f76 commit 2feb45e

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

forte/api/sparse_exp_api.cc

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ namespace forte {
3939
void export_SparseExp(py::module& m) {
4040
py::class_<SparseExp>(m, "SparseExp", "A class to compute the exponential of a sparse operator")
4141
.def(py::init<int, double>(), "maxk"_a = 19, "screen_thresh"_a = 1.0e-12)
42+
.def("set_screen_thresh", &SparseExp::set_screen_thresh, "screen_thresh"_a)
43+
.def("set_maxk", &SparseExp::set_maxk, "maxk"_a)
4244
.def("apply_op",
4345
py::overload_cast<const SparseOperator&, const SparseState&, double>(
4446
&SparseExp::apply_op),

forte/api/sparse_fact_exp_api.cc

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ void export_SparseFactExp(py::module& m) {
4141
m, "SparseFactExp",
4242
"A class to compute the product exponential of a sparse operator using factorization")
4343
.def(py::init<double>(), "screen_thresh"_a = 1.0e-12)
44+
.def("set_screen_thresh", &SparseFactExp::set_screen_thresh, "screen_thresh"_a)
4445
.def("apply_op", &SparseFactExp::apply_op, "sop"_a, "state"_a, "inverse"_a = false, "reverse"_a = false)
4546
.def("apply_antiherm", &SparseFactExp::apply_antiherm, "sop"_a, "state"_a,
4647
"inverse"_a = false, "reverse"_a = false);

forte/sparse_ci/sparse_exp.h

+4
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ class SparseExp {
9797
SparseState apply_antiherm(const SparseOperatorList& sop, const SparseState& state,
9898
double scaling_factor = 1.0);
9999

100+
void set_screen_thresh(double screen_thresh) { screen_thresh_ = screen_thresh; }
101+
102+
void set_maxk(int maxk) { maxk_ = maxk; }
103+
100104
private:
101105
int maxk_ = 19;
102106
double screen_thresh_ = 1e-12;

forte/sparse_ci/sparse_fact_exp.h

+2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ class SparseFactExp {
9090
SparseState apply_antiherm(const SparseOperatorList& sop, const SparseState& state,
9191
bool inverse, bool reverse = false);
9292

93+
void set_screen_thresh(double screen_thresh) { screen_thresh_ = screen_thresh; }
94+
9395
private:
9496
double screen_thresh_;
9597
};

0 commit comments

Comments
 (0)