From: Ajasja Ljubetič (ajasja.ljubetic_at_gmail.com)
Date: Wed Aug 09 2017 - 14:43:31 CDT

Just a thought, do you perhaps have any rotation/translation in the
systems?
If so, you might want to use the fitframes.tcl
<http://www.ks.uiuc.edu/Research/vmd/script_library/scripts/fitframes/>
script to remove them, before averaging.

Best,
Ajasja

On 9 August 2017 at 21:18, 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
>
>
>