marrink-lab / vermouth-martinize

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

Links may be disconnected #310

Open pckroon opened 3 years ago

pckroon commented 3 years ago

When writing links, you could do e.g.

[ link ]
resname $dna_resnames
[ angles ]
BB1 BB2 +BB 2 bb1_bb2_bb {"group": "Backbone linking angles"}
[ dihedrals ]
BB1 BB2 +BB +BB1 2   bb1_bb2_bb_bb1 {"group": "Backbone linking dihedrals"}

which appears sane. But SURPRISE! This will never match your molecule, since the link is disconnected: There is no edge from +BB to +BB1. This is because the dihedral is actually an improper dihedral, and we don't guess the edges for that (see vermouth.molecule::Block.make_edges_from_interactions).

The quick-fix is to issue warning for disconnected items in the Forcefield (Links, blocks, modifications, ...) at the end of parsing. A better solution might be to be smarter about guessing edges (or dumber, so that the expectation is not there?)

jbarnoud commented 3 years ago

Being dumber makes writing links a real pain. I would go for the warning. It also highlights the need for a linter.

pckroon commented 3 years ago

Jup. Alternative: have the behaviour defined by the sections, and don't translate dihedrals with function type 2 to impropers (for which no bonds are made). I.e. the [dihedrals] section makes bonds, but the [impropers] section does not (or different bonds).

jbarnoud commented 3 years ago

That is an option indeed. It will trip users who copy interactions from an ITP file, though. This is to be kept in mind.