ttadano / alamode

Ab initio simulator for thermal transport and lattice anharmonicity
http://sourceforge.net/projects/alamode
MIT License
137 stars 54 forks source link

segmentation fault with LAMMPS #108

Closed marcelclaro closed 1 year ago

marcelclaro commented 1 year ago

Hi, First, thank you for make this code available, it is awesome! I had no problems at all to compile, and it works fine with the Si example. However when I tried to use with LAMMPS (last version) I got segmentation fault. I have tried with my Al2O3 system at first, then with the Si_LAMMPS example. I tried on my intel (32GB RAM) and AMD(64GB RAM) PC, both with Ubuntu 22.04 LTS OS and the error is reproducible in all conditions. Since it is happening even with the example case without any modification I guess it is a general bug.

Best Regards, Marcel Claro

ps.: LAMMPS build command: cmake ../cmake -DPKG_MANYBODY=yes -DPKG_PHONON=yes -DPKG_OPT=yes -DPKG_KSPACE=yes -DPKG_GPU=no -DBUILD_SHARED_LIBS=yes -C ../cmake/presets/gcc.cmake

marcelclaro commented 1 year ago

Hi, here is the result of the gdb debug:

Starting program: /home/marcel/alamode/alm/alm si_alm1.in >> alm.log

[Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Temporary breakpoint 2, main (argc=2, argv=0x7fffffffdf18) at /home/marcel/alamode/alm/main.cpp:18 18 { (gdb) continue Continuing. [New Thread 0x7ffff6cb8640 (LWP 37484)] [New Thread 0x7ffff64b7640 (LWP 37485)] [New Thread 0x7ffff5cb6640 (LWP 37486)]

Thread 1 "alm" received signal SIGSEGV, Segmentation fault. ALM_NS::Optimize::get_number_of_rows_sensing_matrix (this=0x555555680a30) at /home/marcel/alamode/alm/optimize.cpp:1729 1729 return u_train.size() * u_train[0].size();

ttadano commented 1 year ago

Hi,

Did you install alamode using conda as suggested in the documentation? Or did you build using other compilers?

marcelclaro commented 1 year ago

Hi, Thanks for the answer I tried both ways, with conda following the documentation ,and with gcc...

It seems that the problem is the initialization of u_train variable: (gdb) print u_train $1 = std::vector of length 0, capacity 0

ttadano commented 1 year ago

Indeed, this was a bug in the LAMMPS parser, not in ALM. I've fixed it in the latest commit 8c5c187. Please git pull the changes and use it for LAMMPS.

Sorry for the inconvenience.

marcelclaro commented 1 year ago

It is now working fine. Thank you very much!