Skip to content

waterdynamics does NOT respect PBC #19

Description

@JosipL

(EDIT): The original issue report (see below) indicates that analysis.waterdynamics required PBC-remapped trajectories, which is apparently not clear from the docs. More generally, it should be able to deal with trajectories under PBC directly.


Expected behavior

Hi,
First, I am not sure if this is bug, I just think it is :).
I am using MDAnalysis AngularDistribution library to analyze some water/organic systems. Code produce figure without error but I get a strange peak around costheta=0 for all try types of vectors. I do not expect this peak.
Is due to some 0 dividing? Any ideas?

Code to reproduce the behavior

import MDAnalysis
import matplotlib
from MDAnalysis.analysis.waterdynamics import AngularDistribution as AD
import matplotlib.pyplot as plt

u = MDAnalysis.Universe('../water_oct10mMoctacid10mM_surface.tpr','../trr1.trr')
selection = "byres resname SOL and (prop z < 42)"
bins = 30
AD_analysis = AD(u,selection,bins,axis='z')
AD_analysis.run()
#now we print data ready to graph. The first two columns are P(cos(theta)) vs cos(theta) for OH vector ,
#the seconds two columns are P(cos(theta)) vs cos(theta) for HH vector and thirds two columns
#are P(cos(theta)) vs cos(theta) for dipole vector
#for bin in range(bins):
#      print("{AD_analysisOH} {AD_analysisHH} {AD_analysisDip}".format(AD_analysis.graph0=AD_analysis.graph[0][bin], AD_analysis.graph1=AD_analysis.graph[1][bin],AD_analysis.graph2=AD_analysis.graph[2][bin]))

#and if we want to graph our results
plt.figure(1,figsize=(18, 6))

#AD OH
plt.subplot(131)
plt.xlabel('cos theta')
plt.ylabel('P(cos theta)')
plt.title('PDF cos theta for OH')
plt.plot([float(column.split()[0]) for column in AD_analysis.graph[0][:-1]],[float(column.split()[1]) for column in AD_analysis.graph[0][:-1]])

#AD HH
plt.subplot(132)
plt.xlabel('cos theta')
plt.ylabel('P(cos theta)')
plt.title('PDF cos theta for HH')
plt.plot([float(column.split()[0]) for column in AD_analysis.graph[1][:-1]],[float(column.split()[1]) for column in AD_analysis.graph[1][:-1]])

#AD dip
plt.subplot(133)
plt.xlabel('cos theta')
plt.ylabel('P(cos theta)')
plt.title('PDF cos theta for dipole')
plt.plot([float(column.split()[0]) for column in AD_analysis.graph[2][:-1]],[float(column.split()[1]) for column in AD_analysis.graph[2][:-1]])

plt.savefig('angular.png')

Current version of MDAnalysis

  • Which version are you using? --->2.0.0
  • Which version of Python? ---->Python 3.8.6
  • Which operating system? ---->Linu
    angular_45_55
    x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions