Dear all,
I want to perform WaterOrientationalRelaxation. So I have run the following script:
import MDAnalysis
from MDAnalysis import Universe
from MDAnalysis.tests.datafiles import *
from MDAnalysis.analysis.waterdynamics import WaterOrientationalRelaxation as WOR
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
select = "resname WAT and name O and sphzone 5.0 nucleic"
for ts in u.trajectory.n_frames - 1:
WOR_analysis = WOR(Universe, select, 0, 5000, 20)
WOR_analysis.run()
time = 0
#now we print the data ready to plot. The first two columns are WOR_OH vs t plot,
#the second two columns are WOR_HH vs t graph and the third two columns are WOR_dip vs t graph
for WOR_OH, WOR_HH, WOR_dip in WOR_analysis.timeseries:
print("{time} {WOR_OH} {time} {WOR_HH} {time} {WOR_dip}".format(time=time, WOR_OH=WOR_OH, WOR_HH=WOR_HH,WOR_dip=WOR_dip))
time += 1
#now, if we want, we can plot our data
plt.figure(1,figsize=(18, 6))
#WOR OH
plt.subplot(131)
plt.xlabel('time')
plt.ylabel('WOR')
plt.title('WOR OH')
plt.plot(range(0,time),[column[0] for column in WOR_analysis.timeseries])
#WOR HH
plt.subplot(132)
plt.xlabel('time')
plt.ylabel('WOR')
plt.title('WOR HH')
plt.plot(range(0,time),[column[1] for column in WOR_analysis.timeseries])
#WOR dip
plt.subplot(133)
plt.xlabel('time')
plt.ylabel('WOR')
plt.title('WOR dip')
plt.plot(range(0,time),[column[2] for column in WOR_analysis.timeseries])
plt.show()
I am getting error:
TypeError Traceback (most recent call last)
/tmp/ipykernel_599/2936022052.py in <module>
14 select = "resname WAT and name O and sphzone 5.0 nucleic"
15
---> 16 for ts in u.trajectory.n_frames - 1:
17 WOR_analysis = WOR(Universe, select, 0, 5000, 20)
18 WOR_analysis.run()
TypeError: 'int' object is not iterable