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

Bugfix for fix pour and PBC #1750

Merged
merged 2 commits into from
Oct 30, 2019
Merged

Conversation

rbberger
Copy link
Member

@rbberger rbberger commented Oct 29, 2019

Summary

There was a logic error in the outside() function used by fix pour.
The previous implementation was essentially doing this:

outside = outside_pbc_range || outside_regular_range

It should have been:

outside = outside_pbc_range && outside_regular_range

Related Issues

Closes #1695

Author(s)

@rbberger

Licensing

By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).

Backward Compatibility

insertions that were previously considered are now ignored if particles are in the PBC area

Post Submission Checklist

Please check the fields below as they are completed after the pull request has been submitted. Delete lines that don't apply

  • The feature or features in this pull request is complete
  • Licensing information is complete
  • Corresponding author information is complete
  • The source code follows the LAMMPS formatting guidelines
  • Suitable new documentation files and/or updates to the existing docs are included
  • The added/updated documentation is integrated and tested with the documentation build system
  • The feature has been verified to work with the conventional build system
  • The feature has been verified to work with the CMake based build system
  • A package specific README file has been included or updated
  • One or more example input decks are included

Further Information, Files, and Links

Put any additional information here, attach relevant text or image files, and URLs to external sites (e.g. DOIs or webpages)

There was a logic error in the outside() function used by fix pour.
The previous implementation was essentially doing this:

outside = outside_pbc_range || outside_regular_range

It should have been:

outside = outside_pbc_range && outside_regular_range
@rbberger rbberger changed the title Fixes issue #1695 Bugfix for fix pour and PBC Oct 29, 2019
@akohlmey akohlmey self-assigned this Oct 30, 2019
} else {
if (value < lo || value > hi) return 1;
// upper boundary crosses periodic boundary
outside_pbc_range = (value < lo && value > hi - domain->prd[dim]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line still does not seem right to me. In this case, lo and hi are both inside the periodic cell, so the test should be:

outside_pbc_range = (value < lo && value < hi );

The original version is correct too, since the two conditions are mutually exclusive.

Copy link
Member Author

@rbberger rbberger Oct 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the lo and hi are both within the cell, neither of those if statements is executed. outside_pbc_range is not changed at all and stays true and only the outside_regular_range condition applies.

what seems to be missing is if (hi - lo) > prd then outside is always false.

I've added a change to account for it.

If the range between lo and hi is bigger than the extent in that dimension, in
the periodic case the value will always be inside.
@athomps athomps self-requested a review October 30, 2019 17:14
@akohlmey akohlmey merged commit 2f9f455 into lammps:master Oct 30, 2019
@rbberger rbberger deleted the fix_pour_bugfix branch October 30, 2019 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] fix pour: particles overlapping at z periodic boundary
3 participants