forked from lijiext/lammps
110 lines
3.4 KiB
Plaintext
110 lines
3.4 KiB
Plaintext
"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
|
|
|
|
:link(lws,http://lammps.sandia.gov)
|
|
:link(ld,Manual.html)
|
|
:link(lc,Section_commands.html#comm)
|
|
|
|
:line
|
|
|
|
jump command :h3
|
|
|
|
[Syntax:]
|
|
|
|
jump file label :pre
|
|
|
|
file = filename of new input script to switch to
|
|
label = optional label within file to jump to :ul
|
|
|
|
[Examples:]
|
|
|
|
jump newfile
|
|
jump in.run2 runloop
|
|
jump SELF runloop :pre
|
|
|
|
[Description:]
|
|
|
|
This command closes the current input script file, opens the file with
|
|
the specified name, and begins reading LAMMPS commands from that file.
|
|
Unlike the "include"_include.html command, the original file is not
|
|
returned to, although by using multiple jump commands it is possible
|
|
to chain from file to file or back to the original file.
|
|
|
|
If the word "SELF" is used for the filename, then the current input
|
|
script is re-opened and read again.
|
|
|
|
IMPORTANT NOTE: The SELF option is not guaranteed to work when the
|
|
current input script is being read through stdin (standard input),
|
|
e.g.
|
|
|
|
lmp_g++ < in.script :pre
|
|
|
|
since the SELF option invokes the C-library rewind() call, which may
|
|
not be supported for stdin on some systems. This can be worked around
|
|
by using the "-in command-line argument"_Section_start.html#2_6 or the
|
|
"-var command-line argument"_Section_start.html#2_6 to pass the script
|
|
name as a variable to the input script In the latter case, the "fname"
|
|
"variable"_variable.html could be used in place of SELF. E.g.
|
|
|
|
lmp_g++ -in in.script :pre
|
|
lmp_g++ -var fname n.script < in.script :pre
|
|
|
|
The 2nd argument to the jump command is optional. If specified, it is
|
|
treated as a label and the new file is scanned (without executing
|
|
commands) until the label is found, and commands are executed from
|
|
that point forward. This can be used to loop over a portion of the
|
|
input script, as in this example. These commands perform 10 runs,
|
|
each of 10000 steps, and create 10 dump files named file.1, file.2,
|
|
etc. The "next"_next.html command is used to exit the loop after 10
|
|
iterations. When the "a" variable has been incremented for the tenth
|
|
time, it will cause the next jump command to be skipped.
|
|
|
|
variable a loop 10
|
|
label loop
|
|
dump 1 all atom 100 file.$a
|
|
run 10000
|
|
undump 1
|
|
next a
|
|
jump in.lj loop :pre
|
|
|
|
If the jump {file} argument is a variable, the jump command can be
|
|
used to cause different processor partitions to run different input
|
|
scripts. In this example, LAMMPS is run on 40 processors, with 4
|
|
partitions of 10 procs each. An in.file containing the example
|
|
variable and jump command will cause each partition to run a different
|
|
simulation.
|
|
|
|
mpirun -np 40 lmp_ibm -partition 4x10 -in in.file :pre
|
|
|
|
variable f world script.1 script.2 script.3 script.4
|
|
jump $f :pre
|
|
|
|
Here is an example of a double loop which uses the "if"_if.html and
|
|
jump commands to break out of the inner loop when a condition is met,
|
|
then continues iterating thru the outer loop.
|
|
|
|
label loopa
|
|
variable a loop 5
|
|
label loopb
|
|
variable b loop 5
|
|
print "A,B = $a,$b"
|
|
run 10000
|
|
if $b > 2 then "jump in.script break"
|
|
next b
|
|
jump in.script loopb
|
|
label break
|
|
variable b delete :pre
|
|
next a
|
|
jump in.script loopa :pre
|
|
|
|
[Restrictions:]
|
|
|
|
If you jump to a file and it does not contain the specified label,
|
|
LAMMPS will come to the end of the file and exit.
|
|
|
|
[Related commands:]
|
|
|
|
"variable"_variable.html, "include"_include.html, "label"_label.html,
|
|
"next"_next.html
|
|
|
|
[Default:] none
|