How to use LAMMPS' "variable" command in an .LT file
See original GitHub issueHi,
I am new to moltemplate, so I am sorry if I asking a (trivial) question here. I wanna create forcefield.lt. Can I use LAMMPS variable
command in my script? I would like then use this forcefield.lt as a template and produce a collection of LAMMPS input files by bash scripts.
For instance I want to have the following command in my LAMMPS script
variable cutoff11 equal ${sig1}*1.12246205
where sig1
is then given to LAMMPS as an argument with the command-line option lmp_serial -var sig1 VALUE
.
Please see the part of the input file that I want to use variable
command in.
Thanks
Amir
Issue Analytics
- State:
- Created a year ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
variable command
LAMMPS can be run with multiple partitions via the -partition command-line switch. This variable command assigns one string to each world.
Read more >4.2. Command-line options
Specify a file to use as an input script. ... The environment variable setting for each MPI rank is used to assign a...
Read more >next command
All the variables specified with the next command are incremented by one value from their respective list of values. A file-style variable reads...
Read more >1 Creating Input Files for Molecular Simulations in LAMMPS ...
To run a simulation, append some content to the end of the “system.in” file. See Table 6. for an example of such commands....
Read more >Moltemplate Manual
These tools can generate MOL2 or LAMMPS-DATA files which can be converted into moltemplate format (LT format) using mol22lt.py.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks Otello!
Actually Otello recently supplied an file which demonstrates how to do this. See below:
https://github.com/jewettaij/moltemplate/blob/master/tests/test_molc_files/system.lt
Yes, the \ is necessary before the $ and {} characters, because those characters have special meanings in moltemplate.
(If you put “${sign1}” instead of “\$\{sign1\}” in your LT file, I’m not sure what will happen. Moltemplate will probably assume you are referring to an $atom:, $bond:, $angle:,… integer counter (or some type of new user-defined counter category named “sign1”), and then print out some incomprehensible error message. (Is that what happened?))
If you have additional questions, I suggest starting new issues in the github issue tracker (instead of burying them here in this thread). It may be a few days before I reply to them, but I do notice it when new issues appear on the moltemplate github page. (I’m vain enough to check that page regularly.)
This question was fine. If your future questions are really specific to what you are working on and unlikely to be something that anyone else would care about, then I suggest emailing them to me instead (jewett.aij -at- gmail.com).
Sure, Moltemplate is agnostic to the commands that you pass to LAMMPS. You only need to protect the variables that are not ment to be processed by Moltemplate. Therefore, the line that goes in your forcefield.lt script is:
variable cutoff11 equal \$\{sig1\}*1.12246205