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
190 stars 42 forks source link

QCG error #132

Closed yanfeiguan closed 5 months ago

yanfeiguan commented 2 years ago

Hi, thank you for this great method and I am testing it on some molecules in water. When I use crest 2.12 with xtb 6.5 I got a memory error:

*** Error in `crest': corrupted size vs. prev_size: 0x0000555555722fe0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7f474)[0x2aaaad322474]
/lib64/libc.so.6(+0x8156b)[0x2aaaad32456b]
crest(+0xdf5d)[0x555555561f5d]
crest(+0x16b70)[0x55555556ab70]
crest(+0x28072)[0x55555557c072]
crest(+0x31e10)[0x555555585e10]
crest(+0x172c71)[0x5555556c6c71]
crest(+0xb341)[0x55555555f341]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x2aaaad2c5555]
crest(+0xb371)[0x55555555f371]

If I tried crest 2.12 with xtb 6.4.0 I got another error:

*** Error in `/home/guany20/.conda/envs/xtb/bin/crest': munmap_chunk(): invalid pointer: 0x0000555555745c60 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7f474)[0x2aaaad322474]
/home/.conda/envs/xtb/bin/crest(+0xdc9d)[0x555555561c9d]
/home/.conda/envs/xtb/bin/crest(+0x1686e)[0x55555556a86e]
/home/.conda/envs/xtb/bin/crest(+0x25a8a)[0x555555579a8a]
/home/.conda/envs/xtb/bin/crest(+0x2f45e)[0x55555558345e]
/home/.conda/envs/xtb/bin/crest(+0x16b5fb)[0x5555556bf5fb]
/home/.conda/envs/xtb/bin/crest(+0xb081)[0x55555555f081]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x2aaaad2c5555]
/home/.conda/envs/xtb/bin/crest(+0xb0b1)[0x55555555f0b1]

The solvents didn't actually grow, the last file I got in the tmp_gro folders are

-rw-r--r-- 1    20013 Jun 20 18:03 solute.lmo
-rw-r--r-- 1      632 Jun 20 18:03 solvent.lmo 
-rw-r--r-- 1    48855 Jun 20 18:03 solute_cavity.coord
-rw-r--r-- 1    56955 Jun 20 18:03 twopot_1.coord
-rw-r--r-- 1   119850 Jun 20 18:03 xtbscreen.xyz
-rw-r--r-- 1   119850 Jun 20 18:03 xtbscreen2.xyz
-rw-r--r-- 1    18191 Jun 20 18:03 iff.out
-rw-r--r-- 1     8492 Jun 20 18:03 xtbiff.coord
-rw-r--r-- 1    57198 Jun 20 18:03 twopot_2.coord
-rw-r--r-- 1      209 Jun 20 18:03 xcontrol
-rw-r--r-- 1    58394 Jun 20 18:03 xtbopt.log
-rw-r--r-- 1     8492 Jun 20 18:03 xtbopt.coord
-rw-r--r-- 1    69213 Jun 20 18:03 xtb_opt.out 
-rw-r--r-- 1    28925 Jun 20 18:03 xtb_sp.out
-rw-r--r-- 1     8492 Jun 20 18:03 cluster.coord
-rw-r--r-- 1     8252 Jun 20 18:03 solute_cut.coord
-rw-r--r-- 1      252 Jun 20 18:03 solvent_cut.coord
-rw-r--r-- 1     5978 Jun 20 18:03 wbo
-rw-r--r-- 1    28927 Jun 20 18:03 xtb.out
-rw-r--r-- 1     8492 Jun 20 18:03 optimized_cluster.coord
-rw-r--r-- 1    49098 Jun 20 18:03 cluster_cavity.coord
-rw-r--r-- 1    57198 Jun 20 18:03 twopot_cavity.coord
-rw------- 1  6012928 Jun 20 18:03 core.228784 

The molecule size I am testing is around 100 atoms. And I tried both 100 water and 10 waters. They gave the same error.

Any help will be appreciated. Thank you!

cplett commented 2 years ago

Hi, this error can be caused by a few things. Could you please provide the output of crest and have a look at the files 'xtb.out', 'xtb_opt.out', 'xtb_sp.out' and 'iff.out' in the tmp_grow directory to make sure that xtb and xtbiff did not cause the error. Moreover, it would be nice to know whether you compiled crest or used the provided binary.

yanfeiguan commented 2 years ago

Thank you very much for your prompt response.

