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

Possible error in transport analysis? #55

Open
orionarcher opened this issue Sep 22, 2024 · 4 comments
Open

Possible error in transport analysis? #55

orionarcher opened this issue Sep 22, 2024 · 4 comments

Comments

@orionarcher
Copy link
Collaborator

orionarcher commented Sep 22, 2024

I am working on a benchmark of viscosity. As part of this, I am comparing viscosity values of common electrolyte solvents to references in the literature. Strangely, I am getting an inverse trend, shown below. The values are in mPa s, the only data transformation I did was to change the units from Pa s to mPa s. Reference values are on the y axis.

image

As an experiment, I tried comparing the calculated data against the inverse of the reference data and the trend looks much better.

image

Obviously, there is a lot that could be causing this on the MD side but the workflow is reasonably rigorous. The viscosity is calculated from a 2 ns production run following 1.5 ns NPT and annealing, each data point is averaged over 5 replicates, linear fit window from 0.4 ns to 1.6 ns, 9 nm nonbonded cutoff. The fact that the order of magnitude is correct and the trend is wrong is very surprising, the opposite of what I'd expect. @hmacdope, I'm curious if you have any thoughts here? I've scoured the code and can't find any mistakes.

The non-log-log plots:

image image
@orionarcher orionarcher changed the title Molecular dynamics or transport analysis is broken Possible error in transport analysis? Sep 22, 2024
@hmacdope
Copy link
Member

hmacdope commented Sep 24, 2024

@orionarcher curious, I think your instincts are right that this is most likely a systematic error of some kind.

  1. Did you use unwrapped trajectories? Worth trying with unwrapped positions.

  2. Only thing I could spot from reading the code is that the reference we used for the implementation: https://iopscience.iop.org/article/10.1088/1742-6596/653/1/012106/pdf (eq.6 ) disagrees with https://livecomsjournal.org/index.php/livecoms/article/view/v1i1e6324/937 (Table 2), with the position of V in the prefactor (although included in subtext). I could be missing something, but https://arxiv.org/pdf/cond-mat/0701253 also agrees with Kirova & Norman, perhaps with $V_{inf}$ we need to remove. Unsure.

  3. It may pay to do an exact reproduction of an LJ fluid, e.g from Kirova & Norman and see if we get the same numerical result. This should be pretty easy in LAMMPS.

  4. We seem to be missing a velocity element and also not integrating correctly over the flux. See Table 2 Maginn.

  5. We should check against GK estimate from stress tensor.

@hmacdope
Copy link
Member

If you are OK sharing the data also, let me know and I can take a look.

@orionarcher
Copy link
Collaborator Author

  1. I can share the data. It's taking more time than expected to get it into a suitable format but should be done tomorrow. My analysis scripts are annoyingly bespoke. The test data that I added to this repo is from the same dataset, if you'd like something to toy around with in the mean time.

  2. I did use unwrapped trajectories. I thought that would be the problem but it doesn't appear to be.

2, 3, 4. I won't have a change to dig into the numerics until this weekend, at first glance I agree something looks off. Nothing would clearly generate the inverse relation that is appearing though. Very odd.

  1. I reported every 2000 fs which, according to Maginn, is not enough to construct an accurate velocity autocorrelation. I'll try to run a trajectory over the weekend that includes more frequent reporting of velocities.

@rohithsrinivaas
Copy link

  1. I did use unwrapped trajectories. I thought that would be the problem but it doesn't appear to be.

For Viscosity using the Helfand method, the wrapped coordinates needs to be used. Additionally two more terms are needed for the Helfand moment. These two terms are for the particles near the boundary. The details of the two terms are provided in https://arxiv.org/pdf/cond-mat/0510445 in pg. 53 eq. (2.67)

2, 3, 4. I won't have a change to dig into the numerics until this weekend, at first glance I agree something looks off. Nothing would clearly generate the inverse relation that is appearing though. Very odd.

The current code actually computes based on the Mc Quarrie's formula which is incorrect.

sq_diff = np.square(diff).mean(axis=-1)

The text from https://arxiv.org/pdf/cond-mat/0701253 clearly mentions this.

Screenshot 2024-12-02 at 9 48 30 AM

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

No branches or pull requests

3 participants