Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotate instead of tugging #6

Open
ajasja opened this issue Dec 21, 2021 · 5 comments
Open

Rotate instead of tugging #6

ajasja opened this issue Dec 21, 2021 · 5 comments

Comments

@ajasja
Copy link

ajasja commented Dec 21, 2021

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
Copy link
Owner

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

  • how to determine the direction of the rotation axis? Perpendicular or parallel to the screen? I'm guessing parallel, but would have to experiment to see how that behaves in reality.
  • How to determine the position of the axis? From the centroid of the selected atoms? Or by something fancier that looks for a single rotatable "anchor" bond?

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

  • first, restrain the internal geometry of the model either side of the region you want to rotate (select the residues to restrain as a group, then "isolde restrain distances sel kappa 50" - the "kappa 50" argument makes them quite a bit stronger than the default). This is generally a very good idea when doing this sort of aggressive rearrangement in the absence of a map.
  • Select a series of residues along one side of the domain you want to rotate. Then, with a simulation running, click the button third from bottom left of the ISOLDE panel - this switches to the "tug selection" mouse mode. As the name implies, that'll spread the tugging force evenly over all selected atoms, which tends to make guiding larger domains rather easier.

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
Copy link
Author

ajasja commented Dec 22, 2021

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
Copy link
Owner

tristanic commented Dec 22, 2021

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
Copy link
Author

ajasja commented Dec 23, 2021

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
Copy link
Owner

tristanic commented Dec 23, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants