<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 molPX Di-Ala example
<pre> 
Guillermo Pérez-Hernández  guille.perez@fu-berlin.de 
</pre>
In this notebook we will be using a trajectory of Di-Ala-peptide to easily identify conformations in the Ramachandran plot.
Step1:  Start from files on disk
Step2:  Visualize a FES and the molecular structures behind it
Execute the following cell and click either on the FES or on the slidebar. Once you get familiar with it, try uncommenting these options and see what happens
Step3:  Visualize trajectories and molecular structures (and the FES, optionally)
Step4:  Repeat from memory
You can load the trajectory data using mdtraj and numpy and use that directly as an input
Step5:  The mpx_wdg_box
It is a class derived from the ipython widgets HBox and VBox, with molPX's extra information as attributes starting with "linked_*"
<ASSISTANT_TASK:>
Python Code:
import molpx
%matplotlib ipympl
Explanation: molPX Di-Ala example
<pre> 
Guillermo Pérez-Hernández  guille.perez@fu-berlin.de 
</pre>
In this notebook we will be using a trajectory of Di-Ala-peptide to easily identify conformations in the Ramachandran plot.
End of explanation
top = molpx._molpxdir(join='notebooks/data/ala2.pdb')
MD_trajfiles = [molpx._molpxdir(join='notebooks/data/ala2.mini.xtc')] #short trajectory
rama_files = [molpx._molpxdir(join='notebooks/data/ala2.mini.phi.psi.dat')]
Explanation: Start from files on disk
End of explanation
mpx_wdg_box = molpx.visualize.FES(MD_trajfiles, 
                                  top,
                                  rama_files,
                                  nbins=50, 
                                  proj_labels=['$\phi$',
                                               '$\psi$'],
                                  atom_selection="symbol != H",
                                  #proj_idxs=[1],
                                  #n_overlays=5,
                                  #sticky=True, 
                                  #color_list='random'
                                 )
mpx_wdg_box
Explanation: Visualize a FES and the molecular structures behind it
Execute the following cell and click either on the FES or on the slidebar. Once you get familiar with it, try uncommenting these options and see what happens:
proj_idxs=[1]
n_overlays=5
sticky=True 
color_list='random'
With sticky option is True, you can see the effect of a right-click on the dots of the FES
End of explanation
from molpx import visualize, _linkutils
from imp import reload
reload(visualize)
reload(_linkutils)
from matplotlib import pyplot as plt
plt.close('all')
mpx_wdg_box = molpx.visualize.traj(MD_trajfiles,  
                                   top, 
                                   rama_files,
                                   plot_FES = True,
                                   proj_labels=['$\phi$', '$\psi$']
                          )
mpx_wdg_box
Explanation: Visualize trajectories and molecular structures (and the FES, optionally)
End of explanation
import numpy as np
import mdtraj as md
MD_trajs = [md.load(fname, top=top) for fname in MD_trajfiles]
phi_psi = [np.loadtxt(fname) for fname in rama_files]
mpx_wdg_box = molpx.visualize.FES(MD_trajs,
                                  top,
                                  phi_psi,
                                  nbins=50,       
                                  proj_labels=['$\phi$',
                                               '$\psi$'],
                                  atom_selection="symbol != H",
                                  #proj_idxs=[1],
                                  #n_overlays=5,
                                  #sticky=True, 
                                  #color_list='random'
                                 )
mpx_wdg_box
Explanation: Repeat from memory
You can load the trajectory data using mdtraj and numpy and use that directly as an input:
End of explanation
for attr in dir(mpx_wdg_box):
    if attr.startswith('linked_'):
        print(attr)
Explanation: The mpx_wdg_box
It is a class derived from the ipython widgets HBox and VBox, with molPX's extra information as attributes starting with "linked_*"
End of explanation
<END_TASK>