marrink-lab / vermouth-martinize

Describe and apply transformation on molecular structures and topologies
Apache License 2.0
84 stars 37 forks source link

[VIPR] Parser for [ meta ] information #517

Closed Romumrn closed 1 year ago

Romumrn commented 1 year ago

This PR contains my proposition for parsing block meta. I suggest keeping the format separated by tab or space, the first element will be the key and the rest will be the value(s). Then it allowed the user to add extra information to .itp file, and retrieve it through a dictionary.

Example :

    [ moleculetype ]
      GLY  3
    [ atoms ]
     1 P4 1 ALA BB 1

    [ meta ]
    group protein polymer organic; test
    realname Glycine

Output : ( ff.blocks['GLY'].meta ) {'group': ['protein', 'polymer', 'organic'], 'realname': 'Glycine'}

Romumrn commented 1 year ago

I added a docstring with an example as you can see in the new commit. The way of value is added to the dictionary has been modified, now you can put float/int and it will be converted.

I am a little bit lost in the process of testing, I suppose that I should add a function in test_ffinput.py file? How can I run the test after that?

fgrunewald commented 1 year ago

@Romumrn tests look good; let's wait for approval of @pckroon then we can merge this

Romumrn commented 1 year ago

I have corrected all the typos, I guess! Is it good enough?