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

Fix two problems with NPT: volume fluctuations (with iso, previously with aniso/tri) and energy conservation (with aniso/tri) #1259

Merged
merged 3 commits into from Dec 29, 2018

Conversation

Projects
None yet
4 participants
@athomps
Copy link
Contributor

athomps commented Dec 13, 2018

Purpose

These code changes address two different problems: incorrect volume fluctuations and energy conservation. The first problem was related to ndof used to compute targe temperature of barostat variables. The second problem was due to using slightly out-of-date temperature tensor in pressure tensor calculation

Author(s)

Aidan Thompson. Steven van den Brande played a key role in identifying the problems.

Backward Compatibility

This change will make minor differences to output from all npt/nph simulations.

Implementation Notes

Post Submission Checklist

Please check the fields below as they are completed

  • The feature or features in this pull request is complete
  • Suitable new documentation files and/or updates to the existing docs are included
  • One or more example input decks are included
  • The source code follows the LAMMPS formatting guidelines

Further Information, Files, and Links

This pull request is related to one made about 6 months ago. I don't know how to look it up.

athomps added some commits Dec 13, 2018

Made two changes:
	-recomputed up-to-date pressure tensor (fixes energy
conservation problem with aniso)
	-changed ndof for iso (fixes volume fluctuation problem with iso)
@martok

This comment has been minimized.

Copy link
Collaborator

martok commented Dec 13, 2018

This PR does seem to fix the issue where the ensemble average pressure almost never reached the iso setpoint except for unreasonably large systems. It is now exact even for surprisingly small systems.

Might also be relevant for the folks attempting to do calculate thermodynamic quantities with the fluctuation method? Posts about this came up on the mailing list many times, and never seemed to work right.

@athomps

This comment has been minimized.

Copy link
Contributor

athomps commented Dec 13, 2018

@martok, good to know. The more people that check this the better. I only looked at the scalar volume fluctuation distribution, not the vector axial strain distribution for aniso or the full tensor strain distribution for tri. If this change fixes the previous problems sampling full tensor strain distribution, it wold allow sampling of elastic constants at any T and P.

@athomps

This comment has been minimized.

Copy link
Contributor

athomps commented Dec 13, 2018

The previous pull request that dealt with the barostat thermostat ndof was:

Fix discrepancies between fix_nh and papers #942

submitted by @tootea

It had the effect of fixing the volume distribution for aniso/tri, but breaking it for iso (I should have spotted this at the time).

@tootea

This comment has been minimized.

Copy link
Collaborator

tootea commented Dec 13, 2018

Oops, that's embarrassing. I hadn't realized that pdof is not 1 in the iso case, even though it's so obvious. Thanks for fixing that.

@@ -1871,7 +1878,8 @@ void FixNH::nhc_press_integrate()
}
}

lkt_press = pdof * kt;
if (pstyle == ISO) lkt_press = kt;

This comment has been minimized.

@akohlmey

akohlmey Dec 14, 2018

Member

Shouldn't these changes be propagated to other fix_nh.cpp variants?

@athomps

This comment has been minimized.

Copy link
Contributor

athomps commented Dec 14, 2018

Yes, I will propagate both of these changes to the variants.

@athomps athomps requested a review from stanmoore1 as a code owner Dec 15, 2018

@athomps

This comment has been minimized.

Copy link
Contributor

athomps commented Dec 15, 2018

One change propagated to KOKKOS. I did not find any other variants needing change.

@akohlmey akohlmey self-assigned this Dec 17, 2018

@akohlmey akohlmey referenced this pull request Dec 17, 2018

Merged

Collected post stable patches #1242

4 of 4 tasks complete

@akohlmey akohlmey self-requested a review Dec 18, 2018

@akohlmey akohlmey merged commit dd66886 into lammps:master Dec 29, 2018

5 checks passed

lammps/pull-requests/build-docs-pr head run ended
Details
lammps/pull-requests/kokkos_omp head run ended
Details
lammps/pull-requests/openmpi-pr head run ended
Details
lammps/pull-requests/serial-pr head run ended
Details
lammps/pull-requests/shlib-pr head run ended
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment