Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-3D RDF calculations #3201

Open
mquevill opened this issue Apr 2, 2021 · 3 comments
Open

Non-3D RDF calculations #3201

mquevill opened this issue Apr 2, 2021 · 3 comments

Comments

@mquevill
Copy link
Contributor

mquevill commented Apr 2, 2021

Describe the solution you'd like

In GROMACS's rdf analysis script, there is an option to calculate with only the x- and y-coordinates (-xy). This is not as simple as zeroing the z-coordinates, since there is a normalization factor that is currently calculated with r^3, but would need to be normalized with r^2.

A more generalized case would allow for any collapsing of coordinates to an arbitrary plane. Or it could even be interesting to extend it to a 1D case, but I have not thought about when that might be useful.

Describe alternatives you've considered

Applying a transformation to the coordinates alone would not work, since the normalization factor is based on spherical shells, not circular shells when ignoring the z-direction.

Additional context

This is useful in certain cases to collapse the z-direction, even with full 3D coordinates. (One example might be with a layered structure and you want to collapse the layers together.) However, it could be useful to apply to 2D simulations where the z-direction doesn't exist or is set to zero (or some other arbitrary value).

@orbeckst
Copy link
Member

The more general case would be to prescribe the normal to the plane that you're mentioning, i.e., doing the RDF in cylindrical coordinates (r, phi, z) for each reference particle and then summing over the z coordinates and the polar angle.

Tangentially related, 2D densities in cylindrical coordinates are also useful. A very long time ago I wrote code to compute cylindrical densities which can be quite useful for looking at water and ions in channels and pores. (I think, GROMACS gmx densmap can do that nowadays.)

 Density of water in hydrophobic nanopores. Molecular dynamics simulations of water in hydrophobic model pores show strong one-dimensional confinement effects on water behaviour. The water density exhibits layering for liquid water (red/orange). Pores of radii smaller than 0.45 nm predominantly contain water vapour (dark blue) although they are still much wider than single water molecules. The density is measured relative to the density of bulk water (1.00 corresponds to nbulk=53.7 mol L-1, SPC water at 300 K and 1 bar). Graphic created with XFarbe

@mquevill
Copy link
Contributor Author

mquevill commented Oct 1, 2021

One possible implementation of this would be to use an rdf_type option like MDAnalysis.analysis.msd.EinsteinMSD() has, where the user could select relevant dimensions. ({'xyz', 'xy', 'yz', 'xz', 'x', 'y', 'z'}) Like MSD, the default would be 'xyz', which returns the standard 3D RDF. This should probably return dim_fac, since the dimensionality (hence volume/area/length scaling changes dimensionality).

This would make it possible to replicate GROMACS's -xy flag, but make it more extensible for any system. Non-orthogonal projections (RDF along an arbitrary plane) would need to be handled by system transformations before being passed to InterRDF().

@hmacdope
Copy link
Member

hmacdope commented Oct 2, 2021

I think this is a great idea!

Sorting out the normalisation factor shouldn't be too hard, then its just a matter of passing a correctly zeroed copy of the coordinates to capped_distance. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants