9

You could fool the MDAnalysis RDF function InterRDF by setting an artificial cell of a size large enough so that the periodic boundary conditions don't cause any atom to be counted twice. This can be done by adding the following lines before computing the rdf. It basically creates a cell twice as large as the largest distance in the selected frame of the ...


8

If I understand your question correctly, you are saying that you have seen cases where time is included in the calculation of the radial distribution function (RDF). The RDF itself does not depend on time (and its calculation does not depend on any timestep). That is, the RDF is calculated as an ensemble average, so that either molecular dynamics or monte ...


7

Here's an approach calculating it by hand with numpy. The coordinates are loaded from the trajectory using mdtraj in python: #imports: import mdtraj as md import numpy as np import matplotlib.pyplot as plt #load trajectory: traj = md.load('traj.dcd', top='solvated.pdb') ##You would write this: ##traj = md.load_xtc('md.xtc', top='top.gro') #select oxygen ...


4

Sticking with ase you can use the built-in get_distance function. It supports non-orthogonal unit cells. An example to get the distance between atom number a and atom number b is: import ase.io atom = ase.io.read('your_file.xyz') distance_a_to_b = atom.get_distance(a, b) Additionally if you want to compute the Radial Distribution Function (RDF) and ...


3

Have you tried using the Ovito where there are built in functions to evaluate both RDF and CN of a system? Additionally, it might be possible to use Vesta to convert the unit cell to a rectangular one (see this video). That way you can use your code to do the analysis.


3

Ok, I think I figured out why your code is giving a straight line. This is too big to write as a comment, so I am putting this as answer. At the start of the function, you are determining the edges of the bins of histograms: edges = arange(-S, rMax + 1.1 * dr, dr) So, your edges range between -S and rMax+1.1*dr. From the data you fed to the function, the ...


Only top voted, non community-wiki answers of a minimum length are eligible