SSCHAcode / CellConstructor

A python utilities to handle with atomic structures and interfacing with common formats (xyz and quantum-espresso).
GNU General Public License v3.0
16 stars 19 forks source link

Multiprocessing on spectral function errors while reordening the files #79

Open mesonepigreco opened 1 year ago

mesonepigreco commented 1 year ago

Hi Diego @diegomartinez2 , While trying to run the dynamical spectral function with multiprocessing I got the following error:

Master branch, revision: v1.3-112-g9e126fc

The code call that failed:

CC.Spectral.get_full_dynamic_correction_along_path_multiprocessing(dyn=dyn, 
                                           tensor3=tensor3, 
                                           k_grid=NEW_GRID,  
                                           e1=1450, de=0.5, e0=0,
                                           sm1=5, sm0=5,nsm=1, sm1_id=0.1, sm0_id=0.1,
                                           T=TEMPERATURE,
                                           q_path=q_path,                                           
                                           notransl = True,
                                           filename_sp='full_spectral_func')
 Results printed in full_spectral_func_[smear].dat

Traceback (most recent call last):
  File "/home/monacell/MEGA/Research/Simulations/Perovskites/CaSiO3/spectral_function/spectral_8.py", line 41, in <module>
    CC.Spectral.get_full_dynamic_correction_along_path_multiprocessing(dyn=dyn, 
  File "/home/monacell/anaconda3/lib/python3.9/site-packages/cellconstructor/Spectral.py", line 1340, in get_full_dynamic_correction_along_path_multiprocessing
    output_file_sort_function(filename_sp, smear_id_cm, smear_cm, nsm)
  File "/home/monacell/anaconda3/lib/python3.9/site-packages/cellconstructor/Spectral.py", line 1171, in output_file_sort_function
    f = open(filename_data, 'r')
FileNotFoundError: [Errno 2] No such file or directory: 'full_spectral_func_0.10_5.0.dat'

The name of the file generated is:

full_spectral_func_5.0.dat

I believe it should be a trivial mistake of naming files in the reordering process, can you fix it?

mesonepigreco commented 1 year ago

Also there is a bug in the calculation with multiprocessing: some of the q points are printed overlapped, and after the reordering there is a lower number of q points in the path (they are jumped at the beginning).

diegomartinez2 commented 1 year ago

Yes, the output file naming was easy to solve.

diegomartinez2 commented 1 year ago

For the reordering problem maybe will be better to use "numpy.lexsort" instead of "argsort".