johanschott / impuritymodel Goto Github PK
View Code? Open in Web Editor NEWCalculate many-body states of an impurity Anderson model and spectra (e.g. XPS, XAS, RIXS, NIXS)
License: MIT License
Calculate many-body states of an impurity Anderson model and spectra (e.g. XPS, XAS, RIXS, NIXS)
License: MIT License
To make things more readable, perhaps this could help?
At the moment use bitarray
from the bitarray
package to represent a product state.
Store Hamiltonian matrix elements in sparse format in a dict.
The product states are dict-keys so also need an immutable representation of a product state.
Get this by using bitarray
's .tobytes()
method.
Instead of using bitarray
one could use one Python built-in integer to represent a product state.
It is immutable so no need to convert between two representations during calculations.
It should be roughly as quick to change a state (removing or adding an electron) using the integer representation as using bitarray
, since bit-shifts are used modify the integer representation (since #47).
If use the integer representation in the calculations could remove bitarray
as a representation of a product state.
uint
in create.py
and remove.py
convert the product state from the integer representation to a string representation.
This is not needed. One can stay in the integer representation by using bit-operations: <<
, >>
, &
, |
, ^
and python3.10 method https://docs.python.org/3.10/library/stdtypes.html#int.bit_count
There is a small bug in get_spectrum and get_spectrum_using_CF. The magnetic field hx is overwritten by hy in the following lines:
hHfieldOperator[(((l, 1, m), 'c'), ((l, 0, m), 'a'))] = hx*1/2.
hHfieldOperator[(((l, 0, m), 'c'), ((l, 1, m), 'a'))] = hx*1/2.
hHfieldOperator[(((l, 1, m), 'c'), ((l, 0, m), 'a'))] = -hy*1/2.*1j
hHfieldOperator[(((l, 0, m), 'c'), ((l, 1, m), 'a'))] = hy*1/2.*1j
/Patrik
The Lanczos algorithm may suffer from numerical instability, see discussion in e.g. https://en.wikipedia.org/wiki/Lanczos_algorithm.
The generous unit-test tolerances indicate numerical round-off errors are indeed present (compared the same code on Mac OS X and Ubuntu).
Until now, the errors I have seen have been smaller than the physics of interest.
But it is good to be aware of this numerical instability issue, in particular if very subtle features are of interest.
In https://en.wikipedia.org/wiki/Lanczos_algorithm, a few ideas and references are provided of how to improve the numerical stability of the Lanczos algorithm, that might be relevant for this repository.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.