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

More consistent checking on lengths of variable-length vectors and arrays #4122

Merged
merged 5 commits into from
Apr 5, 2024

Conversation

sjplimp
Copy link
Contributor

@sjplimp sjplimp commented Apr 4, 2024

Summary

Global vectors produced by computes, fixes, and vector-style variables can be variable-length, with the length sometimes not known until run time. Likewise global arrays produced by computes and fixes can have a variable number of rows. When
these quantities are output or used in variable formulas, some checking needs to be done to ensure elements of the vectors
or rows of the arrays are correctly accessed. In the case of vector-style variables some commands allow for access beyond
the (unknown) length by returning zero values. This PR simply tries to make all of this error checking more consistent.

Related Issue(s)

A previous PR #4098 flagged an issue which led to this more comprehensive PR.

Author(s)

Steve

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

Hopefully this PR will only flag input script syntax errors that could have previously been allowed.

Implementation Notes

Post Submission Checklist

  • 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
  • Suitable tests have been added to the unittest tree.
  • A package specific README file has been included or updated
  • One or more example input decks are included

Further Information, Files, and Links

@akohlmey akohlmey added the bugfix label Apr 5, 2024
@akohlmey akohlmey merged commit 4401179 into develop Apr 5, 2024
4 checks passed
@akohlmey akohlmey deleted the variable-length-vectors-arrays branch April 5, 2024 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants