Skip to content

Atom type overflow in Topology due to int8 #78

Description

@bctapia

When generating the fragment input files, I received the error

Traceback (most recent call last):
  File "/home/gridsan/btapia/.conda/envs/polypal/bin/qforce", line 7, in <module>
    sys.exit(run())
             ^^^^^
  File "/home/gridsan/btapia/.conda/envs/polypal/lib/python3.12/site-packages/colt/colt.py", line 363, in __call__
    return self._func(**answers)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/gridsan/btapia/.conda/envs/polypal/lib/python3.12/site-packages/qforce/main.py", line 37, in run
    run_qforce(input_arg=file, config=options)
  File "/home/gridsan/btapia/.conda/envs/polypal/lib/python3.12/site-packages/qforce/main.py", line 49, in run_qforce
    mol = Molecule(config, job, qm_hessian_out, ext_q, ext_lj)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gridsan/btapia/.conda/envs/polypal/lib/python3.12/site-packages/qforce/molecule/molecule.py", line 14, in __init__
    self.topo = Topology(config.ff, qm_out)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gridsan/btapia/.conda/envs/polypal/lib/python3.12/site-packages/qforce/molecule/topology.py", line 31, in __init__
    self._setup(qm_out)
  File "/home/gridsan/btapia/.conda/envs/polypal/lib/python3.12/site-packages/qforce/molecule/topology.py", line 35, in _setup
    self._find_atom_types()
  File "/home/gridsan/btapia/.conda/envs/polypal/lib/python3.12/site-packages/qforce/molecule/topology.py", line 94, in _find_atom_types
    self.atoms[eq] = self.n_types
    ~~~~~~~~~~^^^^
OverflowError: Python integer 128 out of bounds for int8

Which appears to be due to the fact that Q-Force caps the number of atom types at 128 due to using int8.

I propose replacing
self.atoms = np.zeros(self.n_atoms, dtype='int8')
with
self.atoms = np.zeros(self.n_atoms, dtype='int16')
In line 28 of qforce.molecule.topology.py
To remove any chance this error occurs while also attempting to limit memory usage as much as possible. Alternatively, if memory is significantly affected, self.atoms = np.zeros(self.n_atoms, dtype='uint8') could be considered.

My settings script is

[ff]
n_equiv = 4
n_excl = 2
lennard_jones = opls
ext_charges = no
charge_scaling = 1.2
use_ext_charges_for_frags = no
ext_lj_lib =
ext_lj_fudge =
ext_q_fudge =
ext_comb_rule =
ext_h_cap =
all_rigid = no
res_name = MOL

[qm]
software = orca
scan_step_size = 15.0
charge = 0
multiplicity = 1
memory = 120000
n_proc = 32
vib_scaling = 0.97
dihedral_scanner = relaxed_scan

[qm::software(orca)]
charge_method = esp
qm_method_opt = r2SCAN-3c
qm_method_hessian = r2SCAN-3c
qm_method_charge = HF 6-31G*
qm_method_sp = r2SCAN-3c

[scan]
do_scan = yes
avail_only = no
frag_threshold = 3
conj_bo_cutoff = 1.4
break_co_bond = no
method = gromacs
gromacs_exec = /home/gridsan/btapia/programs/gromacs-cpu/bin/gmx_mpi
n_dihed_scans = 15
plot_fit = yes
batch_run = False

[terms]
urey = True
dihedral/rigid = True
dihedral/improper = True
dihedral/flexible = True
dihedral/inversion = True
non_bonded = True

My geometry optimized molecule looks as I expected.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions