grimme-lab / xtb

Semiempirical Extended Tight-Binding Program Package
https://xtb-docs.readthedocs.io/
GNU Lesser General Public License v3.0
572 stars 144 forks source link

command-line xtb can't find configuration files #190

Closed ekwan closed 4 years ago

ekwan commented 4 years ago

Hi Everyone,

Since the Python API for xtb is still buggy, I have been running xtb from the command line. Unfortunately, I am experiencing some unexpected behavior with XTBPATH and the configuration files. Here's a very simple input xyz:

2
hydrogen
 H          0.25000000    0.00000000    0.00000000
 H         -0.25000000    0.00000000    0.00000000

Here's my xtb version: xtb version 6.2.3 (conda-forge). Here's my environment:

$ which xtb
/Users/ekwan/anaconda2/envs/presto/bin/xtb

$ ls /Users/ekwan/software/xtb
TESTSUITE  assets  cmake  include  man  meson  python  scripts  src  symmetry  CMakeLists.txt  CONTRIBUTING.md  COPYING  COPYING.LESSER  README.md  meson.build  meson_options.tx

$ export XTBPATH=/Users/ekwan/software/xtb

Now, watch this:

...
 * started run on 2020/05/09 at 17:19:08.559

           -------------------------------------------------
          |                Calculation Setup                |
           -------------------------------------------------

          program call               : xtb h2.xyz
          coordinate file            : h2.xyz
          omp threads                :                     8
          number of atoms            :                     2
          number of electrons        :                     2
          charge                     :                     0
          spin                       :                   0.0
          first test random number   :      0.39374574501535

           -------------------------------------------------
          |                 G F N 2 - x T B                 |
          | Geometry, Frequencies, Noncovalent interactions |
          |            JCTC 2019 parametrisation            |
           -------------------------------------------------
             k(s)              :                1.8500
             k(p)              :                2.2300
             k(d)              :                2.2300
             k(f)              :                0.0000
             kEN (H0ij)        :                0.0000
             D4 a1             :                0.0000
             D4 a2             :                0.0000
             D4 s6             :                1.0000
             D4 s8             :                0.0000
             D4 s9             :                0.0000
             alphaj            :                2.0000

  Z AO/shell   Hii/eV     exponent
  1     Wed Apr 25 08:07:45 CEST 2018   EN: 2.200 GM2: 0.406  GM3: 0.0800  RAES: 1.40
     1s    -10.707211    1.230000

           -------------------------------------------------
          |        Self-Consistent Charge Iterations        |
           -------------------------------------------------

          ...................................................
          :                      SETUP                      :
          :.................................................:
          :  # basis functions                   2          :
          :  # atomic orbitals                   2          :
          :  # shells                            2          :
          :  # electrons                         2          :
          :  max. iterations                   250          :
          :  Hamiltonian                  GFN2-xTB          :
          :  restarted?                      false          :
          :  GBSA solvation                  false          :
          :  PC potential                    false          :
          :  electronic temp.          300.0000000     K    :
          :  accuracy                    1.0000000          :
          :  -> integral cutoff          0.2500000E+02      :
          :  -> integral neglect         0.1000000E-07      :
          :  -> SCF convergence          0.1000000E-05 Eh   :
          :  -> wf. convergence          0.1000000E-03 e    :
          :  Broyden damping             0.4000000          :
          ...................................................

 iter      E             dE          RMSdq      gap      omega  full diag
   1     -5.3358693 -0.533587E+01  0.258E+00   42.94       0.0  T
   2     -5.3358693  0.355271E-14  0.155E+00   40.52       1.0  T
   3     -5.3358693 -0.710543E-14  0.930E-05   36.89     760.1  T
   4     -5.3358693  0.532907E-14  0.413E-09   36.89  100000.0  T

   *** convergence criteria satisfied after 4 iterations ***

         #    Occupation            Energy/Eh            Energy/eV
      -------------------------------------------------------------
         1        2.0000          -12.6099564            -343.1344 (HOMO)
         2                        -11.2542650            -306.2441 (LUMO)
      -------------------------------------------------------------
                  HL-Gap            1.3556914 Eh           36.8902 eV
             Fermi-level          -11.9321107 Eh         -324.6893 eV

 SCC (total)                   0 d,  0 h,  0 min,  0.002 sec
 SCC setup                      ...        0 min,  0.000 sec ( 10.565%)
 Dispersion                     ...        0 min,  0.000 sec (  1.129%)
 integral evaluation            ...        0 min,  0.000 sec (  3.560%)
 zeroth order Hamiltonian       ...        0 min,  0.000 sec (  1.013%)
 iterations                     ...        0 min,  0.001 sec ( 53.869%)
 molecular gradient             ...        0 min,  0.001 sec ( 23.389%)
 printout                       ...        0 min,  0.000 sec (  5.307%)

         :::::::::::::::::::::::::::::::::::::::::::::::::::::
         ::                     SUMMARY                     ::
         :::::::::::::::::::::::::::::::::::::::::::::::::::::
         :: total energy              -5.176184150977 Eh    ::
         :: gradient norm             37.813310310706 Eh/a0 ::
         :: HOMO-LUMO gap             36.890240117811 eV    ::
         ::.................................................::
         :: SCC energy                -5.335869326012 Eh    ::
         :: -> isotropic ES            0.000000000000 Eh    ::
         :: -> anisotropic ES          0.015288035095 Eh    ::
         :: -> anisotropic XC          0.005034545628 Eh    ::
         :: -> dispersion             -4.284426324753 Eh    ::
         :: repulsion energy           0.159685175035 Eh    ::
         :: add. restraining           0.000000000000 Eh    ::
         :::::::::::::::::::::::::::::::::::::::::::::::::::::

           -------------------------------------------------
          |                Property Printout                |
           -------------------------------------------------

    * Orbital Energies and Occupations

         #    Occupation            Energy/Eh            Energy/eV
      -------------------------------------------------------------
         1        2.0000          -12.6099564            -343.1344 (HOMO)
         2                        -11.2542650            -306.2441 (LUMO)
      -------------------------------------------------------------
                  HL-Gap            1.3556914 Eh           36.8902 eV
             Fermi-level          -11.9321107 Eh         -324.6893 eV

     #   Z        covCN         q      C6AA      α(0)
     1   1 H      0.981     0.000     3.049     2.728
     2   1 H      0.981    -0.000     3.049     2.728

 Mol. C6AA /au·bohr⁶  :         12.194547
 Mol. C8AA /au·bohr⁸  :        147.411947
 Mol. α(0) /au        :          5.456705

