polyply_1.0 icon indicating copy to clipboard operation
polyply_1.0 copied to clipboard

Error message for undefined atom/bead types

Open ricalessandri opened this issue 1 year ago • 1 comments

Not a bug but possible enhancement.

This is the error one gets if the [ atoms ] contains a atom/bead type S4 that is not defined in the [atomtypes] section:

Traceback (most recent call last):
  File "/Users/alessandri/miniconda3/envs/polyply/bin/polyply", line 258, in <module>
    main()
  File "/Users/alessandri/miniconda3/envs/polyply/bin/polyply", line 254, in main
    subprogram(**args_dict)
  File "/Users/alessandri/miniconda3/envs/polyply/lib/python3.10/site-packages/polyply/src/gen_coords.py", line 246, in gen_coords
    GenerateTemplates(topology=topology, max_opt=10).run_system(topology)
  File "/Users/alessandri/miniconda3/envs/polyply/lib/python3.10/site-packages/polyply/src/processor.py", line 31, in run_system
    mols.append(self.run_molecule(molecule))
  File "/Users/alessandri/miniconda3/envs/polyply/lib/python3.10/site-packages/polyply/src/generate_templates.py", line 366, in run_molecule
    self.gen_templates(meta_molecule)
  File "/Users/alessandri/miniconda3/envs/polyply/lib/python3.10/site-packages/polyply/src/generate_templates.py", line 353, in gen_templates
    self.volumes[resname] = compute_volume(block,
  File "/Users/alessandri/miniconda3/envs/polyply/lib/python3.10/site-packages/polyply/src/generate_templates.py", line 180, in compute_volume
    rad = float(nonbond_params[frozenset([atom_key, atom_key])]["nb1"])
KeyError: frozenset({'S4'})

This error message for this could be improved. Opening this issue to hear your opinion and in case I can try to add an error message.

(P.S. Sorry I need to catch up with a couple of PRs but I'm planning to schedule some closing-open-PRs hackathon soon :))

ricalessandri avatar Feb 03 '23 21:02 ricalessandri