crest-lab / crest

CREST - A program for the automated exploration of low-energy molecular chemical space.
https://crest-lab.github.io/crest-docs/
GNU Lesser General Public License v3.0
204 stars 43 forks source link

[BUG] - QCG Terminates with Backtrace #357

Open coltonbh opened 1 month ago

coltonbh commented 1 month ago

Describe the bug Running a quantum cluster growth calculation terminates with what appears to be a an issue reading structures.

To Reproduce crest solute.xyz --qcg solvent.xyz --nsolv 10 --keepdir --gfnff --chrg 0 --uhf 0

solute.xyz

57
qcio_charge=0 qcio_multiplicity=1 Etot= -110.6313818486
N  -0.72310484590000002 0.66682730909999999 -0.54501433450000003
C  -1.87169979450000001 1.19360751919999997 -0.95321806580000001
S  -1.97129138300000006 2.79283969019999967 -1.57649585970000006
N  -2.94530890739999984 0.40956234990000001 -0.95195686089999998
C  -4.18621362399999963 0.65751521089999998 -1.66105095770000011
C  -4.16981029230000022 -0.09468512040000000 -2.99185852120000018
H  -5.08689994109999954 0.10067461250000000 -3.54018849159999949
C  0.26180396800000000 1.36771634599999992 0.05119279150000000
H  -0.48797811540000002 -0.95079148020000004 0.39474888089999999
H  -2.81448767709999981 -0.55778700709999995 -0.66930063760000003
H  -4.08733984479999979 -1.16333749489999994 -2.80801514739999991
H  -3.32540944749999978 0.23069547979999999 -3.60050555330000011
H  -4.24793115800000010 1.73559105110000012 -1.84303114740000007
C  -5.35023178039999969 0.20718259750000001 -0.78535404450000001
H  -5.34714631629999992 0.74548881680000001 0.15970374360000000
H  -5.27007377899999963 -0.85834452240000003 -0.58210172250000003
H  -6.29263612380000037 0.39965374660000003 -1.29043919439999999
O  -1.90662621459999992 -4.19268810949999970 0.55602488859999999
C  -1.83353074260000004 -3.36595508829999979 -0.47297442929999994
O  -2.70597174039999988 -2.56333910710000001 -0.69147216580000004
H  -0.36182517120000002 -6.71058824699999956 2.09947854169999992
C  -1.19212430430000005 -6.03902245929999992 1.90310497310000004
H  -2.05017745979999999 -6.62614431919999980 1.58691676379999991
H  -1.44686225289999992 -5.49372943379999956 2.80696703809999981
C  -0.79885923709999995 -5.06338844059999982 0.80696559050000005
H  0.05914673530000000 -4.44754011060000032 1.12122921700000000
C  -0.61286592200000001 -3.56347345989999997 -1.37459513530000010
H  0.24878601440000001 -3.12006319759999995 -0.85300079760000003
O  -0.37664519610000002 -4.96602777649999982 -1.55731918940000003
C  -0.41319693880000002 -5.76725236470000002 -0.49720021910000001
O  -0.16965793670000001 -6.93950624460000043 -0.59019043540000005
C  -0.78873448450000017 -2.93342560249999984 -2.74767156129999979
H  -1.65105047429999985 -3.36709303300000018 -3.24734534089999993
H  -0.94080994129999995 -1.86249130399999996 -2.63426329910000012
H  0.09769584770000000 -3.12238550349999988 -3.34633290499999969
O  -0.31270587709999997 -1.72908744209999998 0.96222987169999996
C  -0.75639768029999999 -1.41562626900000010 2.26570853620000001
H  -0.48053002800000000 -2.24861458190000008 2.91119042929999994
H  -0.27953495010000001 -0.50415289610000003 2.63805106130000011
H  -1.84335077949999993 -1.28882117770000004 2.29006576190000022
Na 0.32472673889999998 1.86108953960000001 -2.55904222440000062
C  1.59437988690000010 0.95251278650000004 -0.11900194240000000
C  2.62798630969999980 1.60470832070000013 0.52971551090000002
C  2.39738014130000021 2.66860490969999997 1.38924900060000001
C  1.07462962530000006 3.06100906630000003 1.58479759759999994
C  0.02722214700000000 2.44753363100000021 0.93182787649999999
H  1.79667058959999992 0.07812474300000000 -0.72427869379999998
H  3.20646641519999998 3.16906125620000001 1.89608601299999990
C  4.02242677450000041 1.13432563070000003 0.23739594440000000
C  0.79714348099999988 4.21848637510000035 2.49966740180000002
H  -0.98917202859999998 2.76478783479999990 1.11494240200000005
F  4.98155598309999981 1.85775123160000000 0.82310144169999999
F  4.27770141500000012 1.17451972130000004 -1.09261876559999993
F  4.23038156880000038 -0.14445611950000001 0.60183740860000001
F  0.93531460619999995 5.40534407600000044 1.86909261979999997
F  1.63171354739999996 4.26697994790000035 3.55306484169999992
F  -0.44489063280000002 4.21295314450000014 3.00783101180000001

solvent.xyz

5
qcio_charge=0 qcio_multiplicity=1 Etot= -12.2459681537
Cl 1.46122853990000001 0.17199287420000001 0.04406414020000000
C  -0.00104032490000000 -0.82797907320000008 0.02872366960000000
Cl -1.46079607739999995 0.17219286340000001 -0.05600426540000000
H  0.02909363750000000 -1.46634110380000005 -0.85247231329999995
H  -0.03269974490000000 -1.40366280469999993 0.95203640290000002

CREST Stdout


       ╔════════════════════════════════════════════╗
       ║            ___ ___ ___ ___ _____           ║
       ║           / __| _ \ __/ __|_   _|          ║
       ║          | (__|   / _|\__ \ | |            ║
       ║           \___|_|_\___|___/ |_|            ║
       ║                                            ║
       ║  Conformer-Rotamer Ensemble Sampling Tool  ║
       ║          based on the xTB methods          ║
       ║                                            ║
       ╚════════════════════════════════════════════╝
       Version 3.0.2, Sun, 25 August 20:02:44, 08/25/2024
       commit (af7eb99) compiled by 'usr@fv-az732-492'

   Cite work conducted with this code as

   • P.Pracht, F.Bohle, S.Grimme, PCCP, 2020, 22, 7169-7192.
   • S.Grimme, JCTC, 2019, 15, 2847-2862.
   • P.Pracht, S.Grimme, C.Bannwarth, F.Bohle, S.Ehlert,
     G.Feldmann, J.Gorges, M.Müller, T.Neudecker, C.Plett,
     S.Spicher, P.Steinbach, P.Wesołowski, F.Zeller,
     J. Chem. Phys., 2024, 160, 114110.

   for works involving QCG cite

   • S.Spicher, C.Plett, P.Pracht, A.Hansen, S.Grimme,
     JCTC, 2022, 18 (5), 3174-3189.
   • C.Plett, S. Grimme,
     Angew. Chem. Int. Ed. 2023, 62, e202214477.

   for works involving MECP screening cite

   • P.Pracht, C.Bannwarth, JCTC, 2022, 18 (10), 6370-6385.

   Original code
     P.Pracht, S.Grimme, Universität Bonn, MCTC
   with help from (alphabetical order):
     C.Bannwarth, F.Bohle, S.Ehlert, G.Feldmann, J.Gorges,
     S.Grimme, C.Plett, P.Pracht, S.Spicher, P.Steinbach,
     P.Wesolowski, F.Zeller

   Online documentation is available at
   https://crest-lab.github.io/crest-docs/

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   GNU Lesser General Public License (LGPL) for more details.

 Command line input:
 $ crest solute.xyz -qcg solvent.xyz --nsolv 10 --keepdir --gfnff --chrg 0 --uhf 0

  --gfnff : Use of GFN-FF requested.
  --chrg 0
  --uhf 0

> Setting up backup calculator ... done.
 ----------------
 Calculation info
 ----------------
> User-defined calculation level:
 : GFN-FF calculation via GFNFF lib
 :   Molecular charge    : 0

  ========================================
  |           ----------------           |
  |                 Q C G                |
  |           ----------------           |
  |        Quantum Cluster Growth        |
  |       University of Bonn, MCTC       |
  ========================================
   S. Grimme, S. Spicher, C. Plett.

   Cite work conducted with this code as

   S. Spicher, C. Plett, P. Pracht, A. Hansen, S. Grimme, JCTC, 2022, 18, 3174-3189.

   The use of the aISS algorithm is requested (recommend).
   This requires xtb version 6.6.0 or newer.
   xTB-IFF can still be used with the --xtbiff flag.

  =========================================
  |   quantum cluster growth: INPUT       |
  =========================================

  QCG: Only Cluster Generation

  input parameters     
  solute                 : solute.xyz
  charge                 : 0
  uhf                    : 0
  solvent                : solvent.xyz
  # of solvents to add   : 10
  Cluster generated that are above 10 % populated 
  # of CPUs used         : 1
  Solvation model        : 
  xtb opt level          : normal
  System temperature [K] : 298.1
  RRHO scaling factor    : 0.75

 Solute geometry
  molecular radius (Bohr**1):   10.19
  molecular area   (Bohr**2): 2013.72
  molecular volume (Bohr**3): 4427.45
 Solvent geometry
  molecular radius (Bohr**1):    5.59
  molecular area   (Bohr**2):  429.00
  molecular volume (Bohr**3):  732.83

  radius of solute    :    16.42
  radius of solvent   :     9.02

  =========================================
  |            Preoptimization            |
  =========================================
 Total Energy of solute not found
 Total Energy of solvent not found

  ________________________________________________________________________

  __________________     Solute Cluster Generation   _____________________

  ________________________________________________________________________

  =========================================
  |   quantum cluster growth: GROW        |
  =========================================

 Solute:
       unit ellipsoid axis a,b,c     :   0.333   0.333   0.333
 Solvent:
       unit ellipsoid axis a,b,c     :   0.333   0.333   0.333

  solvent anisotropy            :     1.000
  solute anisotropy             :     1.000
  roff inner wall               :     0.000
  solute max dist               :    23.878
  solvent max dist              :     5.525
  inner unit axis               :     0.333     0.333     0.333
  inner ellipsoid/Bohr          :     2.388     2.388     2.388
  scaling factor outer ellipsoid:     1.000
  outer ellipsoid/Bohr          :     2.763     2.763     2.763

  Size       E        De       Detot      Density     Eatom    av. R  Rlast   Volume    Opt
            [Eh]    [kcal]     [kcal]     [u/Å^3]     [kcal]   [bohr] [bohr] [bohr^3]
Note: The following floating-point exceptions are signalling: IEEE_UNDERFLOW_FLAG IEEE_DENORMAL
ERROR STOP error while reading input coordinates

Error termination. Backtrace:
#0  0xced1d0 in ???
#1  0xced479 in ???
#2  0xcee587 in ???
#3  0x845de4 in __strucrd_MOD_rdxmol
    at /home/runner/work/crest/crest/src/strucreader.f90:1028
#4  0x846c83 in __strucrd_MOD_rdcoord
    at /home/runner/work/crest/crest/src/strucreader.f90:936
#5  0x6a94d3 in qcg_grow_
    at /home/runner/work/crest/crest/src/qcg/solvtool.f90:661
#6  0x6b3e68 in crest_solvtool_
    at /home/runner/work/crest/crest/src/qcg/solvtool.f90:87
#7  0x40e52b in crest
    at /home/runner/work/crest/crest/src/crest_main.f90:261
#8  0x408f7e in main
    at /home/runner/work/crest/crest/src/crest_main.f90:26

Expected behavior The QCG algorithm would execute correctly.

coltonbh commented 1 month ago

Also, I can confirm the same error when running example 2 on the documentation website found here. I'm using crest 3.0.2.

coltonbh commented 1 month ago

Also can confirm this isn't a /n issue. Tried solvent and solute with/without /n characters to terminate their xyz files.

cplett commented 1 month ago

Hi, which version of xtb are you using for the CREST runs? In version 6.7.1, there was a bug that caused a segmentation fault in the docking module, which might be the reason for the error you encountered. If you're using this version, I recommend switching to 6.7.1 or to the bleeding edge version of xtb to avoid this issue.

coltonbh commented 1 month ago

I'm not using an xtb binary. I'm using the CREST 3.0.2 binary available here on GitHub, which I believe uses tblite under the hood (though I could be mistaken!).

pprcht commented 1 month ago

QCG still uses xtb, there is a disclaimer in the README.md. It will have uses whatever binary it has found as there should be a error stop if none is present.

coltonbh commented 1 month ago

I see! That could be the issue! Really appreciate the feedback here to know what's going on.

It would be excellent if the program communicated these types of messages (ERROR: no xtb executable found.) or something like that. Then I'd know how to proceed without harassing you here :)

Much thanks! Lemme try to run in an environment with an xtb executable and see if that fixes it...

pprcht commented 1 month ago

It actually already does that, here's the relevant part in QCG: https://github.com/crest-lab/crest/blob/a12cb4852e861864b7f220b1e51573c00ca33586/src/qcg/solvtool.f90#L56-L71

Are you sure there wasn't an xtb somewhere in path?

coltonbh commented 1 month ago

Ah. I see. And yes, I have xtb-python installed, version 22.1 (though if you check xtb.__version__ it will say 20.2 due to this issue, the fix for which never got published to pypi).

Is there some reason you'd expect this executable to not work?

matterhorn103 commented 2 days ago

In the interests of not making yet another thread to report this, I'll comment here to report that I am also having the same issue.

In contrast to @matsumuraf in the other related thread, I can't run QCG example 1 either though and get the following output:

...
Command line input:
 $ ../bin/crest bacillaene.xyz --qcg water.xyz --nsolv 100 --gfnff --T 12 --alpb water --nofix --xnam ../bin/xtb-bleed/bin/xtb

  --gfnff : Use of GFN-FF requested.
  --T 12 (CPUs/Threads selected)
  --alpb water : implicit solvation
  -xnam :
     xtb executable was set to: "../bin/xtb-bleed/bin/xtb"

> Setting up backup calculator ... done.
 ----------------
 Calculation info
 ----------------
> User-defined calculation level:
 : GFN-FF calculation via GFNFF lib
 :   Molecular charge    : 0
 :   Solvation model     : alpb
 :   Solvent             : water

  ========================================
  |           ----------------           |
  |                 Q C G                |
  |           ----------------           |
  |        Quantum Cluster Growth        |
  |       University of Bonn, MCTC       |
  ========================================
   S. Grimme, S. Spicher, C. Plett.

   Cite work conducted with this code as

   S. Spicher, C. Plett, P. Pracht, A. Hansen, S. Grimme, JCTC, 2022, 18, 3174-3189.

   The use of the aISS algorithm is requested (recommend).
   This requires xtb version 6.6.0 or newer.
   xTB-IFF can still be used with the --xtbiff flag.

  =========================================
  |   quantum cluster growth: INPUT       |
  =========================================

  QCG: Only Cluster Generation

  input parameters     
  solute                 : bacillaene.xyz
  charge                 : 0
  uhf                    : 0
  solvent                : water.xyz
  # of solvents to add   : 100
  Cluster generated that are above 10 % populated 
  # of CPUs used         : 12
  Solvation model        : water               
  xtb opt level          : normal
  System temperature [K] : 298.1
  RRHO scaling factor    : 0.75

 Solute geometry
  molecular radius (Bohr**1):   11.20
  molecular area   (Bohr**2): 2554.19
  molecular volume (Bohr**3): 5887.65
 Solvent geometry
  molecular radius (Bohr**1):    3.88
  molecular area   (Bohr**2):  194.90
  molecular volume (Bohr**3):  244.27

  radius of solute    :    18.06
  radius of solvent   :     6.25

  =========================================
  |            Preoptimization            |
  =========================================
 error while reading coord line. EOF
 Total Energy of solute not found
 error while reading coord line. EOF
 Total Energy of solvent not found

  ________________________________________________________________________

  __________________     Solute Cluster Generation   _____________________

  ________________________________________________________________________

  =========================================
  |   quantum cluster growth: GROW        |
  =========================================

  Water as solvent recognized, adjusting scaling factor for outer wall pot to 0.80

 Solute:
       unit ellipsoid axis a,b,c     :   0.431   0.287   0.282
 Solvent:
       unit ellipsoid axis a,b,c     :   0.386   0.322   0.292

  solvent anisotropy            :     1.133
  solute anisotropy             :     1.202
  roff inner wall               :     7.079
  solute max dist               :    41.009
  solvent max dist              :     7.278
  inner unit axis               :     0.534     0.236     0.229
  inner ellipsoid/Bohr          :    37.759    16.694    16.217
  scaling factor outer ellipsoid:     0.800
  outer ellipsoid/Bohr          :    23.222    15.441    15.219

  Size       E        De       Detot      Density     Eatom    av. R  Rlast   Volume    Opt
            [Eh]    [kcal]     [kcal]     [u/Å^3]     [kcal]   [bohr] [bohr] [bohr^3]
   Wall Potential too small, increasing size by 5 %
   New scaling factor 0.84
   Wall Potential too small, increasing size by 5 %
   New scaling factor 0.88
   Wall Potential too small, increasing size by 5 %
   New scaling factor 0.93
   Wall Potential too small, increasing size by 5 %
   New scaling factor 0.97
   Wall Potential too small, increasing size by 5 %
   New scaling factor 1.00
ERROR STOP error while reading input coordinates

Error termination. Backtrace:
#0  0xced1d0 in ???
#1  0xced479 in ???
#2  0xcee587 in ???
#3  0x845de4 in __strucrd_MOD_rdxmol
        at /home/runner/work/crest/crest/src/strucreader.f90:1028
#4  0x846c83 in __strucrd_MOD_rdcoord
        at /home/runner/work/crest/crest/src/strucreader.f90:936
#5  0x6a94d3 in qcg_grow_
        at /home/runner/work/crest/crest/src/qcg/solvtool.f90:661
#6  0x6b3e68 in crest_solvtool_
        at /home/runner/work/crest/crest/src/qcg/solvtool.f90:87
#7  0x40e52b in crest
        at /home/runner/work/crest/crest/src/crest_main.f90:261
#8  0x408f7e in main
        at /home/runner/work/crest/crest/src/crest_main.f90:26

The error output with example 2 is similar:

...
  Size       E        De       Detot      Density     Eatom    av. R  Rlast   Volume    Opt
            [Eh]    [kcal]     [kcal]     [u/Å^3]     [kcal]   [bohr] [bohr] [bohr^3]
Note: The following floating-point exceptions are signalling: IEEE_UNDERFLOW_FLAG IEEE_DENORMAL
ERROR STOP error while reading input coordinates

Error termination. Backtrace:
#0  0xced1d0 in ???
#1  0xced479 in ???
#2  0xcee587 in ???
#3  0x845de4 in __strucrd_MOD_rdxmol
        at /home/runner/work/crest/crest/src/strucreader.f90:1028
#4  0x846c83 in __strucrd_MOD_rdcoord
        at /home/runner/work/crest/crest/src/strucreader.f90:936
#5  0x6a94d3 in qcg_grow_
        at /home/runner/work/crest/crest/src/qcg/solvtool.f90:661
#6  0x6b3e68 in crest_solvtool_
        at /home/runner/work/crest/crest/src/qcg/solvtool.f90:87
#7  0x40e52b in crest
        at /home/runner/work/crest/crest/src/crest_main.f90:261
#8  0x408f7e in main
        at /home/runner/work/crest/crest/src/crest_main.f90:26

And with my own attempt:

free(): invalid pointer

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
#0  0xced1d0 in ???
#1  0xcec805 in ???
#2  0x26c9cef in ???
#3  0x26edd3c in ???
#4  0x26c9c75 in ???
#5  0x4085ce in ???
#6  0x26e4335 in ???
#7  0x26f14cb in ???
#8  0x26f2603 in ???
#9  0x26f5c40 in ???
#10  0xa52a04 in get_volume_
        at /home/runner/work/crest/crest/src/qcg/volume.f90:52
#11  0x6978e7 in get_sphere_
        at /home/runner/work/crest/crest/src/qcg/solvtool.f90:2458
#12  0x6a3d0a in get_ellipsoid_
        at /home/runner/work/crest/crest/src/qcg/solvtool.f90:2561
#13  0x6a8da4 in qcg_grow_
        at /home/runner/work/crest/crest/src/qcg/solvtool.f90:545
#14  0x6b3e68 in crest_solvtool_
        at /home/runner/work/crest/crest/src/qcg/solvtool.f90:87
#15  0x40e52b in crest
        at /home/runner/work/crest/crest/src/crest_main.f90:261
#16  0x408f7e in main
        at /home/runner/work/crest/crest/src/crest_main.f90:26
fish: Job 1, '../bin/crest input.xyz --qcg ./…' terminated by signal SIGABRT (Abort)

This last calculation was run with methanol rather than water as the solvent, I can provide structures if desired but it doesn't seem to be specific to that.

Following the advice above I tried using the bleeding-edge binary of xtb rather than 6.7.1 but that doesn't change anything.

This is with the pre-built binary of CREST 3.0.2, not the conda version, for reference, and all on Linux.