Wiberg/Mayer (AO) data.
largest (>0.10) Wiberg bond orders for each atom
          total WBO             WBO to atom ...
     1  H   1.000        H    2 1.000
     2  H   1.000        H    1 1.000

molecular dipole:
                 x           y           z       tot (Debye)
 q only:        0.000       0.000       0.000
   full:        0.000       0.000       0.000       0.000
molecular quadrupole (traceless):
                xx          xy          yy          xz          yz          zz
 q only:       -0.000       0.000       0.000       0.000       0.000       0.000
  q+dip:        0.401       0.000      -0.201       0.000       0.000      -0.201
   full:        0.161       0.000      -0.081       0.000       0.000      -0.081

           -------------------------------------------------
          | TOTAL ENERGY               -5.176184150977 Eh   |
          | GRADIENT NORM              37.813310310706 Eh/α |
          | HOMO-LUMO GAP              36.890240117811 eV   |
           -------------------------------------------------
########################################################################
[WARNING] Runtime exception occurred
-20- Unknown key 'kexplight' for '$globpar'
-19- Unknown key 'kexp' for '$globpar'
-18- Unknown key 'aesdmp5' for '$globpar'
-17- Unknown key 'aesdmp3' for '$globpar'
-16- Unknown key 's9' for '$globpar'
-15- Unknown key 's8' for '$globpar'
-14- Unknown key 'a2' for '$globpar'
-13- Unknown key 'a1' for '$globpar'
-12- Unknown key 'aesrmax' for '$globpar'
-11- Unknown key 'aesexp' for '$globpar'
-10- Unknown key 'aesshift' for '$globpar'
-9- Unknown key 'gam3d2' for '$globpar'
-8- Unknown key 'gam3d1' for '$globpar'
-7- Unknown key 'gam3p' for '$globpar'
-6- Unknown key 'gam3s' for '$globpar'
-5- Unknown key 'ipeashift' for '$globpar'
-4- Unknown key 'enscale' for '$globpar'
-3- Unknown key 'kdiff' for '$globpar'
-2- Unknown key 'kpd' for '$globpar'
-1- Unknown key 'ksd' for '$globpar'
########################################################################

