-
Notifications
You must be signed in to change notification settings - Fork 0
Run_a_simulation
Running a simulation requires two things:
- A Python script which calls the proper sequence of routines from the module Anderson.
- A file containing the parameters of the simulation. see Parameter file for a detailed discussion of such a file . The simplest method for running a script is to type from a command line (requires of course an environment with a python3 interprer and proper access to the needed modules):
python name_of_script name_of_parameter_file
You may of course use any environment you like to run the script such as Spyder, IPython, Jupyter or Jupyterlab notebooks, etc.
The results are printed in one or several files, typically named something_depending_on_the script.dat. Presently, everything is printed in ASCII human readable files. In the future, binary formats, such as HDF5 files, will be available.
The script also prints some useful information in the standard output, typically something like (here given for the script spectral_function/compute_spectral_function.py and parameter file parameter_1d.dat in the same subdirectory):
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.dat Python script started on: Wed Apr 6 19:15:30 2022 Total number of disorder realizations: 64 Number of processes: 1 Python script ended on: Wed Apr 6 19:15:32 2022 Wallclock time 2.261 seconds CHE time = 1.863 Max nonlinear phase = 0.000 Max order = 12 Expect time = 0.124 Dummy time = 0.108 Number of ops = 1.4969e+10 Total_CPU time = 2.261
It shows which script with which parameter file was on which machine and when.
The other information is for checking that everything went well.
Most computed quantities (e.g. density of states, g1 function, momementum space distribution...) have to be averaged over many independent disorder realizations (64 in the example above). The calculations for different disorder realizations are gathered at the end of the run, to produce average values (and optionally, standard deviations), but the core of the calculations are essentially independent. They can thus be ran in parallel. This is possible using Message Passing Interface (MPI). The details are discussed in the MPI page. For the not-expert user, it is ran with the command (provided a MPI implementation is available the computer):
mpiexec -n NN python name_of_script name_of_parameter_file
where NN is the number of jobs ran in parallel. Typically, it should be less than or equal to the number of cores of the machine.
Provided the number of disorder realizations is an integer multiple of NN, the results should be the same for the MPI and non-MPI calculations. The speed-up is at maximum a factor NN, but often significantly less, because the processes fight for access to the main memory. On a 8 core machines, I typically run with NN=4 and a speed-up of the order of 3.
The following list of scripts are just examples of what can be ran, mostly following the list of physical quantities of interest in Physics. Note that much more examples should be given, exploring the various capacities of the project. This is left for a near future.
- Compute the inverse participation ratio of some eingestates using exact diagonalization. The script is in the subdirectory diag/compute_IPR.py. See Compute IPR for details on the parameters.
- Compute the localization length using the transfer matrix method. The script is in the subdirectory lyapounov/compute_lyaponov_vs_energy.py. See Compute localization length for details on the parameters.
- Compute the propagation of some initial state. The script is in the subdirectory prop/compute_prop.py. See Compute temporal propagation for details on the parameters.
- Compute the spectral function or the density of states. The script is in the subdirectory spectral_function/compute_spectral_function.py. See Compute spectral function and density of states for details on the parameters.
In any case, the pages Parameter file, List of sections and List of parameters contain the documentation on how to set various parameters.