10-mins of Fame 18.02.2022

OpenMM

In [4]:
import numpy as np
from sys import stdout
from matplotlib import pyplot as plt

from pdbfixer import PDBFixer #pdb preparation

import openmm as mm #openmm
from openmm import unit
import openmm.app as app

from rdkit import Chem
from rdkit.Chem import AllChem

import mdtraj as md #analysing trajectories

from openff.toolkit.topology import Molecule, Topology #generate forcefield parametres for ligand
from openmmforcefields.generators import GAFFTemplateGenerator
In [5]:
pdb_file = 'data/5r7y.pdb'
lig_name = 'JFM'
lig_smiles = 'CS(=O)(=O)NCCc1ccccc1'

Prepare Protein

In [6]:
# clean up the original PDB file and add missing residues and heavy atoms
fixer = PDBFixer(pdb_file)


fixer.removeHeterogens()
fixer.findMissingResidues()

# only add missing residues in the middle of the chain, do not add terminal ones
chains = list(fixer.topology.chains())
keys = fixer.missingResidues.keys()
missingResidues = dict()
for key in keys:
    chain = chains[key[0]]
    if not (key[1] == 0 or key[1] == len(list(chain.residues()))):
        missingResidues[key] = fixer.missingResidues[key]
fixer.missingResidues = missingResidues

fixer.findMissingAtoms()
fixer.addMissingAtoms()
fixer.addMissingHydrogens()
prepared_protein = fixer
Warning: importing 'simtk.openmm' is deprecated.  Import 'openmm' instead.

Prepare Ligand

In [7]:
# split molecule
rdkit_mol = Chem.MolFromPDBFile(pdb_file)
rdkit_mol_split = Chem.rdmolops.SplitMolByPDBResidues(rdkit_mol)

# extract the ligand and remove any already present hydrogens
ligand = rdkit_mol_split[lig_name]
ligand = Chem.RemoveHs(ligand)

# assign bond orders from template
reference_mol = Chem.MolFromSmiles(lig_smiles)
prepared_ligand = AllChem.AssignBondOrdersFromTemplate(reference_mol, ligand)
prepared_ligand.AddConformer(ligand.GetConformer(0))

# protonate ligand
prepared_ligand = Chem.rdmolops.AddHs(prepared_ligand, addCoords=True)

Merge Protein Ligand

Transform rdkit Object to openmm object

In [8]:
# convert RDKit to OpenFF
off_mol = Molecule.from_rdkit(prepared_ligand)

# add name for molecule
off_mol.name = lig_name

# add names for atoms
element_counter_dict = {}
for off_atom, rdkit_atom in zip(off_mol.atoms, rdkit_mol.GetAtoms()):
    element = rdkit_atom.GetSymbol()
    if element in element_counter_dict.keys():
        element_counter_dict[element] += 1
    else:
        element_counter_dict[element] = 1
    off_atom.name = element + str(element_counter_dict[element])

# convert from OpenFF to OpenMM
off_mol_topology = off_mol.to_topology()
mol_topology = off_mol_topology.to_openmm()
mol_positions = off_mol.conformers[0]

# convert units from Ångström to Nanometers
for atom in mol_positions:
    coords = atom / atom.unit
    atom = (coords / 10.0) * unit.nanometers  # since openmm works in nm

# combine topology and positions in modeller object
omm_mol = app.Modeller(mol_topology, mol_positions)

Merge Protein and Ligand

In [9]:
# combine topologies
md_protein_topology = md.Topology.from_openmm(prepared_protein.topology)  # using mdtraj for protein top
md_ligand_topology = md.Topology.from_openmm(omm_mol.topology)  # using mdtraj for ligand top
md_complex_topology = md_protein_topology.join(md_ligand_topology)  # add them together
complex_topology = md_complex_topology.to_openmm()

# combine positions
total_atoms = len(prepared_protein.positions) + len(omm_mol.positions)

# create an array for storing all atom positions as tupels containing a value and a unit
# called OpenMM Quantities
complex_positions = unit.Quantity(np.zeros([total_atoms, 3]), unit=unit.nanometers)
complex_positions[: len(prepared_protein.positions)] = prepared_protein.positions  # add protein positions
complex_positions[len(prepared_protein.positions) :] = omm_mol.positions  # add ligand positions
In [10]:
forcefield = app.ForceField('amber14-all.xml', 'amber14/tip3pfb.xml')
if prepared_ligand is not None:
    gaff = GAFFTemplateGenerator(molecules=Molecule.from_rdkit(prepared_ligand, allow_undefined_stereo=True), )
    forcefield.registerTemplateGenerator(gaff.generator)

Adding Hydrogens and Solvent to Model

In [11]:
# use app.Modeller to add hydrogens and solvent
modeller = app.Modeller(complex_topology, complex_positions)
modeller.addHydrogens(forcefield)
modeller.addSolvent(forcefield, model='tip3p', padding=1.0*unit.nanometers)
app.PDBFile.writeFile(modeller.topology, modeller.positions, open('5r7y_modeller_tip3p.pdb', 'w'))

Preparing Intergrator and Running Simulation

In [9]:
# prepare system and integrator
system = forcefield.createSystem(modeller.topology, nonbondedMethod=app.PME,
    nonbondedCutoff=1.0*unit.nanometers, constraints=app.HBonds, rigidWater=True,
    ewaldErrorTolerance=0.0005)
integrator = mm.LangevinIntegrator(300*unit.kelvin, 1.0/unit.picoseconds,
    2.0*unit.femtoseconds)
integrator.setConstraintTolerance(0.00001)

# prepare simulation
simulation = app.Simulation(modeller.topology, system, integrator, )
simulation.context.setPositions(modeller.positions)

# minimize
print('Minimizing...')
simulation.minimizeEnergy()

# equilibrate for 100 steps
simulation.context.setVelocitiesToTemperature(300*unit.kelvin)
print('Equilibrating...')
simulation.step(100)

# append reporters
simulation.reporters.append(app.DCDReporter('trajectory_tip3p.dcd', 1000))
simulation.reporters.append(app.StateDataReporter(stdout, 1000, step=True,
    potentialEnergy=True, temperature=True, progress=True, remainingTime=True,
    speed=True, totalSteps=250000, separator='\t'))

