Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92803035
shell.html
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 23, 20:29
Size
3 KB
Mime Type
text/html
Expires
Mon, Nov 25, 20:29 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
22517090
Attached To
rLAMMPS lammps
shell.html
View Options
<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>
shell command
</H3>
<P><B>
Syntax:
</B>
</P>
<PRE>
shell cmd args
</PRE>
<UL><LI>
cmd =
<I>
cd
</I>
or
<I>
mkdir
</I>
or
<I>
mv
</I>
or
<I>
rm
</I>
or
<I>
rmdir
</I>
or
<I>
putenv
</I>
or arbitrary command
<PRE>
<I>
cd
</I>
arg = dir
dir = directory to change to
<I>
mkdir
</I>
args = dir1 dir2 ...
dir1,dir2 = one or more directories to create
<I>
mv
</I>
args = old new
old = old filename
new = new filename
<I>
rm
</I>
args = file1 file2 ...
file1,file2 = one or more filenames to delete
<I>
rmdir
</I>
args = dir1 dir2 ...
dir1,dir2 = one or more directories to delete
<I>
putenv
</I>
args = var1=value1 var2=value2
var=value = one of more definitions of environment variables
anything else is passed as a command to the shell for direct execution
</PRE>
</UL>
<P><B>
Examples:
</B>
</P>
<PRE>
shell cd sub1
shell cd ..
shell mkdir tmp1 tmp2 tmp3
shell rmdir tmp1
shell mv log.lammps hold/log.1
shell rm TMP/file1 TMP/file2
shell putenv LAMMPS_POTENTIALS=../../potentials
shell my_setup file1 10 file2
shell my_post_process 100 dump.out
</PRE>
<P><B>
Description:
</B>
</P>
<P>
Execute a shell command. A few simple file-based shell commands are
supported directly, in Unix-style syntax. Any command not listed
above is passed as-is to the C-library system() call, which invokes
the command in a shell.
</P>
<P>
This is means to invoke other commands from your input script. For
example, you can move files around in preparation for the next section
of the input script. Or you can run a program that pre-processes data
for input into LAMMPS. Or you can run a program that post-processes
LAMMPS output data.
</P>
<P>
With the exception of
<I>
cd
</I>
, all commands, including ones invoked via a
system() call, are executed by only a single processor, so that
files/directories are not being manipulated by multiple processors.
</P>
<P>
The
<I>
cd
</I>
cmd executes the Unix "cd" command to change the working
directory. All subsequent LAMMPS commands that read/write files will
use the new directory. All processors execute this command.
</P>
<P>
The
<I>
mkdir
</I>
cmd executes the Unix "mkdir" command to create one or
more directories.
</P>
<P>
The
<I>
mv
</I>
cmd executes the Unix "mv" command to rename a file and/or
move it to a new directory.
</P>
<P>
The
<I>
rm
</I>
cmd executes the Unix "rm" command to remove one or more
files.
</P>
<P>
The
<I>
rmdir
</I>
cmd executes the Unix "rmdir" command to remove one or
more directories. A directory must be empty to be successfully
removed.
</P>
<P>
The
<I>
putenv
</I>
cmd defines or updates an environment variable directly.
Since this command does not pass through the shell, no shell variable
expansion or globbing is performed, only the usual substitution for
LAMMPS variables defined with the
<A
HREF =
"variable.html"
>
variable
</A>
command is
performed. The resulting string is then used literally.
</P>
<P>
Any other cmd is passed as-is to the shell along with its arguments as
one string, invoked by the C-library system() call. For example,
these lines in your input script:
</P>
<PRE>
variable n equal 10
variable foo string file2
shell my_setup file1
$
n
${
foo
}
</PRE>
<P>
would be the same as invoking
</P>
<PRE>
% my_setup file1 10 file2
</PRE>
<P>
from a command-line prompt. The executable program "my_setup" is run
with 3 arguments: file1 10 file2.
</P>
<P><B>
Restrictions:
</B>
</P>
<P>
LAMMPS does not detect errors or print warnings when any of these
commands execute. E.g. if the specified directory does not exist,
executing the
<I>
cd
</I>
command will silently do nothing.
</P>
<P><B>
Related commands:
</B>
none
</P>
<P><B>
Default:
</B>
none
</P>
</HTML>
Event Timeline
Log In to Comment