RMG-Py icon indicating copy to clipboard operation
RMG-Py copied to clipboard

AttributeError: 'Fragment' object has no attribute 'count_internal_rotors'

Open alongd opened this issue 3 years ago • 0 comments

While generating a model, I got the following trace:

Traceback (most recent call last):
  File "/home/alongd/anaconda3/envs/rmg_env/lib/python3.7/site-packages/julia/pseudo_python_cli.py", line 308, in main
    python(**vars(ns))
  File "/home/alongd/anaconda3/envs/rmg_env/lib/python3.7/site-packages/julia/pseudo_python_cli.py", line 59, in python
    scope = runpy.run_path(script, run_name="__main__")
  File "/home/alongd/anaconda3/envs/rmg_env/lib/python3.7/runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "/home/alongd/anaconda3/envs/rmg_env/lib/python3.7/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/home/alongd/anaconda3/envs/rmg_env/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/alongd/Code/RMG-Py/rmg.py", line 118, in <module>
    main()
  File "/home/alongd/Code/RMG-Py/rmg.py", line 112, in main
    rmg.execute(**kwargs)
  File "/home/alongd/Code/RMG-Py/rmgpy/rmg/main.py", line 1026, in execute
    trimolecular_react=self.trimolecular_react)
  File "/home/alongd/Code/RMG-Py/rmgpy/rmg/model.py", line 709, in enlarge
    self.update_unimolecular_reaction_networks()
  File "/home/alongd/Code/RMG-Py/rmgpy/rmg/model.py", line 1918, in update_unimolecular_reaction_networks
    network.update(self, self.pressure_dependence)
  File "/home/alongd/Code/RMG-Py/rmgpy/rmg/pdep.py", line 786, in update
    spec.generate_statmech()
  File "rmgpy/species.py", line 821, in rmgpy.species.Species.generate_statmech
  File "/home/alongd/Code/RMG-Py/rmgpy/data/statmech.py", line 682, in get_statmech_data
    statmech_model = self.get_statmech_data_from_groups(molecule, thermo_model)
  File "/home/alongd/Code/RMG-Py/rmgpy/data/statmech.py", line 716, in get_statmech_data_from_groups
    return self.groups['groups'].get_statmech_data(molecule, thermo_model)
  File "/home/alongd/Code/RMG-Py/rmgpy/data/statmech.py", line 387, in get_statmech_data
    num_rotors = molecule.count_internal_rotors()
AttributeError: 'Fragment' object has no attribute 'count_internal_rotors'

I did not asked for an AFM run (if I understand the error message correctly).

Adding some debug print statements in statmech.py before calling molecule.count_internal_rotors() on line 386, I get:

calling count_internal_rotors()
on type <class 'rmgpy.molecule.fragment.Fragment'>
object: 

The object type passes to molecule is indeed a Fragment instance, but it seems to be empty (i.e., no label nor index).

We should check why a Fragment was passed to statmech, also perhaps why it was formed in the first place.

alongd avatar Jul 18 '22 12:07 alongd