Skip to content
Open
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
39 changes: 21 additions & 18 deletions applications/qmc/sse4/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,6 @@ class Model {
_lowering_matrix_elements.resize(lattice.max_site_type() + 1);

construct_vertices();

if (epsilon <= 0.0 && model.is_signed()) {
epsilon = *std::max_element(
_max_diag_me.begin(),
_max_diag_me.end()
);

std::cout
<< "Warning: Hamiltonian has a sign problem and EPSILON<=0.\n"
<< "Automatically setting EPSILON = "
<< epsilon
<< " (largest diagonal matrix element).\n";
}
}

std::vector<unsigned> const& nbstates() const
Expand Down Expand Up @@ -289,8 +276,7 @@ class Model {
unsigned nneighbors0 = lattice.nneighbors(sites[0]);
unsigned nneighbors1 = lattice.nneighbors(sites[1]);

// _max_diag_me[i] = std::numeric_limits<double>::min();
_max_diag_me[i] = std::numeric_limits<double>::lowest();
_max_diag_me[i] = std::numeric_limits<double>::lowest();

for (unsigned l = 0; l < nstates[i]; ++l) {
vertex_type vertex;
Expand Down Expand Up @@ -339,9 +325,26 @@ class Model {
if (epsilon == 0.0 && !have_diagonal)
throw std::runtime_error("Hamiltonian looks purely off-diagonal. "
"Parameter EPSILON has to be non zero for SSE to work.");

if (epsilon <= 0.0)
epsilon = 1e-6;
if (epsilon <= 0.0) {
if (model.is_signed()) {
// A tiny EPSILON can make the diagonal update effectively
// non-ergodic for signed models. Use the largest positive
// diagonal matrix element once those elements are known.
epsilon = 1e-6;
for (std::vector<double>::const_iterator it = _max_diag_me.begin();
it != _max_diag_me.end(); ++it)
if (*it > epsilon)
epsilon = *it;

std::cout
<< "Warning: Hamiltonian has a sign problem and EPSILON<=0.\n"
<< "Automatically setting EPSILON = " << epsilon
<< " (largest positive diagonal matrix element, with a "
"1e-6 minimum).\n";
} else {
epsilon = 1e-6;
}
}

std::set<unsigned>::const_iterator sti = site_types.begin();
for (; sti != site_types.end(); ++sti)
Expand Down
Loading