# run 25 ns of production simulation
print('Running Production...')
simulation.step(250000)
print('Done!')
Minimizing...
Equilibrating...
Running Production...
#"Progress (%)"	"Step"	"Potential Energy (kJ/mole)"	"Temperature (K)"	"Speed (ns/day)"	"Time Remaining"
0.4%	1000	-1122755.932565367	274.0329673891064	0	--
0.8%	2000	-1101973.8735395619	293.98721070629415	7.05	1:41:17
1.2%	3000	-1095705.4426998866	297.890375633914	7.05	1:40:54
1.6%	4000	-1094151.5539369108	299.8767445937728	7.04	1:40:42
2.0%	5000	-1093504.1696920923	300.24883940670645	6.98	1:41:02
2.4%	6000	-1093681.4704212616	300.1507821102161	6.98	1:40:38
2.8%	7000	-1092740.2086221632	300.991021375209	6.97	1:40:25
3.2%	8000	-1092231.290890472	299.0251433735399	6.98	1:39:53
3.6%	9000	-1094262.6814351643	300.06699264222794	6.99	1:39:21
4.0%	10000	-1093738.8888940946	299.3486584274202	6.97	1:39:14
4.4%	11000	-1094696.9647389646	301.1928659607359	6.95	1:39:03
4.8%	12000	-1095874.3320949215	299.80098222736564	6.92	1:39:03
5.2%	13000	-1096276.5572477067	299.02792791965885	6.9	1:38:51
5.6%	14000	-1095557.5841953051	300.322983914261	6.9	1:38:26
6.0%	15000	-1094733.765607295	299.97291981127324	6.91	1:37:54
6.4%	16000	-1094409.3299972503	301.4346883048322	6.92	1:37:25
6.8%	17000	-1093642.223330882	298.76193669393405	6.92	1:36:56
7.2%	18000	-1094875.797664518	300.35605063065043	6.93	1:36:26
7.6%	19000	-1093346.2702468701	300.1832186403381	6.93	1:35:57
8.0%	20000	-1093811.8736345097	300.80016044684675	6.94	1:35:29
8.4%	21000	-1093115.029684347	302.2846418612709	6.94	1:35:02
8.8%	22000	-1094145.466503891	298.52385154917664	6.94	1:34:33
9.2%	23000	-1095120.2332849004	301.0378145975373	6.95	1:34:06
9.6%	24000	-1094708.9379244195	299.18958045850866	6.95	1:33:40
10.0%	25000	-1096049.5873279178	298.88015937850963	6.95	1:33:14
10.4%	26000	-1093512.9236705264	300.81975291777536	6.95	1:32:48
10.8%	27000	-1094530.4378789177	298.6577737851357	6.95	1:32:22
11.2%	28000	-1094844.1910054488	299.0008830198624	6.95	1:31:58
11.6%	29000	-1096145.0454933068	301.511430214558	6.95	1:31:32
12.0%	30000	-1096402.332032059	299.09414544752764	6.95	1:31:06
12.4%	31000	-1096153.2779905458	300.14816629249975	6.96	1:30:39
12.8%	32000	-1094640.9529830073	300.82202864876996	6.95	1:30:16
13.2%	33000	-1094195.815553943	297.5615074350381	6.94	1:30:03
13.6%	34000	-1095537.1914111644	298.4061521275342	6.93	1:29:49
14.0%	35000	-1096607.721609775	298.8065550556045	6.9	1:29:40
14.4%	36000	-1094496.063405735	299.88258737865567	6.89	1:29:28
14.8%	37000	-1093810.289979287	298.4354387306443	6.87	1:29:16
15.2%	38000	-1095864.8325123484	299.98525284209694	6.86	1:29:01
15.6%	39000	-1095925.1142006698	299.13639306468633	6.84	1:28:53
16.0%	40000	-1093505.989074586	300.02632694060077	6.82	1:28:41
16.4%	41000	-1095867.6785191044	299.5699617346386	6.81	1:28:19
16.8%	42000	-1095227.9435123922	299.0912452636824	6.82	1:27:52
17.2%	43000	-1093907.7722539315	299.1482753706961	6.82	1:27:25
17.6%	44000	-1094476.7000072787	300.9239791310899	6.82	1:26:57
18.0%	45000	-1096512.7845761492	300.3481007005003	6.82	1:26:37
18.4%	46000	-1094564.5923530355	302.0729645728394	6.8	1:26:24
18.8%	47000	-1093914.3608243093	300.6733282602087	6.79	1:26:07
19.2%	48000	-1093967.4640865547	299.3989347700738	6.78	1:25:45
19.6%	49000	-1093200.4106791879	298.82583686211876	6.78	1:25:19
20.0%	50000	-1094314.1899724226	300.9790138632953	6.78	1:24:57
20.4%	51000	-1094788.3969266044	301.1961177173435	6.78	1:24:31
20.8%	52000	-1094919.2538468551	300.0572133181901	6.78	1:24:03
21.2%	53000	-1096085.844448278	301.53169257697135	6.79	1:23:36
21.6%	54000	-1095477.8284504423	299.8818391584348	6.79	1:23:08
22.0%	55000	-1093514.5072611964	300.05142474130406	6.79	1:22:41
22.4%	56000	-1093849.942832521	302.4865012605786	6.79	1:22:14
22.8%	57000	-1094053.7186276263	298.8272384465621	6.8	1:21:46
23.2%	58000	-1095040.6830720964	300.72135931815353	6.8	1:21:19
23.6%	59000	-1094261.637372745	298.8097711589621	6.8	1:20:52
24.0%	60000	-1092751.8504283086	300.4878039217502	6.8	1:20:25
24.4%	61000	-1093647.2225246439	302.27777332130887	6.81	1:19:58
24.8%	62000	-1094316.2085426585	300.2512669623144	6.81	1:19:32
25.2%	63000	-1094686.7682640904	301.6621860118392	6.81	1:19:05
25.6%	64000	-1095373.9505937807	300.8809074129215	6.81	1:18:38
26.0%	65000	-1094939.1648325634	300.19076257019907	6.81	1:18:12
26.4%	66000	-1093945.6390610365	300.25283507537915	6.82	1:17:45
26.8%	67000	-1094627.2460977149	301.30452350808275	6.82	1:17:19
27.2%	68000	-1095402.9010799455	298.8034891516107	6.82	1:16:52
27.6%	69000	-1095474.8839454732	300.4930213964348	6.82	1:16:26
28.0%	70000	-1096644.5367664383	299.09430331538607	6.82	1:15:59
28.4%	71000	-1095021.7602195996	299.5292025904541	6.82	1:15:33
28.8%	72000	-1094954.333970098	299.68702067796795	6.82	1:15:07
29.2%	73000	-1092634.686956322	300.80407227115893	6.83	1:14:40
29.6%	74000	-1094493.3143900172	298.7226935735223	6.83	1:14:14
30.0%	75000	-1094555.5430339898	301.2913101698791	6.83	1:13:48
30.4%	76000	-1095697.7790801513	300.6862209797937	6.83	1:13:22
30.8%	77000	-1097490.7310917615	301.35682549402645	6.83	1:12:56
31.2%	78000	-1096066.15337938	300.29047747742385	6.83	1:12:30
31.6%	79000	-1095724.0936522016	299.8490658022063	6.83	1:12:04
32.0%	80000	-1093619.7045819818	299.6478861832632	6.83	1:11:38
32.4%	81000	-1094803.8681790999	300.51269370442384	6.83	1:11:12
32.8%	82000	-1095092.453247477	299.0066425682965	6.84	1:10:46
33.2%	83000	-1095378.6818461546	299.03651548963654	6.84	1:10:20
33.6%	84000	-1096114.3887918696	300.23528696387547	6.84	1:09:54
34.0%	85000	-1096046.3441043424	297.86722422943944	6.84	1:09:29
34.4%	86000	-1094960.4263109735	298.5920771069908	6.84	1:09:03
34.8%	87000	-1096126.470052817	299.8293405866555	6.84	1:08:37
35.2%	88000	-1095672.2300862605	299.132990645477	6.84	1:08:11
35.6%	89000	-1096501.5724478592	299.01011361126814	6.84	1:07:46
36.0%	90000	-1094156.3706916727	299.7310559905932	6.84	1:07:20
36.4%	91000	-1095459.123199285	298.32011980429314	6.84	1:06:54
36.8%	92000	-1094362.988309104	301.2955034805049	6.84	1:06:29
37.2%	93000	-1095858.5635914148	301.16110088440763	6.85	1:06:03
37.6%	94000	-1095180.9841976615	301.1524447180404	6.85	1:05:38
38.0%	95000	-1094906.9780310006	300.5854964734422	6.84	1:05:15
38.4%	96000	-1094568.9370856178	299.39071197609934	6.83	1:04:53
38.8%	97000	-1095608.221515454	300.33625335965746	6.83	1:04:32
39.2%	98000	-1093307.9822501969	300.464593102703	6.83	1:04:08
39.6%	99000	-1093964.8121474865	300.28652730292595	6.83	1:03:43
40.0%	100000	-1095365.9168202179	299.05963579432023	6.82	1:03:17
40.4%	101000	-1094638.0750593783	301.58907475925344	6.82	1:02:52
40.8%	102000	-1094156.876314692	300.6873674742839	6.82	1:02:27
41.2%	103000	-1092441.6045497959	300.7575178058138	6.82	1:02:02
41.6%	104000	-1095227.5707916932	300.43537508479017	6.82	1:01:37
42.0%	105000	-1095682.604265466	299.87551724446155	6.82	1:01:12
42.4%	106000	-1097708.9876353347	300.0821142518925	6.82	1:00:47
42.8%	107000	-1094136.4551118477	298.6621449778417	6.82	1:00:21
43.2%	108000	-1094283.2323350648	298.8252498861997	6.82	59:56
43.6%	109000	-1096854.676596227	301.41949089408587	6.82	59:30
44.0%	110000	-1095118.2879792152	300.12141615388254	6.82	59:05
44.4%	111000	-1095740.1288699592	300.7181597400873	6.82	58:39
44.8%	112000	-1094803.3200248827	299.0581334799749	6.83	58:13
45.2%	113000	-1095001.197485304	301.71378365165083	6.83	57:48
45.6%	114000	-1093634.7392380731	300.50773127235294	6.83	57:22
46.0%	115000	-1095182.1306795597	300.14433022622785	6.83	56:57
46.4%	116000	-1095465.749414532	299.9607849742649	6.83	56:31
46.8%	117000	-1094774.501075976	300.2684484476463	6.83	56:05
47.2%	118000	-1093990.6082890602	302.0108209193768	6.83	55:40
47.6%	119000	-1093272.3778335913	299.2873993731181	6.83	55:14
48.0%	120000	-1093712.5523901493	298.6327223547546	6.83	54:49
48.4%	121000	-1093740.3930066845	299.13683089650755	6.83	54:23
48.8%	122000	-1094333.2275463752	299.6484203689672	6.83	53:58
49.2%	123000	-1093573.4634094522	300.1953478587191	6.83	53:33
49.6%	124000	-1095427.156592956	301.33476962567494	6.83	53:07
50.0%	125000	-1094570.0413787463	299.9731171787756	6.83	52:42
50.4%	126000	-1096603.8787973518	299.9864449217892	6.83	52:16
50.8%	127000	-1095773.6873205353	298.1632915058668	6.83	51:51
51.2%	128000	-1095227.8350537806	301.4071233572776	6.83	51:25
51.6%	129000	-1094226.0795927814	300.1663545726595	6.83	51:00
52.0%	130000	-1095296.065707899	300.47788101290075	6.83	50:34
52.4%	131000	-1093494.5283922984	299.83784044593096	6.83	50:09
52.8%	132000	-1095526.5924983264	301.1039011213985	6.83	49:43
53.2%	133000	-1095822.1116108352	300.82336477684646	6.83	49:18
53.6%	134000	-1094411.1139726203	302.1814046633693	6.83	48:53
54.0%	135000	-1095269.4336000835	301.7300077681624	6.83	48:27
54.4%	136000	-1095854.013966145	301.11350183110477	6.83	48:02
54.8%	137000	-1093036.207838801	300.4262922781443	6.83	47:37
55.2%	138000	-1094305.0912153143	301.6441641715243	6.83	47:11
55.6%	139000	-1095130.9865617212	301.2435797264196	6.83	46:46
56.0%	140000	-1094870.492612099	298.89991532314315	6.83	46:21
56.4%	141000	-1095103.186062186	300.46421892620793	6.84	45:55
56.8%	142000	-1094097.785831217	297.4326100407198	6.84	45:30
57.2%	143000	-1096476.3988117045	299.19831855583993	6.84	45:04
57.6%	144000	-1097091.0248864614	299.3987593422502	6.84	44:39
58.0%	145000	-1095248.9677703087	298.3656664378019	6.84	44:14
58.4%	146000	-1094703.6148260229	299.84058772455205	6.84	43:48
58.8%	147000	-1095930.1419903242	298.60908682060284	6.84	43:23
59.2%	148000	-1096101.414553867	299.3094036170249	6.84	42:57
59.6%	149000	-1096921.5498528332	299.4343257946864	6.84	42:32
60.0%	150000	-1095926.7226365106	299.9790158895088	6.84	42:07
60.4%	151000	-1095778.1095133552	299.17046980709785	6.84	41:41
60.8%	152000	-1095207.6016911343	300.88741953930366	6.84	41:16
61.2%	153000	-1096153.1551777453	298.8721222893333	6.84	40:51
61.6%	154000	-1097707.6593431786	300.6795420326817	6.84	40:25
62.0%	155000	-1094709.0794983143	300.48586299960147	6.84	40:00
62.4%	156000	-1093942.3787095654	298.3847382649255	6.84	39:35
62.8%	157000	-1095338.2279094302	301.76590429148075	6.84	39:09
63.2%	158000	-1095615.877401171	300.5990840148877	6.84	38:44
63.6%	159000	-1094241.231574148	299.61602487597764	6.84	38:19
64.0%	160000	-1094869.5435002355	301.53247234028623	6.84	37:53
64.4%	161000	-1095329.4711355306	300.38621222740875	6.84	37:28
64.8%	162000	-1093627.0964701048	301.9336509875492	6.84	37:03
65.2%	163000	-1094411.0092419363	298.56549072386457	6.84	36:37
65.6%	164000	-1093978.1876693	300.4146813266168	6.84	36:12
66.0%	165000	-1094544.068923982	301.5370920815765	6.84	35:47
66.4%	166000	-1095503.3221423654	300.24121537461525	6.84	35:21
66.8%	167000	-1095142.465775981	300.37088748857536	6.84	34:56
67.2%	168000	-1095665.830442512	300.264850027693	6.84	34:31
67.6%	169000	-1095513.6623101742	298.3311820247633	6.84	34:06
68.0%	170000	-1093825.5440076645	299.5298880798719	6.84	33:40
68.4%	171000	-1092637.0053979342	299.59941316687514	6.84	33:15
68.8%	172000	-1092789.5641195558	300.6630111931473	6.84	32:50
69.2%	173000	-1095406.2012038436	299.19223646763555	6.84	32:24
69.6%	174000	-1096181.4145284733	301.2310976226378	6.84	31:59
70.0%	175000	-1095850.7867718192	299.97022105234566	6.84	31:34
70.4%	176000	-1093860.4200203293	300.16817696767015	6.84	31:08
70.8%	177000	-1094431.1622424265	299.32715732268207	6.84	30:43
71.2%	178000	-1093414.125612163	299.393948412869	4.05	51:15
71.6%	179000	-1093922.7189239485	301.3131839316526	4.05	50:25
72.0%	180000	-1094027.5521500462	301.0134317568301	4.06	49:36
72.4%	181000	-1095091.9906402312	301.5664260012122	4.07	48:47
72.8%	182000	-1093769.967390918	300.0931266531221	4.08	47:58
73.2%	183000	-1094567.5982249146	300.08573784989727	4.09	47:10
73.6%	184000	-1094601.229457193	299.6171525789713	4.1	46:22
74.0%	185000	-1094130.2851115987	301.9740301365893	4.11	45:34
74.4%	186000	-1094701.6176513908	300.6297198336224	4.12	44:46
74.8%	187000	-1093297.0743170888	299.5378561067239	4.13	43:59
75.2%	188000	-1095495.1530499535	302.0597996302589	4.13	43:11
75.6%	189000	-1095349.0986298204	297.3976189133717	4.14	42:24
76.0%	190000	-1093661.596910564	300.4159052629012	4.15	41:37
76.4%	191000	-1095581.2146312948	300.92851783147404	4.16	40:51
76.8%	192000	-1095572.2830193667	300.0657602610514	4.17	40:04
77.2%	193000	-1096627.1714686065	300.7294089815221	4.18	39:18
77.6%	194000	-1095332.625654314	299.2386314442118	4.18	38:32
78.0%	195000	-1094415.926342837	297.20225680936034	4.19	37:46
78.4%	196000	-1094025.4898495057	300.96978358598426	4.2	37:01
78.8%	197000	-1094182.4154859688	300.3699143945218	4.21	36:15
79.2%	198000	-1092451.4017892666	298.2946206065923	4.22	35:30
79.6%	199000	-1094717.5311000654	299.4473141682552	4.22	34:46
80.0%	200000	-1093401.911995886	297.57057668034236	4.23	34:01
80.4%	201000	-1094637.4829486245	300.9269503842278	4.24	33:16
80.8%	202000	-1093951.498011433	302.0196418753137	4.25	32:32
81.2%	203000	-1095212.9197744383	302.6049046589721	4.26	31:47
81.6%	204000	-1095623.9352544202	300.20211764557047	4.26	31:03
82.0%	205000	-1095974.6432297728	299.1318562229291	4.27	30:19
82.4%	206000	-1095776.3838356936	300.10116024011796	4.28	29:36
82.8%	207000	-1094672.434861072	300.99239290424856	4.29	28:53
83.2%	208000	-1092912.5757449549	301.3361805118574	4.29	28:09
83.6%	209000	-1093148.9076511697	300.3632754338494	4.3	27:26
84.0%	210000	-1093934.7671273446	300.5029162474983	4.31	26:43
84.4%	211000	-1095476.8104342436	300.612865142059	4.32	26:01
84.8%	212000	-1093274.8004625319	299.0063287923394	4.32	25:18
85.2%	213000	-1095650.7850894101	302.0018972880471	4.33	24:35
85.6%	214000	-1095012.0128579992	299.7717557640246	4.34	23:53
86.0%	215000	-1095574.1028965956	299.90982503384726	4.35	23:11
86.4%	216000	-1096855.9903507507	300.89305878169245	4.35	22:29
86.8%	217000	-1095546.5162079942	299.7483810178742	4.36	21:47
87.2%	218000	-1094701.660801582	300.31435082913487	4.37	21:06
87.6%	219000	-1095325.0219051023	299.53203477825775	4.37	20:24
88.0%	220000	-1093902.3636939398	299.3769626876038	4.38	19:43
88.4%	221000	-1094111.8707987843	299.9511840814629	4.39	19:01
88.8%	222000	-1095300.3469410466	302.50062857084066	4.4	18:20
89.2%	223000	-1096093.9277909894	300.7212616803555	4.4	17:39
89.6%	224000	-1095215.0729849804	298.0244755397397	4.41	16:58
90.0%	225000	-1095272.7979970165	301.00021125256177	4.42	16:18
90.4%	226000	-1094278.8622498326	298.5242496603758	4.42	15:37
90.8%	227000	-1094843.07592834	298.42558248728506	4.43	14:57
91.2%	228000	-1095600.2518896135	300.11337088773297	4.44	14:16
91.6%	229000	-1094676.9921861466	299.016426515066	4.44	13:36
92.0%	230000	-1094648.0329054615	298.8642252052825	4.45	12:56
92.4%	231000	-1093972.02721796	300.9358202633708	4.46	12:16
92.8%	232000	-1095092.4649000086	300.50104813906904	4.46	11:36
93.2%	233000	-1094237.1316097775	300.69199875087844	4.47	10:57
93.6%	234000	-1093189.3005817535	299.81416242255085	4.47	10:17
94.0%	235000	-1093893.80438754	299.3529281960073	4.48	9:38
94.4%	236000	-1094990.2310119737	297.9802614734642	4.49	8:59
94.8%	237000	-1095221.2346813236	301.2872817733164	4.49	8:20
95.2%	238000	-1096005.5465098724	301.33192379411963	4.5	7:41
95.6%	239000	-1094119.000663538	298.7494490255977	4.5	7:02
96.0%	240000	-1095407.107767177	300.77065517220177	4.51	6:23
96.4%	241000	-1095840.1768889567	300.92035387529637	4.51	5:44
96.8%	242000	-1095232.0296667323	299.88729820944224	4.52	5:06
97.2%	243000	-1093890.7097726634	299.7238794445933	4.52	4:27
97.6%	244000	-1094981.137997034	299.90149068383465	4.53	3:49
98.0%	245000	-1094716.0127485017	298.87057733495436	4.53	3:10
98.4%	246000	-1095858.2146069596	300.88869838077454	4.54	2:32
98.8%	247000	-1095948.406550927	299.2563403193147	4.54	1:54
99.2%	248000	-1096688.1922977674	298.6176350118551	4.55	1:15
99.6%	249000	-1094697.4414457588	299.0854744397614	4.55	0:37
100.0%	250000	-1094161.3168996745	297.76321786236946	4.56	0:00
Done!
In [14]:
traj  = md.load_dcd('trajectory_tip3p.dcd', '5r7y_modeller_tip3p.pdb')
traj = traj.atom_slice(traj.top.select(f'protein or resname {lig_name}'))

# calculate RMSD to first frame and plot figure
rmsd = md.rmsd(traj, traj)

plt.figure()
plt.plot(rmsd)
plt.title('RMSD to first frame')
plt.xlabel('Frame (0.1 ns/frame)')
plt.ylabel('RMSD (nm)')
plt.savefig('rmsd.png', dpi=300)
plt.show()
plt.close()

PyMol

  • PyMOL is a free 3D graphics software used to display biomolecules in biochemistry and bioinformatics.
  • Most important rescource: PyMolWiki
  • Since PyMol is based on Python, it is relatively easy to write scripts for PyMol.
  • Scripting in general:
    1. Define a function in python
    2. Add cmd.extend("doSimpleThing",doSimpleThing) to python script
    3. Run python script in PyMol command line: run mySampleScript.py
    4. Now all extended functions are available (doSimpleThing)
  • All commands in pymol are available over the cmd function from pymol import cmd
  • The stored array can be used to get data from PyMol into our script from pymol import stored
In [ ]: