removing interactions (again) #548
Closed
csbrasnett
started this conversation in
General
Replies: 1 comment 2 replies
-
...
for molname, block in ff.blocks.items():
for interaction_type in block.interactions:
if interaction_type != 'bonds':
del block.interactions[interaction_type]
#write out the molecule
mol_out = block.to_molecule()
mol_out.meta['moltype'] = molname+'_vis'
with open(molname+'_vis.itp', 'w') as outfile:
write_molecule_itp(mol_out, outfile=outfile)should also work (answering your second question). I'm not sure why your solution wouldn't work though. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I think this is a slight rehash of #482 but it really doesn't seem to be working.
In short, to get cg_bonds working, I'm trying to write a script that takes an input .top file, reads the itps contained, removes all the interactions apart from the bonds, and write some 'visualisation' itps, and a corresponding .top with the full paths. (cg_bonds doesn't like virtual sites, position restraints, etc., so they need to be taken out)
script goes like:
However, it doesn't actually seem to modify the topology in any way. The mysterious thing is if I interactively use
remove_interaction(etc), then it does remove the interaction specified. But it can't do it in a loop for every one in one go. So I'm not sure what's going on. I can't tell as well if removing all the interactions within a directive causes issues as well - would there be a way of removing a whole directive in one go, rather than iterating through the whole thing?python 3.8.7
vermouth==0.9.6
files in the directory:
topol.top
martini_v3.0.0.itp
martini_v3.0.0_solvents_v1.itp
martini_v3.0.0_ions_v1.itp
molecule_0.itp
Beta Was this translation helpful? Give feedback.
All reactions