1
1
import MDAnalysis as mda
2
+ import matplotlib .pyplot as plt
3
+ plt .rcParams ["font.family" ] = "serif"
4
+ plt .rcParams ["mathtext.fontset" ] = "dejavuserif"
5
+
2
6
3
7
class ResidueAnalysis :
4
8
"""
@@ -64,13 +68,28 @@ def get_two_torsions(self, dihedral1=[], dihedral2=[], verbose=False):
64
68
for ts in self .u .trajectory :
65
69
torsions1 .append (selection1 .dihedral .value ())
66
70
torsions2 .append (selection2 .dihedral .value ())
71
+
72
+ # Combine the index numbers, times, and torsions
73
+ torsions_h = []
74
+ steps = []
75
+ for i , t , d1 , d2 in zip (range (self .n_frames ), self .times , torsions1 , torsions2 ):
76
+ torsions_h .append ([i , t , d1 , d2 ])
77
+ steps .append (i )
78
+
79
+ # Plot the torsions on a 2D plot
80
+ fig , ax = plt .subplots (figsize = (7 ,5 ), dpi = 200 )
81
+ sca = ax .scatter (torsions1 , torsions2 , c = steps , cmap = 'cividis' , s = 15 )
82
+ # Add colorbar
83
+ cbar = fig .colorbar (sca , label = 'Frame' )
84
+ ax .set_xlabel (f'{ dihedral1 [0 ]} -{ dihedral1 [1 ]} -{ dihedral1 [2 ]} -{ dihedral1 [3 ]} [deg]' )
85
+ ax .set_ylabel (f'{ dihedral2 [0 ]} -{ dihedral2 [1 ]} -{ dihedral2 [2 ]} -{ dihedral2 [3 ]} [deg]' )
86
+ ax .set_title (f'Torsions: { dihedral1 [0 ]} -{ dihedral1 [1 ]} -{ dihedral1 [2 ]} -{ dihedral1 [3 ]} and { dihedral2 [0 ]} -{ dihedral2 [1 ]} -{ dihedral2 [2 ]} -{ dihedral2 [3 ]} ' )
87
+
88
+
89
+ # Save the plot
90
+ fig .savefig (f'{ self .resid } _{ dihedral1 [0 ]} -{ dihedral1 [1 ]} -{ dihedral1 [2 ]} -{ dihedral1 [3 ]} _{ dihedral2 [0 ]} -{ dihedral2 [1 ]} -{ dihedral2 [2 ]} -{ dihedral2 [3 ]} .png' )
67
91
68
92
if verbose :
69
- # Combine the index numbers, times, and torsions
70
- torsions_h = []
71
- for i , t , d1 , d2 in zip (range (self .n_frames ), self .times , torsions1 , torsions2 ):
72
- torsions_h .append ([i , t , d1 , d2 ])
73
-
74
93
# Print the output out line by line
75
94
for i , t , d1 , d2 in torsions_h :
76
95
print (f"Frame { i } at time { t } ps is { d1 :.1f} deg and { d2 :.1f} deg." )
@@ -96,6 +115,7 @@ def get_rmsd(self, reference):
96
115
97
116
# Directory and title
98
117
dir1 = '/biggin/b222/catz0163/pept/dynamics/pept_holo/pept_AF_H87P_D342P_v2/qmmm'
118
+ dir1 = '/Users/nfo24278/Documents/dphil/proton_transfer/PyCEC/simulations/pept_AF_H87P_D342P'
99
119
title1 = 'PepT2 with AF H87P D342P'
100
120
101
121
# Load the universe
0 commit comments