File: jump.html

package info (click to toggle)
lammps 0~20140523.gite5e877d-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 193,012 kB
  • ctags: 48,147
  • sloc: cpp: 458,874; python: 21,769; fortran: 16,023; ansic: 12,503; perl: 3,687; sh: 3,221; makefile: 1,366; f90: 1,177; xml: 788; objc: 238; lisp: 169; tcl: 61; csh: 16; awk: 14
file content (136 lines) | stat: -rw-r--r-- 4,489 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<HTML>
<CENTER><A HREF = "http://lammps.sandia.gov">LAMMPS WWW Site</A> - <A HREF = "Manual.html">LAMMPS Documentation</A> - <A HREF = "Section_commands.html#comm">LAMMPS Commands</A> 
</CENTER>






<HR>

<H3>jump command 
</H3>
<P><B>Syntax:</B>
</P>
<PRE>jump file label 
</PRE>
<UL><LI>file = filename of new input script to switch to
<LI>label = optional label within file to jump to 
</UL>
<P><B>Examples:</B>
</P>
<PRE>jump newfile
jump in.run2 runloop
jump SELF runloop 
</PRE>
<P><B>Description:</B>
</P>
<P>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 <A HREF = "include.html">include</A> 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.
</P>
<P>If the word "SELF" is used for the filename, then the current input
script is re-opened and read again.
</P>
<P>IMPORTANT NOTE: The SELF option is not guaranteed to work when the
current input script is being read through stdin (standard input),
e.g.
</P>
<PRE>lmp_g++ < in.script 
</PRE>
<P>since the SELF option invokes the C-library rewind() call, which may
not be supported for stdin on some systems or by some MPI
implementations.  This can be worked around by using the <A HREF = "Section_start.html#start_7">-in
command-line argument</A>, e.g.
</P>
<PRE>lmp_g++ -in in.script 
</PRE>
<P>or by using the <A HREF = "Section_start.html#start_7">-var command-line
argument</A> to pass the script name as a
variable to the input script.  In the latter case, a
<A HREF = "variable.html">variable</A> called "fname" could be used in place of
SELF, e.g.
</P>
<PRE>lmp_g++ -var fname in.script < in.script 
</PRE>
<P>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 <A HREF = "next.html">next</A> 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.
</P>
<PRE>variable a loop 10
label loop
dump 1 all atom 100 file.$a
run 10000
undump 1
next a
jump in.lj loop 
</PRE>
<P>If the jump <I>file</I> 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.
</P>
<PRE>mpirun -np 40 lmp_ibm -partition 4x10 -in in.file 
</PRE>
<PRE>variable f world script.1 script.2 script.3 script.4
jump $f 
</PRE>
<P>Here is an example of a loop which checks every 1000 steps if the
system temperature has reached a certain value, and if so, breaks out
of the loop to finish the run.  Note that any variable could be
checked, so long as it is current on the timestep when the run
completes.  As explained on the <A HREF = "variable.html">variable</A> doc page,
this can be insured by includig the variable in thermodynamic output.
</P>
<PRE>variable myTemp equal temp
label loop
variable a loop 1000
run 1000
if "${myTemp} < 300.0" then "jump SELF break"
next a
jump SELF loop
label break
print "ALL DONE" 
</PRE>
<P>Here is an example of a double loop which uses the if and
<A HREF = "jump.html">jump</A> commands to break out of the inner loop when a
condition is met, then continues iterating thru the outer loop.
</P>
<PRE>label	    loopa
variable    a loop 5
  label	    loopb
  variable  b loop 5
  print	    "A,B = $a,$b"
  run       10000
  if	    "$b > 2" then "jump SELF break"
  next	    b
  jump	    in.script loopb
label	    break
variable    b delete
next	    a
jump	    SELF loopa 
</PRE>
<P><B>Restrictions:</B>
</P>
<P>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.
</P>
<P><B>Related commands:</B>
</P>
<P><A HREF = "variable.html">variable</A>, <A HREF = "include.html">include</A>, <A HREF = "label.html">label</A>,
<A HREF = "next.html">next</A>
</P>
<P><B>Default:</B> none
</P>
</HTML>