openmopac / mopac

Molecular Orbital PACkage
http://openmopac.net
GNU Lesser General Public License v3.0
115 stars 31 forks source link

Segfault on INDO calculation #81

Closed afandiadib closed 1 year ago

afandiadib commented 2 years ago

Describe the bug

forrtl: severe (174): SIGSEGV, segmentation fault occurred Image PC Routine Line Source
libmopac.so.1 00007FD16C637B69 forsignalhandl Unknown Unknown libc.so.6 00007FD16B1EF520 Unknown Unknown Unknown libmopac.so.1 00007FD16B6B4C40 scfmat Unknown Unknown libmopac.so.1 00007FD16B749A13 iter Unknown Unknown libmopac.so.1 00007FD16B6936F9 compfg Unknown Unknown libmopac.so.1 00007FD16B668F8D runmopac Unknown Unknown mopac 0000000000401320 Unknown Unknown Unknown mopac 00000000004012B2 Unknown Unknown Unknown libc.so.6 00007FD16B1D6D90 Unknown Unknown Unknown libc.so.6 00007FD16B1D6E40 libc_start_main Unknown Unknown mopac 00000000004011BE Unknown Unknown Unknown

To Reproduce I'm running INDO calculation on system with 300 - 500 atoms. I have successfully run on below ~350 atoms. Above that, I started to see the segfault immediately after execute the mopac operation.

MOPAC executable

Operating system

Additional context Add any other context about the problem here. (e.g. Linux distribution if that might be relevant)

godotalgorithm commented 2 years ago

As a preliminary note, I have reproduced this INDO problem with random large molecules that I have lying around, so it does appear to be generic and only dependent on the size of the molecule.

godotalgorithm commented 2 years ago

I am now having a hard time reproducing this problem in a debug setting that would allow me to fix it. I reproduce your crash with the pre-built executable on Mac, but I don't get a crash with the pre-built executable on Linux. I don't get crashes on either OS with debug flags. Could you provide some examples, so that I can check if they crash on my Linux test environment?

While it isn't impossible to fix this without debug flags, it is much less efficient. More information may help me narrow this down faster.

afandiadib commented 2 years ago

Thanks for looking into this. These are some of the samples: samples.zip. I am able to run on a somewhat small molecule (AAA.mop). I got segfault for the rest of the samples.

godotalgorithm commented 1 year ago

Unfortunately, I lost track of this issue last year (got sick & took a long vacation right after), and I'm trying to clean up the list of issues right now.

On further inspection, these are probably out-of-memory crashes. I get crashes on the larger examples in restricted-memory environments, but they are running (slowly) in environments with a large amount of memory. The larger examples here are using over 3 GB of memory. You can reduce the size of the problem by restricting the set of active orbitals in the excitation space using the MAXCI or C.A.S. keywords. Please feel free to reactivate this issue if you are still getting crashes even when the memory usage is reduced or you are in a large-memory environment.

There isn't really a graceful way to handle out-of-memory errors in Fortran unless the program is made aware of the memory limits in advance. MOPAC has sensible defaults and barriers to prevent extremely large amounts of memory from being used, but large CI calculations can get very memory intensive.