JohanSchott / impurityModel

Calculate many-body states of an impurity Anderson model and spectra (e.g. XPS, XAS, RIXS, NIXS)
MIT License
22 stars 2 forks source link

rewrite create and remove in the integer representation #47

Closed JohanSchott closed 11 months ago

JohanSchott commented 11 months ago

In master the integer that represents a product state is converted to a string. Then either remove or create an electron by operating on that string. Finally convert back to an integer.

In this MR instead stay in the integer representation. Remove and create electrons using bit-operators and the function .bit_count() . This is faster and more similar to a fast low-level language implementation. The nice thing with using Python is that the total number of spin-orbitals can be bigger than 64 without overflow.

.bit_count() requires at least python3.10.

pytype does not support python3.11. Since people might want to use that version remove pytype from requirements.in. pytype is not so important anyway.

closes: https://github.com/JohanSchott/impurityModel/issues/46

JohanSchott commented 11 months ago

Thanks for the review @kalvdans !