selimsami / qforce

Apache License 2.0
57 stars 13 forks source link

Fragment identification fails when molecule has no hydrogens #54

Closed abigailmoody closed 2 years ago

abigailmoody commented 2 years ago

I was attempting to create a Q-Force FF for a molecule containing no hydrogens and received the following error after the Hessian fitting was completed. The problem is fixable by changing self.cap to self.caps in line 218 of fragment.py, which allows fragment identification to continue correctly.

          ____         ______
         / __ \       |  ____|
        | |  | |______| |__ ___  _ __ ___ ___
        | |  | |______|  __/ _ \| '__/ __/ _ \
        | |__| |      | | | (_) | | | (_|  __/
         \___\_\      |_|  \___/|_|  \___\___|

                     Selim Sami
            University of Groningen - 2020
            ==============================

Selected QM Software: "gaussian"
Necessary Hessian output files and the corresponding extensions are:
- out_file: ['.out', '.log']
- fchk_file: ['.fchk', '.fck']

NOTE: Automatic atom-type determination (used only for LJ interactions) is new. 
      Double check your atom types or enter them manually.

Calculating the MD hessian matrix elements...
Fitting the MD hessian parameters to QM hessian values
Done!

Traceback (most recent call last):
  File "/home/amoody/miniconda3/envs/qforce/bin/qforce", line 8, in <module>
    sys.exit(run())
  File "/home/amoody/miniconda3/envs/qforce/lib/python3.9/site-packages/colt/colt.py", line 363, in __call__
    return self._func(**answers)
  File "/home/amoody/miniconda3/envs/qforce/lib/python3.9/site-packages/qforce/main.py", line 37, in run
    run_qforce(input_arg=file, config=options)
  File "/home/amoody/miniconda3/envs/qforce/lib/python3.9/site-packages/qforce/main.py", line 54, in run_qforce
    fragments = fragment(mol, qm, job, config)
  File "/home/amoody/miniconda3/envs/qforce/lib/python3.9/site-packages/qforce/fragment.py", line 38, in fragment
    frag = Fragment(job, config, mol, qm, atomids, name)
  File "/home/amoody/miniconda3/envs/qforce/lib/python3.9/site-packages/qforce/fragment.py", line 115, in __init__
    self.check_fragment(job, config.scan, mol, qm)
  File "/home/amoody/miniconda3/envs/qforce/lib/python3.9/site-packages/qforce/fragment.py", line 120, in check_fragment
    self.make_fragment_identifier(config, mol, qm)
  File "/home/amoody/miniconda3/envs/qforce/lib/python3.9/site-packages/qforce/fragment.py", line 218, in make_fragment_identifier
    if 1 not in comp_dict.keys() and len(self.cap) > 0:
AttributeError: 'Fragment' object has no attribute 'cap'
selimsami commented 2 years ago

Hi, thanks for this! I pushed an update that should fix it.