from htmd.ui import *

Building Barnase - Barstar for protein-protein interactions

Download the two proteins and view them

You can look at their PDB information here and find out their PDB IDs. Then download them using those IDs.

You will need to create Molecule objects. Check the documentation on the Molecule class.

barnase = Molecule('2f4y')
barstar = Molecule('2hxx')

Filter the structures to keep only one chain of each

Pick only one chain of each structure. This will keep the crystal waters corresponding to the chosen chain.

barnase.filter('chain A')
barstar.filter('chain A')

Visualize the filtered structures

from ipywidgets.widgets import Box; w = []

Mutate modified residues

Barstar has a modified residue for which we lack the parametrization (check under “Small Molecules” on PDB). Mutate the modified Tryptophan in Barstar (resname 4IN) to a normal Tryptophan (TRP):

barstar.mutateResidue('resname 4IN', 'TRP')

Assignments and renaming

Assign a different chain (A, B) and segment to each protein (BRN, STR):

barnase.set('chain', 'A', 'protein')
barstar.set('chain', 'B', 'protein')
barnase.set('segid', 'BRN')
barstar.set('segid', 'STR')

Since the crystal waters were kept, assign them to segid W1 and W2 (assigning waters of both molecules to the same segid can cause problems as they will have same resids)

barnase.set('segid', 'W1', 'water')
barstar.set('segid', 'W2', 'water')

Combine the proteins and center them

Create a new molecule which will contain both other molecules.

mol = Molecule()

Now center the new combined molecule on the origin.

Solvate the combined system

Find the maximum distance of the atoms from the center:

from htmd.molecule.util import maxDistance
D = maxDistance(mol); print(D)

Add 5 Å to this distance, to add some extra space in the box, and then solvate (no need to add a salt concentration):

D += 5
smol = solvate(mol, minmax=[[-D, -D, -D],[D, D, D]])

Build the solvated system in CHARMM

molbuilt =, outdir='./build/')

Visualize the built system

Can take a while to load…

              color='Secondary Structure', hold=True)