------------------------------------------------------------------------
 * finished run on 2020/05/09 at 17:19:08.590
------------------------------------------------------------------------
 total:
 * wall-time:     0 d,  0 h,  0 min,  0.031 sec
 *  cpu-time:     0 d,  0 h,  0 min,  0.189 sec
 * ratio c/w:     6.196 speedup
 SCF:
 * wall-time:     0 d,  0 h,  0 min,  0.003 sec
 *  cpu-time:     0 d,  0 h,  0 min,  0.018 sec
 * ratio c/w:     6.341 speedup

normal termination of xtb
Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG IEEE_UNDERFLOW_FLAG IEEE_DENORMAL

As you can see, it printed out an energy, but I got all kinds of errors: configuration file errors and some kind of floating point error. Now, suppose I set XTBPATH to some nonsense:

$ ls
charges  h2.xyz  wbo  xtbrestart

$ rm charges wbo xtbrestart

$ export XTBPATH=adsfadsf

This time it runs! Note the energy is totally different:

$ xtb h2.xyz
...
 * started run on 2020/05/09 at 17:21:31.772

           -------------------------------------------------
          |                Calculation Setup                |
           -------------------------------------------------

          program call               : xtb h2.xyz
          coordinate file            : h2.xyz
          omp threads                :                     8
          number of atoms            :                     2
          number of electrons        :                     2
          charge                     :                     0
          spin                       :                   0.0
          first test random number   :      0.54794030302519

           -------------------------------------------------
          |                 G F N 2 - x T B                 |
          | Geometry, Frequencies, Noncovalent interactions |
          |            JCTC 2019 parametrisation            |
           -------------------------------------------------
             k(s)              :                1.8500
             k(p)              :                2.2300
             k(d)              :                2.2300
             k(f)              :                2.0000
             kEN (H0ij)        :               -2.0000
             D4 a1             :                0.5200
             D4 a2             :                5.0000
             D4 s6             :                1.0000
             D4 s8             :                2.7000
             D4 s9             :                5.0000
             alphaj            :                2.0000

  Z AO/shell   Hii/eV     exponent
  1     Wed Apr 25 08:07:45 CEST 2018   EN: 2.200 GM2: 0.406  GM3: 0.0800  RAES: 1.40
     1s    -10.707211    1.230000

           -------------------------------------------------
          |        Self-Consistent Charge Iterations        |
           -------------------------------------------------

          ...................................................
          :                      SETUP                      :
          :.................................................:
          :  # basis functions                   2          :
          :  # atomic orbitals                   2          :
          :  # shells                            2          :
          :  # electrons                         2          :
          :  max. iterations                   250          :
          :  Hamiltonian                  GFN2-xTB          :
          :  restarted?                      false          :
          :  GBSA solvation                  false          :
          :  PC potential                    false          :
          :  electronic temp.          300.0000000     K    :
          :  accuracy                    1.0000000          :
          :  -> integral cutoff          0.2500000E+02      :
          :  -> integral neglect         0.1000000E-07      :
          :  -> SCF convergence          0.1000000E-05 Eh   :
          :  -> wf. convergence          0.1000000E-03 e    :
          :  Broyden damping             0.4000000          :
          ...................................................

 iter      E             dE          RMSdq      gap      omega  full diag
   1     -1.0634819 -0.106348E+01  0.258E+00   42.94       0.0  T
   2     -1.0634819  0.222045E-15  0.155E+00   41.95       1.0  T
   3     -1.0634819 -0.222045E-15  0.930E-05   40.46     760.1  T
   4     -1.0634819  0.000000E+00  0.102E-14   40.46  100000.0  T

   *** convergence criteria satisfied after 4 iterations ***

         #    Occupation            Energy/Eh            Energy/eV
      -------------------------------------------------------------
         1        2.0000           -0.5123697             -13.9423 (HOMO)
         2                          0.9744639              26.5165 (LUMO)
      -------------------------------------------------------------
                  HL-Gap            1.4868336 Eh           40.4588 eV
             Fermi-level                  NaN Eh               NaN eV

 SCC (total)                   0 d,  0 h,  0 min,  0.002 sec
 SCC setup                      ...        0 min,  0.000 sec ( 12.071%)
 Dispersion                     ...        0 min,  0.000 sec (  1.010%)
 integral evaluation            ...        0 min,  0.000 sec (  4.150%)
 zeroth order Hamiltonian       ...        0 min,  0.000 sec (  0.800%)
 iterations                     ...        0 min,  0.001 sec ( 53.105%)
 molecular gradient             ...        0 min,  0.001 sec ( 22.322%)
 printout                       ...        0 min,  0.000 sec (  5.421%)

         :::::::::::::::::::::::::::::::::::::::::::::::::::::
         ::                     SUMMARY                     ::
         :::::::::::::::::::::::::::::::::::::::::::::::::::::
         :: total energy              -0.903796715990 Eh    ::
         :: gradient norm              0.618195428146 Eh/a0 ::
         :: HOMO-LUMO gap             40.458802471320 eV    ::
         ::.................................................::
         :: SCC energy                -1.063481891025 Eh    ::
         :: -> isotropic ES            0.000000000000 Eh    ::
         :: -> anisotropic ES          0.003301327998 Eh    ::
         :: -> anisotropic XC          0.005034545628 Eh    ::
         :: -> dispersion             -0.000052182669 Eh    ::
         :: repulsion energy           0.159685175035 Eh    ::
         :: add. restraining           0.000000000000 Eh    ::
         :::::::::::::::::::::::::::::::::::::::::::::::::::::

           -------------------------------------------------
          |                Property Printout                |
           -------------------------------------------------

    * Orbital Energies and Occupations

         #    Occupation            Energy/Eh            Energy/eV
      -------------------------------------------------------------
         1        2.0000           -0.5123697             -13.9423 (HOMO)
         2                          0.9744639              26.5165 (LUMO)
      -------------------------------------------------------------
                  HL-Gap            1.4868336 Eh           40.4588 eV
             Fermi-level                  NaN Eh               NaN eV

     #   Z        covCN         q      C6AA      α(0)
     1   1 H      0.981    -0.000     3.049     2.728
     2   1 H      0.981     0.000     3.049     2.728

 Mol. C6AA /au·bohr⁶  :         12.194547
 Mol. C8AA /au·bohr⁸  :        147.411947
 Mol. α(0) /au        :          5.456705

