forked from lijiext/lammps
remove doc text explaining restrictions that are lifted with the changes in this branch
This commit is contained in:
parent
3cbf4f3b58
commit
c9bc141335
|
@ -118,11 +118,6 @@ check which version of Python you have installed, by simply typing
|
||||||
|
|
||||||
11.2 Overview of using Python from a LAMMPS script :link(py_2),h4
|
11.2 Overview of using Python from a LAMMPS script :link(py_2),h4
|
||||||
|
|
||||||
NOTE: It is not currently possible to use the "python"_python.html
|
|
||||||
command described in this section with Python 3, only with Python 2.
|
|
||||||
The C API changed from Python 2 to 3 and the LAMMPS code is not
|
|
||||||
compatible with both.
|
|
||||||
|
|
||||||
LAMMPS has a "python"_python.html command which can be used in an
|
LAMMPS has a "python"_python.html command which can be used in an
|
||||||
input script to define and execute a Python function that you write
|
input script to define and execute a Python function that you write
|
||||||
the code for. The Python function can also be assigned to a LAMMPS
|
the code for. The Python function can also be assigned to a LAMMPS
|
||||||
|
|
|
@ -50,7 +50,7 @@ def factorial(n):
|
||||||
return n * factorial(n-1)
|
return n * factorial(n-1)
|
||||||
""" :pre
|
""" :pre
|
||||||
|
|
||||||
python loop input 1 SELF return v_value format -f here """
|
python loop input 1 SELF return v_value format pf here """
|
||||||
def loop(lmpptr,N,cut0):
|
def loop(lmpptr,N,cut0):
|
||||||
from lammps import lammps
|
from lammps import lammps
|
||||||
lmp = lammps(ptr=lmpptr) :pre
|
lmp = lammps(ptr=lmpptr) :pre
|
||||||
|
@ -59,7 +59,7 @@ def loop(lmpptr,N,cut0):
|
||||||
|
|
||||||
for i in range(N):
|
for i in range(N):
|
||||||
cut = cut0 + i*0.1
|
cut = cut0 + i*0.1
|
||||||
lmp.set_variable("cut",cut) # set a variable in LAMMPS
|
lmp.set_variable("cut",cut) # set a variable in LAMMPS
|
||||||
lmp.command("pair_style lj/cut $\{cut\}") # LAMMPS commands
|
lmp.command("pair_style lj/cut $\{cut\}") # LAMMPS commands
|
||||||
lmp.command("pair_coeff * * 1.0 1.0")
|
lmp.command("pair_coeff * * 1.0 1.0")
|
||||||
lmp.command("run 100")
|
lmp.command("run 100")
|
||||||
|
@ -67,11 +67,6 @@ def loop(lmpptr,N,cut0):
|
||||||
|
|
||||||
[Description:]
|
[Description:]
|
||||||
|
|
||||||
NOTE: It is not currently possible to use the "python"_python.html
|
|
||||||
command described in this section with Python 3, only with Python 2.
|
|
||||||
The C API changed from Python 2 to 3 and the LAMMPS code is not
|
|
||||||
compatible with both.
|
|
||||||
|
|
||||||
Define a Python function or execute a previously defined function.
|
Define a Python function or execute a previously defined function.
|
||||||
Arguments, including LAMMPS variables, can be passed to the function
|
Arguments, including LAMMPS variables, can be passed to the function
|
||||||
from the LAMMPS input script and a value returned by the Python
|
from the LAMMPS input script and a value returned by the Python
|
||||||
|
@ -477,16 +472,7 @@ python"_Section_python.html. Note that it is important that the
|
||||||
stand-alone LAMMPS executable and the LAMMPS shared library be
|
stand-alone LAMMPS executable and the LAMMPS shared library be
|
||||||
consistent (built from the same source code files) in order for this
|
consistent (built from the same source code files) in order for this
|
||||||
to work. If the two have been built at different times using
|
to work. If the two have been built at different times using
|
||||||
different source files, problems may occur.
|
different source files, problems may occur.
|
||||||
|
|
||||||
As described above, you can use the python command to invoke a Python
|
|
||||||
function which calls back to LAMMPS through its Python-wrapped library
|
|
||||||
interface. However you cannot do the opposite. I.e. you cannot call
|
|
||||||
LAMMPS from Python and invoke the python command to "callback" to
|
|
||||||
Python and execute a Python function. LAMMPS will generate an error
|
|
||||||
if you try to do that. Note that we think there actually should be a
|
|
||||||
way to do that, but haven't yet been able to figure out how to do it
|
|
||||||
successfully.
|
|
||||||
|
|
||||||
[Related commands:]
|
[Related commands:]
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ using the generated {auto} Makefile.
|
||||||
cd $LAMMPS_DIR/src :pre
|
cd $LAMMPS_DIR/src :pre
|
||||||
|
|
||||||
# generate custom Makefile
|
# generate custom Makefile
|
||||||
python2 Make.py -jpg -png -s ffmpeg exceptions -m mpi -a file :pre
|
python Make.py -jpg -png -s ffmpeg exceptions -m mpi -a file :pre
|
||||||
|
|
||||||
# add packages if necessary
|
# add packages if necessary
|
||||||
make yes-MOLECULE :pre
|
make yes-MOLECULE :pre
|
||||||
|
|
Loading…
Reference in New Issue