LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
[lammps-users] Problem when calling back to LAMMPS from Python
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lammps-users] Problem when calling back to LAMMPS from Python


From: Shuang Yang <ysmashimaro@...24...>
Date: Wed, 21 Jun 2017 16:14:13 -0600

Hi,

I am trying to build LAMMPS with Python support and it works for the most part for my tests. Calling LAMMPS from Python works fine (including PyLammps) and Python commands works fine too, but when I try to callback to LAMMPS, errors happen. Here is the situation:

in2.python:

python           loop input 4 10 1.0 -4.0 SELF format iffp file funcs.py
python           loop invoke

funcs.py:

def loop(N,cut0,thresh,lmpptr):
  print "LOOP ARGS",N,cut0,thresh,lmpptr
  from lammps import lammps

log.lammps:

LAMMPS (31 Mar 2017)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:90)
  using 1 OpenMP thread(s) per MPI task
python           loop input 4 10 1.0 -4.0 SELF format iffp file funcs.py
python           loop invoke

Output on console:

~/lammps/examples/python$ ../../src/lmp_wheeler -in in2.python

LAMMPS (31 Mar 2017)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (../comm.cpp:90)
  using 1 OpenMP thread(s) per MPI task
LOOP ARGS 10 1.0 -4.0 <PyCObject object at 0x7f0b4cbd6620>
ERROR on proc 0: Python function evaluation failed (../python.cpp:253)
application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0
[unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=1
:
system msg for write_line failure : Bad file descriptor

Could anyone help me please? Thanks a lot!