Wiberg/Mayer (AO) data.
largest (>0.10) Wiberg bond orders for each atom
          total WBO             WBO to atom ...
     1  H   1.000        H    2 1.000
     2  H   1.000        H    1 1.000

molecular dipole:
                 x           y           z       tot (Debye)
 q only:       -0.000       0.000       0.000
   full:       -0.000       0.000       0.000       0.000
molecular quadrupole (traceless):
                xx          xy          yy          xz          yz          zz
 q only:       -0.000       0.000       0.000       0.000       0.000       0.000
  q+dip:        0.401       0.000      -0.201       0.000       0.000      -0.201
   full:        0.161       0.000      -0.081       0.000       0.000      -0.081

           -------------------------------------------------
          | TOTAL ENERGY               -0.903796715990 Eh   |
          | GRADIENT NORM               0.618195428146 Eh/α |
          | HOMO-LUMO GAP              40.458802471320 eV   |
           -------------------------------------------------

------------------------------------------------------------------------
 * finished run on 2020/05/09 at 17:21:31.792
------------------------------------------------------------------------
 total:
 * wall-time:     0 d,  0 h,  0 min,  0.019 sec
 *  cpu-time:     0 d,  0 h,  0 min,  0.098 sec
 * ratio c/w:     5.196 speedup
 SCF:
 * wall-time:     0 d,  0 h,  0 min,  0.003 sec
 *  cpu-time:     0 d,  0 h,  0 min,  0.015 sec
 * ratio c/w:     5.633 speedup

normal termination of xtb
Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG IEEE_UNDERFLOW_FLAG IEEE_DENORMAL

OK, there are still underflow errors, but fine. But now GFN0 is broken:

