Skip to content

add outputs to waterdynamics.AngularDistribution ? #21

Description

@yannclaveau

Hello,
The angularDistribution (AD) class gives too "high level" information according to me. Here is what I mean:

I would like to plot a 2D histogram representing $\theta(\mu, \vec{R})$ where $\mu$ is the dipolar moment of water molecules and $\vec{R}$ the radial position with respect to z-axis.
My point is that, I would to see how water molecules are oriented when they are close to the interface (water molecules in a meso-porous material).

I do not see how I can achieve that with angularDistribution (AD). Even if it wasn't exactly what I would like to do, I tried to select atoms near the interface, however the cylayer keywords doesn't select the whole molecules (using it, I do not have 2 H for 1 O). Maybe is there a way to say "if atoms with molecule ID ("resid XXX" in my case) is in cylayer, then select all the atoms with the same molecule ID" ? But still, it would'nt be exactly what I am looking for (but a possible workaround).

I think, it would be more general if AD output could be similar to hbonds class:
<O index, O x-position, O y-position, O z-position, $\theta$&gt;

Then it would be our responsability to plot an histogram, as it is with hbonds, and why not propose the actual AD class as a "higher level" .

For instance, with hbonds, I did this:

for frame, acceptor_ix, *_ in hbonds.results.hbonds:
    u.trajectory[frame.astype(int)]
    acceptor = u.atoms[acceptor_ix.astype(int)]
    R     = np.linalg.norm(acceptor.position[0:2])
    hist, *_ = np.histogram(R, bins=bin_edges)
    counts  += hist * 2  # multiply by two as each hydrogen bond involves two water molecules

vol = 2*np.pi*step*(zhi-zlo)*bin_centers
rhoHB = counts / vol / hbonds.n_frames

I would like to do something similar but with the dipolar-moment orientation.

Thanks,
Yann

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions