weberdak / flexible-interaction-tool

FLexible InteRaction Tool (FLIRT) VMD script for summarizing interactions in MD simulations.
1 stars 1 forks source link

ignore bonding feature request #1

Open burunduk57 opened 10 months ago

burunduk57 commented 10 months ago

Dear Daniel,

I found your tool very helpful, thank you. Adding one more feature could be helpful for the analysis of trajectories from QM/MM-MD simulations: ignore bonding. Covalent bonds could be broken and formed during such simulations, and initial bonding from the PSF file becomes irrelevant. Meanwhile, the vmd measure contacts command returns only atoms that are not bonded.

Thank you in advance, Sofya

weberdak commented 10 months ago

Hi Sofya,

It is good to hear that this tool is still getting some good use. As for the feature you suggested, I am I bit short of time these days and won't be able to address it - I moved on from this type of work a few years back. This particular update would also be tricky as I do not have any QM/MM-MD trajectories to test with. However, I am happy for you to fork this repository and add this feature. Submitting a pull request will then allow me to incorporate the code and attribute the contributions to your GitHub account. I can provide some assistance if you get stuck (i.e., having trouble figuring out Git).

The code you will need to add is a block like lines 93 to 98. It does not matter what you do within this block so long as you escape it with lists of all atom indices contributing to the interaction (for that frame) set to the "sel1contr" and "sel2contr" variables. I.e., A list of indices for selection 1 as sel1contr, and a list of indices for selection 2 as sel1contr. For your problem, it would be contacts + bonds. I suspect you will have to create a special "measure_contacts_plus_bonds" function at the bottom of the script (insert at line 498) to call with your new block. As you mentioned, VMD's inbuilt "measure contacts" function will not include bonds. Your case will be tricky, although I think I recall that VMD has a "get bonds" function or something similar you can start at.

Then using the name you set for the mode (i.e., "if { $mode == "contacts_plus_bonds" }"), insert at line 15: if {[lsearch $args "-contacts_plus_bonds"] != -1} { set mode contacts_plus_bonds }

and at line 23: set cpb_cut [ flirt::variable_assign $args "-contacts_plus_bonds" 1 null ]

making sure that the variable name used to represent the contact distance cutoff in your blcok is set as "cpb_cut". Your additions should then work as the other modes do. You may also wish to add an example of its implementation in README.md.

Good luck, Daniel