marrink-lab / vermouth-martinize

Describe and apply transformation on molecular structures and topologies
Apache License 2.0
89 stars 40 forks source link

Writing Debug PDBs/GRO broken #433

Closed fgrunewald closed 2 years ago

fgrunewald commented 2 years ago

Here we define open only if deferred file writing is true. However, that means open is undefined if it is not because open is declared as local variable.

https://github.com/marrink-lab/vermouth-martinize/blob/16de64e3f391a6ee1d3ed91ddeaa7352eece8e2e/vermouth/pdb/pdb.py#L583-L586

fgrunewald commented 2 years ago

https://github.com/marrink-lab/vermouth-martinize/blob/16de64e3f391a6ee1d3ed91ddeaa7352eece8e2e/vermouth/gmx/gro.py#L143-L145

fgrunewald commented 2 years ago

@pckroon or @jbarnoud : of course we can fix it. However, wouldn't it be more sustainable to make the file writers in the same way as the itp write in the sense that the writer does not open the file but gets handed a file_handle or object that has the write attribute.

pckroon commented 2 years ago

The quick-fix is super simple though (PR is almost ready). I do like your idea, but it represents a change in API, which is annoying/tricky. I'll open the PR, and we can continue the discussion there.