Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack smashing for linear molecules #593

Open
chem-william opened this issue Feb 28, 2022 · 5 comments
Open

Stack smashing for linear molecules #593

chem-william opened this issue Feb 28, 2022 · 5 comments
Labels
bug Something isn't working driver: hessian Related to the numerical differentation driver

Comments

@chem-william
Copy link
Contributor

Describe the bug
When running the following command:

xtb mol.mol --ohess

a crash will occur in the section "Thermodynamic Functions" with the following error:

*** stack smashing detected ***: xtb terminated

To Reproduce
Steps to reproduce the behaviour:
Optimize and calculate the hessian for the following molecule:

     RDKit          3D

 12 11  0  0  0  0  0  0  0  0999 V2000
   -0.6397    5.1995    3.0833 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.5134    4.1732    2.4743 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.3514    2.8563    1.6927 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.2251    1.8300    1.0836 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.0631    0.5131    0.3021 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.0631   -0.5131   -0.3069 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.2251   -1.8300   -1.0884 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.3514   -2.8563   -1.6974 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.5134   -4.1732   -2.4790 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.6397   -5.1995   -3.0881 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.7517    6.1103    3.6238 H   0  0  0  0  0  0  0  0  0  0  0  0
    0.7517   -6.1103   -3.6285 H   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  3  0
  2  3  1  0
  3  4  3  0
  4  5  1  0
  5  6  3  0
  6  7  1  0
  7  8  3  0
  8  9  1  0
  9 10  3  0
  1 11  1  0
 10 12  1  0
M  END

Expected behaviour
I expected the program to terminate without an error.

Additional context
It happens both with a conda installation

(env_xtb) [williamb]$ mamba list xtb
# packages in environment at /groups/kemi/williamb/opt/anaconda3/envs/env_xtb:
#
# Name                    Version                   Build  Channel
xtb                       6.4.1                hf06ca72_2    conda-forge
(env_xtb) [williamb]$ xtb --version
      -----------------------------------------------------------
     |                   =====================                   |
     |                           x T B                           |
     |                   =====================                   |
     |                         S. Grimme                         |
     |          Mulliken Center for Theoretical Chemistry        |
     |                    University of Bonn                     |
      -----------------------------------------------------------

   * xtb version 6.4.1 (23d549d) compiled by 'conda@3c73975816cd' on 2022-01-07

and a self-compiled 6.4.1 version

@chem-william chem-william added the unconfirmed This report has not yet been confirmed by the developers label Feb 28, 2022
@awvwgk awvwgk added bug Something isn't working and removed unconfirmed This report has not yet been confirmed by the developers labels Feb 28, 2022
@awvwgk
Copy link
Member

awvwgk commented Mar 2, 2022

Can't reproduce this behavior with the 325d1c0 nor the 6.4.1 release version when using Intel compilers. With GCC11 I get the following error

Molecule has the following symmetry elements: (i) (Cinf) (C2) 2*(sigma) 
It seems to be the Dinfh point group
din symmetry found (for desy threshold:  0.10E+00) used in thermo
*** stack smashing detected ***: terminated

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
#0  0x7f96f1efbd9f in ???
#1  0x7f96f1efbd22 in ???
#2  0x7f96f1ee5861 in ???
#3  0x7f96f1f3dd27 in ???
#4  0x7f96f1fcccc9 in ???
#5  0x7f96f1fccc93 in ???
#6  0x55f1324c9cfd in __xtb_thermo_MOD_getsymmetry
	at ../src/thermo.f90:77
#7  0x55f13234d74e in __xtb_propertyoutput_MOD_print_thermo
	at ../src/main/property.F90:1033
#8  0x55f132353ce6 in __xtb_propertyoutput_MOD_main_freq
	at ../src/main/property.F90:467
#9  0x55f13230325e in __xtb_prog_main_MOD_xtbmain
	at ../src/prog/main.F90:849
#10  0x55f1322f8fa5 in xtb_prog_primary
	at ../src/prog/primary.f90:55
#11  0x55f1322f8fa5 in main
	at ../src/prog/primary.f90:20
zsh: abort (core dumped)  ./_build_gcc11/xtb lin.mol --namespace test --ohess

@awvwgk awvwgk added the driver: hessian Related to the numerical differentation driver label Mar 18, 2022
@ppinski-hqs
Copy link

We recently ran into the same problems with version 6.5.1 installed as a package from conda-forge. This happens with simple linear molecules, such the N2 molecule below in an xyz file:

2

N 0.00 0.00 -0.55
N 0.00 0.00  0.55

xTB command: xtb N2.xyz --hess

After the Hessian calculation, the "stack smashing" error mentioned above appears.

On this occasion, I wanted to ask if there are any news regarding this bug?

@MtoLStoN
Copy link
Member

This is possibly related to #772, which I fixed in #774. Could you confirm?

@ppinski-hqs
Copy link

A bit late to reply, but version 6.6.1 as packaged on conda-forge still appears to have this problem.

@goxeq
Copy link

goxeq commented Sep 13, 2023

I tried to find the bug and this is what I found:

Cause of the bug

The problem is that in in symmetry/symmetry.f90, lines 74-77, we copy from string symbol to sfsym. Size of symbol is 6 (line 53). Size of sfsym is determined from atmp in src/thermo.f90. However, size of atmp, declared in subroutine getsymmetry in 4. Therefore, in the copying we are overwriting memory adjacent to where the string is atmp allocated, which leads to the error. This does not happen with symmetry symbols such as C3v, which have only 3 characters and the copying stops on the null byte and thus does not overwrite the adjacent memory. Therefore, the bug only happens with Dinfh an Cinfv symmetries.

Proposed fix

The simplest fix is to change line 34 in file src/thermo from Character(len=4) atmp to Character(len=6) atmp. This resolves the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working driver: hessian Related to the numerical differentation driver
Projects
None yet
Development

No branches or pull requests

5 participants