tristanic / isolde

Interactive molecular dynamics based model building into low-resolution crystallographic and cryo-EM maps
Other
33 stars 4 forks source link

Rotate instead of tugging #6

Open ajasja opened 2 years ago

ajasja commented 2 years ago

I'm trying to leverage just a small subset of the functionality: I have a model with several domains connected with flexible loops.

I'm trying to rotate a rigid domain, but it's hard to do with tugging only. Is it possible to add an rotate (add torque) mode?

PS: The interactive MD simulation is super cool. I think VMD has this as well, but it's much much harder to set up and here it works out of the box. Really useful for visualization and education purposes.

PPS: Currently I'm using the bond rotation (Right Mouse -> Bond Rotation) feature to rotate the dihedral angles in the flexible linkers. It's a bit cumbersome, but gets the job done eventually:)

tristanic commented 2 years ago

Hmm... that could be a bit tricky to implement. Main challenges I'm thinking:

Certainly rather non-trivial to implement, in any case. A few things you could do right now:

There is another option, which is currently only available with a bit of tinkering in ChimeraX's interactive Python console (Tools/General/Shell). Basically, you can place a copy of the domain you want to rotate in the final target position, and use it to define a set of gentle distance restraints on the corresponding atoms in your main model. It's getting a little late here so I won't explain further now, but let me know if you're interested and I'll elaborate.

Regarding the PS: yep - my initial implementation that was the precursor to ISOLDE was actually implemented based on VMD's interactive MD (see https://www.sciencedirect.com/science/article/pii/S0969212616000071 and https://www.frontiersin.org/articles/10.3389/fphys.2017.00202/full).

ajasja commented 2 years ago

I found the well hidden ui mousemode right "rotate selected atoms". Could part of that be used to get forces (maybe from atom displacements?). But I can see how rotations might not be very useful for crystallographic purposes.

Thank you for isolde restrain distances sel kappa 50! I was looking for a button to do that:) I added strong restraints and moved the domain to it's final position while streching the last bond and the simulation did not explode! The linker sort of got rearranged to a good position, at least good enough for an image.

Out of curiosity, if I placed a copy of the domain at the final positions, would I have to define the restraints manually?

PS: I'm a big VMD/NAMD fan (https://aip.scitation.org/doi/10.1063/1.4866448), especially since the documentation is so good. But TCL did cause me a few sleepless nights. I've switched almost exclusively to PyMol since I joined the Baker lab.

tristanic commented 2 years ago

If you look on the "Right Mouse" tab, there's a "Move atoms" button that gives you essentially the same function - right-click-and-drag translates, pressing shift (after holding down the right mouse button) makes it rotate instead. :)

In general there's quite a bit of functionality that's still only accessible via command, and more still only via the Python shell - designing good GUIs for the more complex functions can be a challenge, and coding time has been a bit short lately. Still, the commands are fairly thoroughly documented - do "usage isolde" to get a list of clickable links in the log to the documentation for all ISOLDE's commands, or click the Help button in the top right of the ISOLDE panel.

Anyway, to set a positioned model as a target for the corresponding fragment of your working model, you'd do something like the following, assuming model #1 is ISOLDE's working model and that the positioned pieces exactly match part of your working model in terms of chain ID and residue range.

In the shell (Tools/General/Shell):

from chimerax.atomic import selected atoms
from chimerax.isolde import session_extensions as sx
m = session.isolde.selected_model
prm = sx.get_position_restraint_mgr(m, create=True)

On the command line, select the CA atoms from the fragment of your working model you want to steer. Something like: sel #1/A:10-100@CA Then in the shell: prs = prm.add_restraints(selected_atoms(session)) Then on the command line, select the target fragment: sel #2/A:10-100@CA In the shell:

target = selected_atoms(session)
prs.targets = target.scene_coords
prs.spring_constants=10
prs.enableds=True

.... and then go ahead and start a simulation. If you need to, you can adjust the strength of the restraints at any time with prs.spring_constants = {new value} or disable them with prs.enableds=False (the results will immediately apply to any running simulation).

I did enjoy working with VMD/NAMD for a while, but pretty quickly ran into a wall in terms of what was easily possible for my purposes. The root of the problem is that NAMD was written as an application rather than a library - in its interactive-MD implementation VMD and NAMD are separate processes, and the only way to communicate with NAMD was to feed it extra precalculated forces from the VMD side. Made lots of things (particularly anything involving large, rapidly-changing forces - e.g. strong position or distance restraints) effectively impossible. What I love about OpenMM is that it was designed from the ground up as a library for use by other developers - simulation and GUI are all in the same process, and I have complete access to micromanage every aspect of the simulation. All the steering forces and restraints applied by ISOLDE are implemented by directly changing the parameters of the force objects in the simulation itself, so OpenMM is always calculating every force component at every timestep ensuring everything remains stable. Vastly increases the range of possibilities.

ajasja commented 2 years ago

I thought it should switch between rotation and movement as well, but when I'm in ISOLDE mode, shift+rightButton only zooms (at least most of the time).

This is working great! (For people reading this later, there is an _ missing in the first import, i.e it should read from chimerax.atomic import selected_atoms)

I agree: OpenMM is fast and convenient and the forcefield support is constantly improving.

Thanks again for taking the time. Should I close the issue or leave it open (so it's easier to discover?)

tristanic commented 2 years ago

It's a bit tricky - you need to right-click first, then​ press shift.

May as well leave it open for now - I might still decide to add a "tug rotate" mouse mode.


From: Ajasja Ljubetič @.> Sent: 23 December 2021 10:26 To: tristanic/isolde @.> Cc: Tristan Croll @.>; Comment @.> Subject: Re: [tristanic/isolde] Rotate instead of tugging (Issue #6)

I thought it should switch between rotation and movement as well, but when I'm in ISOLDE mode, shift+rightButton only zooms (at least most of the time).

This is working great! (For people reading this later, there is an _ missing in the first import, i.e it should read from chimerax.atomic import selected_atoms)

I agree: OpenMM is fast and convenient and the forcefield support is constantly improving.

Thanks again for taking the time. Should I close the issue or leave it open (so it's easier to discover?)

— Reply to this email directly, view it on GitHubhttps://github.com/tristanic/isolde/issues/6#issuecomment-1000199435, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFM54YC3PLP6B55MYWAD2NDUSL2OLANCNFSM5KPUZKFA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.Message ID: @.***>