From: Chris Ing (ing.chris_at_gmail.com)
Date: Wed Aug 09 2017 - 15:18:25 CDT

Introductory VMD users may not realize that these distortions are often
caused by low temporal resolution of the trajectory they are trying to
smooth.

If you want accurate visualization of smoothed trajectories you should be
finely sampling your raw MD data when viewing it in VMD.

What you want to visualize determines how often you save. If you only care
about the backbone, you can probably smooth trajectories spaced at dt=1 ns,
if you want to see smoothed positions of ions or side chains heavy atoms
you'll need more data. If you want side chain hydrogens that don't look
ridiculous, well, that'll require lots of frames!

On Wed, Aug 9, 2017 at 3:18 PM, Albert <mailmd2011_at_gmail.com> wrote:

> I saved your script as a python file then run it in VMD tcl shell:
>
> gopython smooth.py
>
> But both protein and ligand are still distorted.
>
> On 08/09/2017 09:01 PM, Robin Betz wrote:
>
> I use VMD with the Python interpreter to apply smoothing functions to the
> coordinates in-memory.
> Here's an implementation of the Savitsky-Golay filter which I find
> distorts rotating rings (Phe, etc) less than the built-in averaging. You
> can probably do the same with the tcl interface, but I'm not quite so
> familiar with its available functionality.
>
> import numpy as np
> from scipy.signal import savgol_filter
> def smooth_savitsky_golay(molid, window=5, polyorder=3):
> smoother = np.empty((molecule.numframes(molid),
> molecule.numatoms(molid)*3))
> print smoother.shape
> for t in range(molecule.numframes(molid)):
> smoother[t] = vmdnumpy.timestep(molid, t).flatten()
>
> smoothed = savgol_filter(smoother, window, polyorder, axis=0,
> mode="nearest")
>
> for t in range(molecule.numframes(molid)):
> conv = smoothed[t].reshape((molecule.numatoms(molid), 3))
> np.copyto(vmdnumpy.timestep(molid, t), conv)
>
> Hope this helps,
> Robin
>
>
>