marrink-lab / polyply_1.0

Generate input parameters and coordinates for atomistic and coarse-grained simulations of polymers, ssDNA, and carbohydrates
Apache License 2.0
127 stars 24 forks source link

BUG: gen_ff() error reproducer #394

Closed tylerjereddy closed 1 week ago

tylerjereddy commented 1 week ago

I've created a repo at https://github.com/tylerjereddy/polyply_pr_383_repro with a small reproducer that can be run locally to reproduce the gen_ff() function error reported at https://github.com/marrink-lab/polyply_1.0/pull/383#discussion_r1835118580.

Cloning that repository into an appropriate Python environment with the gen_ff_clean branch of polyply (and supporting deps) installed and running python repro.py should reproduce the problem in a manner that provides a bit more traction for debugging:

Traceback (most recent call last):
  File "/home/treddy/rough_work/polyply_pr_383_repro/repro.py", line 20, in <module>
    main()
  File "/home/treddy/rough_work/polyply_pr_383_repro/repro.py", line 14, in main
    gen_ff(itppath=Path("assets/smiles_molecule_GMX_OPLS.top"),
  File "/home/treddy/python_venvs/py_311_hemd/lib/python3.11/site-packages/polyply/src/gen_ff.py", line 90, in gen_ff
    meta_mol = MetaMolecule.from_cgsmiles_str(force_field=force_field,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/treddy/python_venvs/py_311_hemd/lib/python3.11/site-packages/polyply/src/meta_molecule.py", line 424, in from_cgsmiles_str
    atomname = meta_graph.nodes[node]['graph'].nodes[atom]['atomname']
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'atomname'

cc @fgrunewald @pckroon @ricalessandri

tylerjereddy commented 1 week ago

The traceback may vary depending on the supporting dependency versions you happen to be using, but so far my experience is that it will always error out one way or another.

tylerjereddy commented 1 week ago

This appears to be resolved thanks to the cross-linked CGsmiles PR and adjustments Fabian suggested at https://github.com/tylerjereddy/polyply_pr_383_repro/pull/1, so closing.