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/Query: reproducer for gen_coords failure with gen_ff_clean branch #396

Closed tylerjereddy closed 1 week ago

tylerjereddy commented 1 week ago

@fgrunewald @pckroon @ricalessandri thanks for all the help with gh-390 so far--I'm now stuck on the last step--generating the final SEBS polymer coordinate file with gen_coords. I ran into an issue over the weekend so I created another minimum viable reproducer repo at https://github.com/tylerjereddy/polyply_gen_coords_sebs_repro where you can run python repro.py in a Python env that has the above polyply branch installed to reproduce the traceback below the fold.

``` Traceback (most recent call last): File "/home/treddy/rough_work/polyply_gen_coords_sebs_repro/repro.py", line 13, in main() File "/home/treddy/rough_work/polyply_gen_coords_sebs_repro/repro.py", line 5, in main gen_coords("assets/topology.top", File "/home/treddy/python_venvs/py_311_hemd/lib/python3.11/site-packages/polyply/src/gen_coords.py", line 266, in gen_coords skip_filter=skip_filter).run_system(topology) ^^^^^^^^^^^^^^^^^^^^ File "/home/treddy/python_venvs/py_311_hemd/lib/python3.11/site-packages/polyply/src/processor.py", line 31, in run_system mols.append(self.run_molecule(molecule)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/treddy/python_venvs/py_311_hemd/lib/python3.11/site-packages/polyply/src/generate_templates.py", line 328, in run_molecule self.gen_templates(meta_molecule, template_graphs) File "/home/treddy/python_venvs/py_311_hemd/lib/python3.11/site-packages/polyply/src/generate_templates.py", line 306, in gen_templates self.volumes[graph_hash] = compute_volume(block, ^^^^^^^^^^^^^^^^^^^^^ File "/home/treddy/python_venvs/py_311_hemd/lib/python3.11/site-packages/polyply/src/generate_templates.py", line 197, in compute_volume rad = float(nonbond_params[frozenset([atom_key, atom_key])]["nb1"]) ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ KeyError: frozenset({'hc'}) ```

Also, feel free to ask me to do some work here--if you think it is a bug and needs a regression test I can try to take a look with some guidance. Or maybe it is just user error?

fgrunewald commented 1 week ago

hi @tylerjereddy the OPLS topology file does not include the same atomtype labels as referenced in the itp file. I think antechamber assign new labels when it generates an OPLS topolgy. If you use the topology from my branch it should work. Let me know if it doesn't.

Since you have all bonded interactions defined in the itp file it should also be OK to just add the missing entries on top of the OPLS force field file. The cross interactions are determined by combination rules anyways.

tylerjereddy commented 1 week ago

@fgrunewald ah very nice, looks like I just need to add smiles_molecule.acpype/smiles_molecule_GMX.itp to my includes and it works, at least for a small test polymer. Ok, I'll close this then, that's basically user error I guess, thanks.