<jupyter_start><jupyter_text>The tutorial aims to build a coarse-grained model of the B1 immunoglobulin-binding domain of streptococcal protein G (PDB code 1PGB, further referred to as protein G) that can capture folding-unfolding events. **Task 1** In this task, we will build a structure-based model of protein G and perform a short simulation. We will represent each residue as a single atom with unit mass, with each pair of consecutive atoms connected by a bond. Interactions between atoms are defined as followed: $$V = V_{bond} + V_{angle} + V_{dihedral} + V_{nonbonded}$$$$V_{bond} = \sum_{bond} \frac{Kr}{2} (r - r_0)^2$$$$V_{angle} = \sum{angle} \frac{K_{\theta}}{2} (\theta - \theta_0)^2$$$$V_{dihedral} = \sum_{dihedral} [(1 - cos(\phi - \phi_0)) + 0.5 (1 - cos(3*(\phi - \phi_0))]$$$$V_{nonbonded} = \sum_{native} 5 \left(\frac{r_0}{2}  \right)^{12} - 6\left(\frac{r_0}{2}  \right)^{10} + \sum_{non-native} \left(\frac{\sigma}{r}  \right)^{12}$$   In these equations, $r_0, \theta_0 , \Psi_0$, represent distances, angles and dihedral angles found in native structure. Values for $K_{\theta}, \sigma, K_r$ you can find in seed_notebook. We will build this model using tools provided by the OpenMM package.   **1.1)** You are given a file '1PGB.pdb'. It is a pdb file that contains native structure of protein G. Using mdtraj, create a pdb file that contains only $C\alpha$ atoms and their respective positions. This file represents a topologynof our model. **Hint:** mdtraj.trajectory.atom_slice method may be useful(1 pt).<jupyter_code>from sys import stdout
from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
import numpy as np
import mdtraj as md
import pandas
import matplotlib.pyplot as plt
import nglview
import pdbfixer
#fixer = pdbfixer.PDBFixer(pdbid='1PGB')
#fixer.findMissingResidues()
#print(fixer.missingResidues)

#fixer.findNonstandardResidues()
#print(fixer.nonstandardResidues)

#fixer.findMissingAtoms()
#print(fixer.missingAtoms)
main_pdb = md.load_pdb('1PGB.pdb')
atoms_to_keep = [atom.index for atom in main_pdb.topology.atoms if atom.name == 'CA']
new_pdb = main_pdb.atom_slice(atoms_to_keep)
new_pdb.save('CA_only.pdb')
#atoms, bonds = coord.topology.to_dataframe()
#atoms
#atoms_to_keep = [a.index for a in coord.topology.atoms if a.name == 'CA']
#new_coord = coord.restrict_atoms(atoms_to_keep)
#coord.save('CA-only.pdb')
#atoms, bonds = new_coord.topology.to_dataframe()
#atoms<jupyter_output><empty_output><jupyter_text>**1.2)** Create a simtk.openmm.app.topology.Topology object. Add a chain, all the residues, one CA atom per residue, and bonds between atoms from consecutive residues (1 pt).<jupyter_code>pdb = PDBFile('CA_only.pdb')
#pdb = md.load('CA_only.pdb')
#main_pdb = PDBFile('1PGB.pdb')
forcefield = ForceField('amber99sbildn.xml', 'tip3p.xml')
top = pdb.getTopology()
bonds = list(top.bonds())
for b in bonds:
    names = [b.atom1.name, b.atom2.name]
    if 'CA' in names:
        print(names, b.atom1.index, b.atom2.index)
    else:
        print('no Ca')
top = topology.Topology
chain=top.addChain(id='A')
residue = top.addResidue(MET, 0)
top.addResidue()
system = forcefield.createSystem(pdb.topology)
#integrator = LangevinMiddleIntegrator(300*kelvin, 1/picosecond, 0.004*picoseconds)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1362397820163488, 'fraction_numerical': 0.01725703905540418, 'mean_word_length': 5.198874296435272, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '63537', 'license': 'MIT', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1182, 'n_words': 333, 'path': 'Worksheet8/HW_8.ipynb', 'repo_name': 'mahesh27dx/molecular_phys', 'size': '3303'}