-
Notifications
You must be signed in to change notification settings - Fork 16
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
Make use of libcommute and update C++ API accordingly #44
Conversation
This header features a new namespace, Pomerol::Operators imports a few libcommute classes and functions.
…ion` Drop the bit field based type FockState in favor of unsigned integers. All needed bit fiddling will be done by libcommute.
`HamiltonianPart` is now templated on the matrix storage type (real or complex elements), while `Hamiltonian` employs type erasure and stores parts as a vector of `std::shared_ptr<void>`. The Hamiltonian expression is not stored in `Hamiltonian`. Instead, it is only passed to `prepare()` to construct a matrix representation. Since the matrix representation is now generated by means of libcommute, a new header `LibcommuteEigen.h` has been added to teach libcommute how to use Eigen vectors and blocks as StateVector's.
Now type type erasure is used only to store the actual Eigen matrix and a reference to the `libcommute::loperator` object.
…st_libcommute `GF4siteTest_libcommute` fully compiles and gives correct results now.
This is the first version of Clang to offer a reasonable resolution of the C++ Core Language Defect Report 253. Earlier versions of Clang complain about the 'hc' object from libcommute. http://open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#253
94096b1
to
83b3efe
Compare
Its functionality is now part of libcommute.
`LatticePresets` is a namespace with a bunch of free functions now.
… revealed bugs Also remove outdated tests `NOperatorTest` and `SzOperatorTest`.
Some of the unit tests have been removed as they would not make sense anymore.
Contents of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read through it. No objections from me. Thanks for reworking it all!
@@ -50,7 +51,7 @@ class GreensFunction : public Thermal, public ComputableObject { | |||
/** A list of pointers to parts (every part corresponds to a part of the annihilation operator | |||
* and a part of the creation operator). | |||
*/ | |||
std::list<GreensFunctionPart*> parts; | |||
std::vector<GreensFunctionPart> parts; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed sometimes we use a shared pointer and some time instances. What's the rationale?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of classes were storing parts in vectors of smart pointers because I forgot to change them to plain instances.
Those are updated in the latest commit.
There is still a lot of stuff to be done before this PR can be merged. I decided to open and update it incrementally so that we can discuss the development progress step by step.
Most of the library has already been ported, except for the classes related to the 2-particle GF and susceptibility. I have temporarily commented out compilation of all unit tests and added a new one. It is an adapted copy of
GF4siteTest
, and I suggest we use it to discuss the updated API.Some highlights of the proposed changes
libcommute >= 0.6.2
as an external dependency.Operator
class and introduce a namespacePomerol::Operators
, which simply imports some types and functions from libcommute.IndexClassification
is templated on the types of the indices now. This change lifts the restriction of fermionic degrees of freedom being always addressed by the(site,orbital,spin)
triplets.Lattice
andIndexHamiltonian
have no real use now and should go.LatticePresets
should become a namespace with a bunch of free functions returninglibcommute::expression
objects.Symmetrizer
has been replaced withHilbertSpace
, which is responsible for automatic partitioning of the Hilbert space into sectors. No explicit integrals of motion are required by the new algorithm.StatesClassification
as they are not needed anymore (see the previous point). We may decide to put it back later on and just for informational purposes (better screen output).FieldOperator[Part]
->MonomialOperator[Part]
and allow for a wider class of operators: Any product ofc
andc_dag
with a prefactor, i.e. a monomial as it still generates only one-to-one connections between sectors.HamiltonianPart
andMonomialOperatorPart
use type erasure to switch between real and complex stored matrices at runtime.There is still a huge mess in the details of the reworked implementation and I shall start cleaning it out once we have agreed on the new API.