PyEMMA icon indicating copy to clipboard operation
PyEMMA copied to clipboard

To generate pdbs of each clusters at a particular timescale

Open Bazzinga18 opened this issue 3 years ago • 4 comments

Hii, i want to generate pdbs of each microstate at a particular timescale, please help me out. I already tried few codes as i am new to python and pyemma it takes so much time for me to understand, and i am not able to generate the pdb:

clustering = pyemma.coordinates.cluster_kmeans(Y,k=15, fixed_seed=1)
dtrajs = clustering.dtrajs
its = pyemma.msm.its(dtrajs, lags=1000, nits=10, errors='bayes')
pyemma.plots.plot_implied_timescales(its, units='ms', dt=0.4)
msm = pyemma.msm.bayesian_markov_model(dtrajs, lag=20, dt_traj='0.4 ns')
eigenval = msm.eigenvalues()
L=msm.eigenvectors_left(6)
ev0=L[0,:].real
EV = ev0.tolist()
pyemma.coordinates.save_traj(EV, indexes, outfile='ev01.pdb', top=pdb)

so i want to ask what should be the indexes here if i want to generate pdbs at the slowest timeperiod i.e., at ev0? thanks

Bazzinga18 avatar Feb 03 '22 10:02 Bazzinga18

EV is not the right input parameter to save_traj, please see the documentation. You'll want to sample frames for each discrete states (for example with pyemma.util.discrete_trajectories.sample_indexes_by_state) and then based on these indices save trajectories.

clonker avatar Feb 03 '22 10:02 clonker

Okay and what about indexes?

Bazzinga18 avatar Feb 04 '22 07:02 Bazzinga18

Hi, you can give it a numpy array of shape arr.shape == (1, 2) with arr[0, 0] = trajectory_index and arr[0, 1]= frame_index. This you can call in a loop with different output filenames or use save_trajs.

clonker avatar Feb 04 '22 08:02 clonker

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 13 '22 04:08 stale[bot]