-
Notifications
You must be signed in to change notification settings - Fork 0
Compute_spectral_function_and_density_of_states
The script spectral/compute_spectral_function.py can be used to compute either a spectral function of a density of states.
I strongly recommend to use it from a directory which is not the one of the and-python repository (e.g. obtained using git).
Suppose you have created your local git repository by cloning the main one:
git clone https://github.com/delande/and-python.git
or created a local copy by any method you like, in the directory ~/git/and-python. Then, you copy the parameter file in a local directory:
cd your_local_directory
cp ~/git/and-python/spectral/params_spectral_function_1d.dat .
(or params_density_of_states_1d.dat, params_density_of_states_2d.dat depending on what you want to run).
Then, the script can be simply ran using the command:
python ~/git/and-python/spectral/compute_spectral_function.py params_spectral_function_1d.dat
or, if you want to use MPI:
mpiexec -n NN python ~/git/and-python/spectral/compute_spectral_function.py params_spectral_function_1d.dat
where NN is the number of cores for the parallel computation.
Three examples of (working?) parameter files are given.
If you have the message:
Warning, no chebyshev C library found, this uses the slow Python version!
this means that you do not use the fast C versions for some computations. This will of course slow down the calculation. If you are on a LKB machine, you should probably try to load the compiler module using:
module load compiler
and rerun the script.
The script runs in 1 second on my computer (3 times faster than the old version). It computes the spectral function for a 1d system with delta-correlated Gaussian potential (strength 0.2) for k=\pi/20. The interesting section of the parameter file is:
dimension = 1 # System size in natural units size_1 = 1000. # Spatial discretization delta_1 = 0.5 [Disorder] # Various disorder types can be used type = anderson_gaussian # Disorder strength V0 = 0.2 [Wavefunction] # Either plane_wave or gaussian_wave_packet initial_state = plane_wave k_0_over_2_pi_1 = 0.1 [Spectral] resolution = 0.01 e_min= -1. e_max= 10. n_kpm = 1000
The script prints (your output will be slightly different):
Python script runs on machine : meteor Name of python script: /home/delande/git/and-python/spectral_function/compute_spectral_function.py Name of parameter file: /home/delande/git/and-python/spectral_function/params_spectral_function_1d.dat Python script started on: Thu Jan 26 17:46:57 2023 Total number of disorder realizations: 64 Number of processes: 1 Python script ended on: Thu Jan 26 17:46:58 2023 Wallclock time 0.960 seconds KPM time = 0.604 KPM nops = 1.9840e+09 SPECTRUM time = 0.349 SPECTRUM nops = 4.9325e+08 Dummy time = 0.006 Total number of ops = 2.4772e+09 Total CPU time = 0.960
It creates 1 file:
- spectral_function.dat, containing the spectral function.
spectral_function.dat should contain a peak centered around energy 0.19, maximum around 5.3 and full width at half maximum around 0.12.
The input file is essentially identical to params_spectral_function_1d.dat, except for the initial state, which is now a random delta-correlated one:
[Wavefunction] initial_state = random
The script also runs in about 0.7 second (4 times faster than the old version) and produces 1 file:
- density_of_states.dat, containing the density of states.
density_of_states.dat should contain a (noisy) curve with a the characteristic U-shape of a 1d systems (something like 1/\sqrt{1-x^2} in the absence of disorder). The low-energy peak is slightly below 0, the high-energy one slightly above 8=2/delta_1^2.
As an exercise, you should try as initial state in the parameter file:
[Wavefunction] initial_state = point
which starts from a wavefunction localized on a single site rather than a delta-correlated random one. The resulting density of states is more noisy, but should converge to the same limit when n_config tends to infinity.
This is a similar example in dimension 2, which runs in less than 1 second (10 times faster than the previous version). It produces again density_of_states.dat.
The shape of the density of states is very different from the 1d case. It extends slightly below and above the zero-disorder interval [0,2/delta_1^2+2/delta_2^2=16], is essentially flat at low energy, with the remnant of the Van Hove singularity at energy 8.
This is a similar example in dimension 3, with a low energy resolution. It showa the remnants of the Van Hove singluarities at energies 8 and 16.
This is a more realistic example, for a Konstanz type of disorder (speckle on-site distribution with spatial Gaussian correlations) with V0=0.5 and k0=0.
It takes longer to run (more than a minute on my computer):
Python script runs on machine : meteor Name of python script: /home/delande/git/and-python/spectral_function/compute_spectral_function.py Name of parameter file: /home/delande/git/and-python/spectral_function/params_spectral_function_3d.dat Python script started on: Mon Feb 20 18:30:19 2023 Total number of disorder realizations: 640 Number of processes: 1 Python script ended on: Mon Feb 20 18:31:26 2023 Wallclock time 66.325 seconds KPM time = 48.020 KPM nops = 5.6250e+11 SPECTRUM time = 17.918 SPECTRUM nops = 1.4001e+11 Dummy time = 0.356 Total number of ops = 7.0251e+11 Total CPU time = 66.325
The spectral function in spectral_function.dat is centered around energy 0.31, with maximum around 15, and width around 0.04. Note the non-Lorentzian shape with a tail towards large energies (the center of mass of the spectral function is at energy E=V0=0.5).
Here, I chose the order of the Chebyshev expansion n_kpm=2500, while the default value is 6250, saving a significant amount of CPU time.