$ xtb -gfn 0 h2.xyz
...
 * started run on 2020/05/09 at 17:24:51.037

           -------------------------------------------------
          |                Calculation Setup                |
           -------------------------------------------------

          program call               : xtb -gfn 0 h2.xyz
          coordinate file            : h2.xyz
          omp threads                :                     8
          number of atoms            :                     2
          number of electrons        :                     2
          charge                     :                     0
          spin                       :                   0.0
          first test random number   :      0.17011888170285

########################################################################
[WARNING] Please study the warnings concerning your input carefully
-1- argparser_rdxargs: the use of '-gfn' is discouraged, please use '--gfn' next time
########################################################################
           -------------------------------------------------
          |                 G F N 0 - x T B                 |
          | Geometry, Frequencies, Noncovalent interactions |
          |           preliminary parametrisation           |
           -------------------------------------------------
########################################################################
[ERROR] Program stopped due to fatal error
-2- Could not setup parameterisation
-1- prog_main: Parameter file .param_gfn0.xtb not found!
########################################################################
abnormal termination of xtb
ERROR STOP

Error termination. Backtrace:
#0  0x1111ef64b
#1  0x1111f0475
#2  0x1111f1596
#3  0x109d7ac24
#4  0x109d19668
#5  0x109f3fb4e

I would really appreciate some help.

Thanks, -Eugene

ekwan commented 4 years ago

Update: setting XTBPATH to the Anaconda location seems to work, but I'm still getting the precision errors.

$ unset XTBPATH

$ xtb --gfn 2 h2.xyz | grep TOTAL
          | TOTAL ENERGY               -5.176184150977 Eh   |
normal termination of xtb
Note: The following floating-point exceptions are signalling: IEEE_UNDERFLOW_FLAG IEEE_DENORMAL

$ xtb --gfn 0 h2.xyz | grep TOTAL
          | TOTAL ENERGY               -5.297026667160 Eh   |
normal termination of xtb
Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG IEEE_DENORMAL

$ export XTBPATH=/Users/ekwan/anaconda2/envs/presto/share/xtb

$ xtb --gfn 2 h2.xyz | grep TOTAL
          | TOTAL ENERGY               -0.903796715990 Eh   |
normal termination of xtb
Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG IEEE_UNDERFLOW_FLAG IEEE_DENORMAL

$ xtb --gfn 0 h2.xyz | grep TOTAL
          | TOTAL ENERGY               -1.008391404901 Eh   |
normal termination of xtb
Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG IEEE_DENORMAL
awvwgk commented 4 years ago

I'm missing some crucial information to resolve this, but let me guess: /Users/ekwan/software/xtb contains a clone of the GH repository checked out from the current master (which is almost at version 6.3) while you run calculations with the 6.2.3 binary from conda-forge.

This constellation is not going to work, since the current master changes the format of the parameter files, it can detect parameter files with old format and reject those, but the conda-forge build does not know about the new format and will produce garbage. Note that the parameters for GFN1-xTB and GFN2-xTB are compiled into the source code and can be loaded if the XTBPATH does not contain a parameter file, therefore you will get correct results that way.

awvwgk commented 4 years ago

Regarding the floating point exceptions, probably we should do something about this, but since they did not cause any major problems so far, this is low-priority.

ekwan commented 4 years ago

That's right! I've set XTBHOME to the conda location. Is that the correct solution? Should this be done automatically by conda during setup?

I won't worry about the fp problems for now, thanks for clarifying. I really appreciate your rapid responses!

ekwan commented 4 years ago

Thanks for tagging me as "invalid"! 🤣 That's very GATTACA of you! Thanks again.

awvwgk commented 4 years ago

I have to keep overview over tasks and this seems to be a user error.

For conda-forge the parameters should be in /Users/ekwan/anaconda2/share/xtb. Not sure if I can force conda to export environment variables as well, if so, this should be an issue for the xtb-feedstock repository.

awvwgk commented 4 years ago

I fixed most of this issues in ea97c6db42c463b25bd9bda237ee79a332c4f3a3 by avoiding name collisions between new and old parameter files, xtb should now savely fall back to internal parameter files, which is suitable for all methods except for GFN0-xTB. But since we consider GFN0-xTB experimental, this is not going to change and will require manual setup of the XTBPATH for now.

ekwan commented 4 years ago

Thanks!