Here is the crest output


       ==============================================
       |                                            |
       |                 C R E S T                  |
       |                                            |
       |  Conformer-Rotamer Ensemble Sampling Tool  |
       |          based on the GFN methods          |
       |             P.Pracht, S.Grimme             |
       |          Universitaet Bonn, MCTC           |
       ==============================================
       Version 2.12,   Thu 19. Mai 16:32:32 CEST 2022
  Using the xTB program. Compatible with xTB version 6.4.0

   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.

   and for works involving QCG as

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

   with help from:
   C.Bannwarth, F.Bohle, S.Ehlert, S.Grimme,
   C.Plett, P.Pracht, S.Spicher

   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.

 Command line input:
 > crest open_api.xyz --qcg water.xyz --xnam /home/.conda/envs/xtb/bin/xtb_650/xtb-6.5.0/bin/xtb --nsolv 10 --wscal 1.0

 Solute-file: open_api.xyz
 Solvent-file: water.xyz
  -xnam :
     xtb executable was set to: "/home/.conda/envs/xtb/bin/xtb_650/xtb-6.5.0/bin/xtb"

  ========================================
  |           ----------------           |
  |                 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.

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

  QCG: Only Cluster Generation

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

 Solute geometry
  molecular radius (Bohr**1):   11.79
  molecular area   (Bohr**2): 3061.40
  molecular volume (Bohr**3): 6858.04
 Solvent geometry
  molecular radius (Bohr**1):    3.88
  molecular area   (Bohr**2):  194.90
  molecular volume (Bohr**3):  244.27

  radius of solute    :    19.00
  radius of solvent   :     6.25

  =========================================
  |            Preoptimization            |
  =========================================

 -------------------------
 xTB Geometry Optimization
 -------------------------
 Geometry successfully optimized.
 Generating LMOs for solute
  Total Energy of solute:    -152.3792772 Eh

 -------------------------
 xTB Geometry Optimization
 -------------------------
 Geometry successfully optimized.
 Generating LMOs for solvent
  Total energy of solvent:     -5.0705444 Eh

  ________________________________________________________________________

  __________________     Solute Cluster Generation   _____________________

  ________________________________________________________________________

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

  Constraining solute during Growth 
 Solute:
       unit ellipsoid axis a,b,c     :   0.500   0.251   0.249
 Solvent:
       unit ellipsoid axis a,b,c     :   0.386   0.322   0.292

  solvent anisotropy            :     1.133
  solute anisotropy             :     1.325
  roff inner wall               :     8.962
  solute max dist               :    58.458
  solvent max dist              :     7.284
  inner unit axis               :     0.667     0.168     0.165
  inner ellipsoid/Bohr          :    58.676    14.773    14.490
  scaling factor outer ellipsoid:     1.000
  outer ellipsoid/Bohr          :    38.790    19.464    19.277

  Size  E /Eh       De/kcal   Detot/kcal  Density   Efix         R   av/act. Surface   Opt

xtb.out, xtb_opt.out, and xtb_sp.out look good and should be terminated normally. I could not tell if iff.out is completed. This is the last block from iff.out:

 best (resorted to full energy) structures on file xtbscreen.xyz
 best structure (Rx,Ry,Rz,alp,bet,gam,E in kcal/mol):
R CMA (Angst) :    10.867
R min (Angst) :     1.849
dipole moment :     1.760
intermolecular energies in kcal/mol
E Pauli       :     3.757
E disp ATM    :     0.024
E disp 2B     :    -1.812
E disp total  :    -1.789
E ES atom     :    -4.928
E ES LMO      :    -3.060
E ES total    :    -7.988
E induction   :    -0.862
E CT          :     0.000
E cavity      :     0.328
Eint total,gas:    -6.554
                 -6.55396665  <== Gint total

I didn't compile crest, I used the one that comes from conda install directly.

yanfeiguan commented 2 years ago

I compiled crest and xtb from the public realse of crest 2.12 and xtb 6.4.0. Still no luck on this. This time crest crashed earlier with all Nan in solute coord files.

What is the version of crest and xtb would you recommend, are they from conda binary or compiled? Thank you very much!

cplett commented 2 years ago

I tested QCG with the current and previous crest version and with every xtb release since 6.4.0. Normally, each of these combinations should be compatible. Yet, I have tested versions that I compiled by myself and the public release binary, but I didn't check the current conda release. However, I will check on that. Maybe there is a problem. Does crest work for you with the normal conformer search without using the "--qcg" flag?

yanfeiguan commented 2 years ago

Thank you for confirming that! Yes, Crest works for us for normal conformer searching. I have been testing multiple combinations of CREST and XTB on QCG, but no luck on either of those. Error messages also vary according to different versions and parameters. For example using the complied github master branch, I got this traceback for running:

crest xxxx.xyz --qcg water.xyz --nsolv 10 --wscal 1.0 > crest.out

