diff --git a/exercises/ex04_solution/heised_cpp/Makefile b/exercises/ex04_solution/heised_cpp/Makefile index f4e1f567a3d138f0a93a0ba245f0c25fa6240fcb..1a0a8d339a1961bea145983fd8e8a71d690d896d 100644 --- a/exercises/ex04_solution/heised_cpp/Makefile +++ b/exercises/ex04_solution/heised_cpp/Makefile @@ -1,4 +1,6 @@ -ALPSDIR = /opt/alps/include/ +# pick your directory +#ALPSDIR = /opt/alps/include/ +ALPSDIR = alps-2.2.b4-src-with-boost CXX = g++ CPPFLAGS = -std=c++14 -I${ALPSDIR} -I${ALPSDIR}/boost -I${ALPSDIR}/alps/src diff --git a/exercises/ex04_solution/heised_cpp/heised.cpp b/exercises/ex04_solution/heised_cpp/heised.cpp index deaf68726ac0fdd03b4b1e60ed50aff75628d14c..cdea1fe1fd9e77812356729e0fff0c0d8bbaffd4 100644 --- a/exercises/ex04_solution/heised_cpp/heised.cpp +++ b/exercises/ex04_solution/heised_cpp/heised.cpp @@ -36,12 +36,12 @@ private: }; SpinHalfBasis::SpinHalfBasis(unsigned l, unsigned nups) // l: chain length; nups: spins-ups (fixes the symmetry sector). -: index_(State(1<<l), NOT_FOUND) // initialize index_ to have 2^l entries each of which is the NOT_FOUND flag. +: index_(State(1<<l), NOT_FOUND) // initialize index_ to have 2^l entries each of which is the NOT_FOUND flag. { // find all states with [nups] up spins for( State s = 0; s < index_.size(); ++s ) { - if( alps::popcnt(s) == nups ) // if the state is in this sector keep it. + if( alps::popcnt(s) == nups ) // if the state is in this sector keep it. { index_[s] = states_.size(); states_.push_back(s); @@ -144,7 +144,7 @@ diagonalize( const HeisenbergHamiltonian& h, unsigned nvals=1, unsigned maxiter= Vectorspace vspace(h.dimension()); Lanczos solver(h,vspace); Iteration iter(maxiter,nvals); - + solver.calculate_eigenvalues(iter,Generator()); // call the solver for the eigenvalues. if( iter.iterations() == maxiter ) @@ -197,8 +197,8 @@ void write_dat_header(std::ostream& datfile,unsigned nstates) int main() { - int lmin = 2; - int lmax = 20; + int lmin = 5; + int lmax = 5; double j = 1.; unsigned nstates = 2; // How many of the lowest eigenvalues (energies) do you want to calculate? ( nstates = 1 ... just the ground state)