calling lammps (or any simulator) from python for a test

Is there a preferred method for making system calls from python?
Are we concerned about security?
Should mpiexec/mpirun be in the system call for simulators that support parallelism?

A working example to debate over (python2.7 style):

import subprocess commandString = "mpiexec -np %d lmp_g++ -in %s > %s"%(1, lammpsInput, lammpsLog) command = commandString.split() subprocess.check_call(command)

-AdamC

The use of check_call is fine due to the safety of the command list and the ability to grab and process input and output. Sound good

-Matt

I did run into problems grabbing output from the pipe, since the process isn’t run in shell mode the pipes are handled differently. Using check_output is a good solution though and avoids writing to disk.

-AdamC