Backtrace for this error:
#0  0x2aaab6d0fb00 in ???
#1  0x2aaab6d0ed55 in ???
#2  0x2aaab74dd3ff in ???
#3  0x2aaab74dd387 in ???
#4  0x2aaab74dea77 in ???
#5  0x2aaab751ff66 in ???
#6  0x2aaab7526473 in ???
#7  0x4290aa in get_volume_
    at ../src/qcg/volume.f90:52
#8  0x406e64 in get_sphere_
    at ../src/qcg/solvtool.f90:2288
#9  0x4170fd in qcg_grow_
    at ../src/qcg/solvtool.f90:635
#10  0x420106 in crest_solvtool_
    at ../src/qcg/solvtool.f90:73
#11  0x55e847 in crest
    at ../src/crest_main.f90:278
#12  0x402e4c in main
    at ../src/crest_main.f90:25
Aborted

Thank you for developing CREST, it has been a very powerful tool for us. Really hope we can get QCG running as well.

cplett commented 2 years ago

Hi, I've tested now the current xtb and crest releases via conda and could not reproduce the error. Therefore, I would suggest that it might be a memory problem. How did you set up the memory settings? I have usually "ulimit -s unlimited" to make sure the program does not run out of memory. Moreover, "export OMP_STACKSIZE=4G" and "export OMP_MAX_ACTIVE_LEVELS=1" can be helpful for parallelization.

yanfeiguan commented 2 years ago

Thank you for checking that! Unfortunately, I still cannot get QCG running on our cluster, following your recommended memory setup. I also tried another new Linux box, while it seems like still some memory issues (with the benzoic_acid example, it can run up to 5 explicit water, while for larger molecules CREST crashes at the first water). Just wondering could this relate to Linux distribution or shared libraries? The two distributions I tried were RedHat 7.9 and CentOs 7. Could you let me know the Linux distribution you are running on? Thank you!

cplett commented 2 years ago

Hi, usually, I tried QCG on different Ubuntu versions, but normally this should not be a problem with the Linux distribution.

lbabetto commented 1 year ago

Hello,

I am having the same exact problem (let me know if I should open a separate issue instead!).

Crest 2.12 with xTB 6.5.1 (also tried with 6.4.0, same results), trying to build small water clusters with the command:

crest water.xyz --qcg water.xyz --nsolv 3 --gfn2 --ensemble --enslvl gfn2 --chrg 0 --uhf 0 --T 2

I am presented with the following error:

  ________________________________________________________________________

  __________________     Solute Cluster Generation   _____________________

  ________________________________________________________________________

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

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

  Constraining solute during Growth
 Solute:
       unit ellipsoid axis a,b,c     :   0.386   0.322   0.292
 Solvent:
       unit ellipsoid axis a,b,c     :   0.386   0.322   0.292

  solvent anisotropy            :     1.133
  solute anisotropy             :     1.133
  roff inner wall               :     0.277
  solute max dist               :     7.283
  solvent max dist              :     7.283
  inner unit axis               :     0.441     0.307     0.252
  inner ellipsoid/Bohr          :     6.731     4.677     3.841
  scaling factor outer ellipsoid:     0.700
  outer ellipsoid/Bohr          :     6.879     5.734     5.196

  Size  E /Eh       De/kcal   Detot/kcal  Density   Efix         R   av/act. Surface   Opt
    1   -10.146178   -3.19      -3.19       0.885     -4.142      0.0   0.0     456.0   normal
   Wall Potential too small, increasing size by 5 %
   New scaling factor 0.73
munmap_chunk(): invalid pointer

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
#0  0x7faa5d1da0bf in ???
#1  0x7faa5d1da03b in ???
#2  0x7faa5d1b9858 in ???
#3  0x7faa5d22429d in ???
#4  0x7faa5d22c32b in ???
#5  0x7faa5d22c57b in ???
#6  0x5607c205ff53 in ???
#7  0x5607c2068b6f in ???
#8  0x5607c207a071 in ???
#9  0x5607c2083e0f in ???
#10  0x5607c21c4c70 in ???
#11  0x5607c205d340 in ???
#12  0x7faa5d1bb0b2 in ???
#13  0x5607c205d370 in ???
Aborted (core dumped)

Software was installed via Conda, running on a Ubuntu 20.04 LTS workstation. Same error happens even if not using the same molecule for solute and solvent, all the temporary files look in orderm ulimit=unlimited, OMP_STACKSIZE=4G OMP_MAX_ACTIVE_LEVELS=1

Also tried on Ubuntu 20.04 running via WSL2 on my laptop, same issue.

cplett commented 1 year ago

A short update at this point: this shoud be the same problem as in Issue #135. I fixed the bug with the pull request #139 and as soon as a new version of crest will be out, the build with conda also in combination with gfortran should lead to a working QCG. Thanks again for all the contributions to this problem.

github-actions[bot] commented 5 months ago

This issue had no activity for 6 months. It will be closed in 1 week unless there is some new activity.