Indexing at 0 or 1 for GeomeTRIC integration

Hello, I’m working on enabling geomeTRIC optimizations in place of OptKing in our software that uses psi4.
From the geometric documentation about constraints I had assumed atoms should be indexed at 1. Which was stated on the website “Atoms are numbered sequentially starting from 1.”

However, I’m seeing an error RuntimeError: Constraints refer to higher atom indices than the number of atoms when I try to constrain the last atom in a system.

I assume that we should be indexing at 0 for atom numbers instead and I see now in the Psi4 documentation that there are examples with atom 0 in the constraints.

I’m mostly writing to confirm there is a change in using the psi4 interface to geometric since the difference doesn’t seem to be documented anywhere I can find.

I found this problem in a complex environment for our software, but was able to replicate it in a more simple conda environment (on a linux machine running Ubuntu 20):
conda create -n psi4_example python==3.9 psi4==1.7+6ce35a5 geometric==1.0 numpy==1.21.6 -c psi4 -c conda-forge

With this python script:

import psi4

molecule = psi4.geometry("""
  C            0.833     1.221    -0.504
  H            1.482     2.086    -0.518
  C            1.379    -0.055    -0.486
  H            2.453    -0.184    -0.483
  C            0.546    -1.167    -0.474
  H            0.971    -2.162    -0.466
  C           -0.833    -1.001    -0.475
  H           -1.482    -1.867    -0.468
  C           -1.379     0.275    -0.490
  H           -2.453     0.404    -0.491
  C           -0.546     1.386    -0.506
  H           -0.971     2.381    -0.524
  no_com
  no_reorient
""")

psi4.set_options({
    "maxiter": 100,
    "g_convergence": "gau"
})

geometric_keywords = {
  'coordsys' : 'tric',
  'constraints' : {
  'freeze' : [{'type'    : 'dihedral',
               'indices' : [9, 10, 11, 12]}]
   }
}

psi4.optimize('hf/cc-pvdz', engine='geometric', optimizer_keywords=geometric_keywords)

Yes, that is correct, the psi4 geometric interface should be using 0-indexed atom numbers.

The difference arises since psi4 uses geometric’s JSON API (which is expecting 0-indexed constraints) rather than the input file specification in the geometric docs.

Thanks @philipmnel I had pretty much concluded that from running some simple examples, but its always helpful to know I didn’t misinterpret those results.