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

Add support for inline format strings to immediate variable substitution #950

Merged
merged 1 commit into from Jun 18, 2018

Conversation

Projects
None yet
4 participants
@martok
Collaborator

martok commented Jun 14, 2018

Purpose

This PR extends $(immediate)-variable evaluation to support format specifiers. Effectively, this eliminates the need for format style variables in some (most?) cases.

Example:

variable            peatom equal pe/atoms
variable            spea format peatom %10.3f
print "Final energy per atom: ${spea} eV/atom"

Can be shortened to:

print "Final energy per atom: $(pe/atoms:%10.3f) eV/atom"

Author(s)

Sebastian Hütter (OvGU)

Backward Compatibility

The splitter character ':' was not a valid character in an equal-style variable before, and the ":%" sequence does not look like it will ever be one. Only $() is modified, expression evaluation itself is unchanged. No issues are expected.

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

@rbberger rbberger assigned sjplimp and unassigned rbberger Jun 15, 2018

@sjplimp sjplimp merged commit 08331da into lammps:master Jun 18, 2018

8 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/regression-pr merge run ended
Details
lammps/pull-requests/serial-pr head run ended
Details
lammps/pull-requests/shlib-pr head run ended
Details
lammps/pull-requests/testing-omp-pr merge run ended
Details
lammps/pull-requests/testing-pr merge run ended
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment