saikat pal
unread,Dec 18, 2021, 10:45:48 AM12/18/21Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message as abuse
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to MDnalysis discussion
Dear all,
I am using the following script to calculate the WaterOrientationalRelaxation calculation. Here is the following script:
`import MDAnalysis
from MDAnalysis.analysis.waterdynamics import WaterOrientationalRelaxation as WOR
u = MDAnalysis.Universe("6L1W_nuc.psf", "cum_md1_1-image.dcd")
select = "byres name OH2 and sphzone 6.0 nucleic"
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()
`
However, I am getting the following error :
AttributeError Traceback (most recent call last)
/tmp/ipykernel_3280062/1319508095.py in <module>
9 select = "byres name OH2 and sphzone 6.0 nucleic"
10 WOR_analysis = WOR(Universe, select, 0, 5000, 20)
---> 11 WOR_analysis.run()
12 time = 0
13 #now we print the data ready to plot. The first two columns are WOR_OH vs t plot,
~/softwares/amber20_src/build/CMakeFiles/miniconda/install/envs/mdaenv/lib/python3.8/site-packages/MDAnalysis/analysis/waterdynamics.py in run(self, **kwargs)
582 # later.
583 if self.nproc == 1:
--> 584 selection_out = self._selection_serial(
585 self.universe, self.selection)
586 else:
~/softwares/amber20_src/build/CMakeFiles/miniconda/install/envs/mdaenv/lib/python3.8/site-packages/MDAnalysis/analysis/waterdynamics.py in _selection_serial(self, universe, selection_str)
567 selection = []
568 for ts in ProgressBar(universe.trajectory, verbose=True,
--> 569 total=universe.trajectory.n_frames):
570 selection.append(universe.select_atoms(selection_str))
571 return selection
AttributeError: 'property' object has no attribute 'n_frames'
Please help me out.