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

Variable style 'string' substitutes variables in definition #948

Merged
merged 1 commit into from Jun 18, 2018

Conversation

Projects
None yet
3 participants
@martok
Collaborator

martok commented Jun 14, 2018

Purpose

As discussed on lammps-users, this PR modifies variable style "string" to also do variable expansion at definition time when the value is quoted.

Example:

variable bar index 123
variable baz index abc

variable foo1 string ${bar}_${baz}
variable foo2 string "${bar} ${baz}" 

print ${foo1}
print "${foo2}"

Expands to:

print ${foo1}
print 123_abc
123_abc
print "${foo2}"
123 abc

Author(s)

Sebastian Hütter (OvGU)

Backward Compatibility

This does change existing interpretation of variable string. However, I don't see any existing use case that might be influenced by this: since it was previously not possible to do anything useful with substitution variables in string-style variables, I suspect there shouldn't be any code that gets broken.

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

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

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

8 checks passed

lammps/pull-requests/build-docs-pr merge run ended
Details
lammps/pull-requests/kokkos_omp merge run ended
Details
lammps/pull-requests/openmpi-pr merge run ended
Details
lammps/pull-requests/regression-pr merge run ended
Details
lammps/pull-requests/serial-pr merge run ended
Details
lammps/pull-requests/shlib-pr merge 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