from htmd.ui import *
Please cite HTMD: Doerr et al.(2016)JCTC,12,1845.
https://dx.doi.org/10.1021/acs.jctc.6b00049
Documentation: http://software.acellera.com/
To update: conda update htmd -c acellera -c psi4
You are on the latest HTMD version (unpackaged : /home/joao/maindisk/software/repos/Acellera/htmd/htmd).
Molecule
objects can be visualized either with VMD or with NGLview,
a WebGL javascript molecule viewer that can only be used inside Jupyter
Notebooks
By default, VMD is used as a viewer. If one wants to use NGLview, run the following:
from htmd.config import config
config(viewer='webgl')
mol = Molecule('3PTB') # reloading the molecule
mol.view(gui=False)
2018-03-15 15:58:20,956 - htmd.molecule.readers - INFO - Using local copy for 3PTB: /home/joao/maindisk/software/repos/Acellera/htmd/htmd/data/pdb/3ptb.pdb
2018-03-15 15:58:21,671 - htmd.molecule.molecule - WARNING - Residue insertions were detected in the Molecule. It is recommended to renumber the residues using the Molecule.renumberResidues() method.
A Jupyter Widget
It is also possible to apply multiple representations to a Molecule
as in VMD.
Representations use the same names as in VMD, even when using the NGL viewer. Important parameters are: style, color, and sel.
Use the Molecule.view
method, specifying the representation as
arguments. Use the hold
parameter so that following
Molecule.view
calls can overlay. Otherwise, representations will be
cleared on every call.
mol.view(sel='protein', style='NewCartoon', color='Index', hold=True)
mol.view(sel='resname BEN', style='Licorice', color=1)
A Jupyter Widget
Molecule.reps
¶One directly manipulates elements in the reps
property of
Molecule
objects, with the views being stored in that property.
mol.reps.remove() # Clear representations
mol.reps.add(sel='protein', style='NewCartoon', color='Index')
mol.reps.add(sel='resname BEN', style='Licorice', color=1)
print(mol.reps) # Show list of representations (equivalent to mol.reps.list())
mol.view()
rep 0: sel='protein', style='NewCartoon', color='Index'
rep 1: sel='resname BEN', style='Licorice', color='1'
A Jupyter Widget
The following shows the molecule without a 6 Å thick slab in the middle
(−3 Å ≤ x
≤ +3 Å):
mol.reps.remove() # in order to remove the previouly stored representationsb
mol.view(sel='x<-3 or x>3')
A Jupyter Widget
Molecule
provides wrapping and aligning functionality for working
with MD trajectories and improving the visualization.
from htmd.home import home
from os.path import join
molTraj = Molecule(join(home(dataDir='dhfr'), 'dhfr.psf'))
molTraj.read(join(home(dataDir='dhfr'), 'dhfr.xtc'))
molTraj.view()
2018-03-15 16:01:53,699 - htmd.molecule.readers - WARNING - No time information read from /home/joao/maindisk/software/repos/Acellera/htmd/htmd/data/dhfr/dhfr.xtc. Defaulting to 0.1ns framestep.
A Jupyter Widget