-
Notifications
You must be signed in to change notification settings - Fork 12
Addition of new density-density operators mentioned in the discussion… #53
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
base: main
Are you sure you want to change the base?
Conversation
Dear Leo, thank you very much for the pull request. Currently, according to the automated tests, the MPI code is not compiling: https://github.com/awietek/xdiag/actions/runs/14702408841/job/41256972462?pr=53 Please have a look at it and try to fix it. I will then take a closer look at the new code. |
Thank you very much, the tests now work. I would have the following two suggestions before proceeding:
Thanks for all your efforts |
Dear Alexander, Thank you for your input. Indeed I misunderstood what you told me, I now removed all the composed operators, leaving only NupNdn, NupNup and NdnNdn. I also added the tests in the file |
Thanks, now there is a test failing unfortunately with the MPI library. Could you have a look into what the problem is there? |
Thanks, so superficially all looks good. I will have to take a closer look now which can take one or two days, then I'll come back to you. I guess you can already use the version for project. |
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.
Thanks, this is almost ready to be merged. I have two suggestions:
- The identity operator implementation should be changed, see annotations
- The NdnNup operator should be added in addition to the NupNdn operator, by compilation.
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.
This function should be moved to apply_identity.hpp. Also, this is specific to the electron bases. I would implement this more generically, something like this:
void apply_identity(Coupling const &cpl, const coeff_t *vec_in, coeff_t *vec_out, int64_t size) {
using bit_t = typename basis_t::bit_t;
coeff_t s = cpl.scalar().as<coeff_t>();
for (int64_t idx=0; idx<size; ++idx) {
vec_out[idx] += s * vec_in[idx];
}
}
which will work for the distributed case, you only have to give the size as an argument.
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.
Looks good
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.
looks good
@@ -11,6 +11,7 @@ | |||
#include <xdiag/basis/electron_distributed/apply/apply_raise_lower.hpp> | |||
#include <xdiag/basis/electron_distributed/apply/apply_szsz.hpp> | |||
#include <xdiag/basis/electron_distributed/apply/apply_u.hpp> | |||
#include <xdiag/basis/apply_identity_distributed.hpp> |
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.
please follow the suggestions iin apply_identity_distributed.hpp. Move to apply_identity.hpp
electron_distributed::apply_ndn_ndn<coeff_t>( | ||
cpl, op, basis_in, vec_in.memptr(), vec_out.memptr()); | ||
} else if (type == "Id") { | ||
apply_identity_distributed<coeff_t>( |
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.
Change call as suggested
|
||
inline const std::vector<std::string> real_types = { | ||
"Id", "SdotS", "Exchange", "SzSz", "Sz", "S+", | ||
"S-", "Hop", "Hopup", "Hopdn", "Cdagup", "Cup", | ||
"Cdagdn", "Cdn", "HubbardU", "Ntot", "Nup", "Ndn", | ||
"Nupdn", "NtotNtot", "NupdnNupdn", "tJSzSz", "tJSdotS"}; | ||
"Nupdn", "NtotNtot", "NupdnNupdn", "tJSzSz", "tJSdotS", | ||
"NupNdn", "NupNup", "NdnNdn"}; |
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.
Add NdnNup here
{"NupNdn", 2}, | ||
{"NupNup", 2}, | ||
{"NdnNdn", 2}, | ||
}; |
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.
Add NdnNup here
@@ -25,7 +25,8 @@ void check_valid(Op const &op) try { | |||
} else if ((type == "Hop") || (type == "Hopup") || (type == "Hopdn") || | |||
(type == "SzSz") || (type == "SdotS") || (type == "Exchange") || | |||
(type == "NtotNtot") || (type == "NupdnNupdn") || | |||
(type == "tJSzSz") || (type == "tJSdotS")) { | |||
(type == "tJSzSz") || (type == "tJSdotS") || (type == "NupNdn") || | |||
(type == "NupNup") || (type == "NdnNdn")) { |
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.
Add NdnNup here
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.
We should take care of the case that an NdnNup operator gets properly ordered to NupNdn to compare it.
@@ -19,6 +19,7 @@ Generic operators in XDiag are represented as [OpSum](opsum.md) objects made up | |||
| `Nup` | A number operator for an $\uparrow$ spin $n_{i\uparrow}$ | 1 | tJ, Electron, tJDistributed, ElectronDistributed | | |||
| `Ndn` | A number operator for an $\downarrow$ spin $n_{i\downarrow}$ | 1 | tJ, Electron, tJDistributed, ElectronDistributed | | |||
| `Ntot` | A number operator $n_i = n_{i\uparrow} + n_{i\downarrow}$ | 1 | tJ, Electron, tJDistributed, ElectronDistributed | | |||
| `Nhtot` | A number operator for holes $n^H_i = 2 - n_{i\uparrow} - n_{i\downarrow}$ | 1 | tJ, Electron, tJDistributed, ElectronDistributed | |
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.
Remove Nhtot here
Addition of NupNdn, NupNup and NdnNdn operators. Addition of the equivalent hole density-density operators handled at the compile step following the discussion #50.