add documentation for fix move/python

This commit is contained in:
Axel Kohlmeyer
2017-12-07 16:36:36 -05:00
parent 4d915dba08
commit 0b51e9b2ff
5 changed files with 107 additions and 2 deletions

View File

@ -585,6 +585,7 @@ USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT.
"lineforce"_fix_lineforce.html, "lineforce"_fix_lineforce.html,
"momentum (k)"_fix_momentum.html, "momentum (k)"_fix_momentum.html,
"move"_fix_move.html, "move"_fix_move.html,
"move/python"_fix_move_python.html,
"mscg"_fix_mscg.html, "mscg"_fix_mscg.html,
"msst"_fix_msst.html, "msst"_fix_msst.html,
"neb"_fix_neb.html, "neb"_fix_neb.html,

102
doc/src/fix_python_move.txt Normal file
View File

@ -0,0 +1,102 @@
"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
:link(lws,http://lammps.sandia.gov)
:link(ld,Manual.html)
:link(lc,Section_commands.html#comm)
:line
fix move/python command :h3
[Syntax:]
fix move/python pymodule.CLASS :pre
pymodule.CLASS = use class [CLASS] in module/file [pymodule] to compute how to move atoms
[Examples:]
fix 1 all move/python py_nve.NVE
fix 1 all move/python py_nve.NVE_OPT :pre
[Description:]
The {move/python} fix style provides a way to define ways how particles
are moved during an MD run from python script code, that is loaded from
a file into LAMMPS and executed at the various steps where other fixes
can be executed. This python script must contain specific python class
definitions.
This allows to implement complex position updates and also modified
time integration methods. Due to python being an interpreted language,
however, the performance of this fix can be moderately to significantly
slower than the corresponding C++ code. For specific cases, this
performance penalty can be limited through effective use of NumPy.
:line
The python module file has to start with the following code:
from __future__ import print_function
import lammps
import ctypes
import traceback
import numpy as np
#
class LAMMPSFix(object):
def __init__(self, ptr, group_name="all"):
self.lmp = lammps.lammps(ptr=ptr)
self.group_name = group_name
#
class LAMMPSFixMove(LAMMPSFix):
def __init__(self, ptr, group_name="all"):
super(LAMMPSFixMove, self).__init__(ptr, group_name)
#
def init(self):
pass
#
def initial_integrate(self, vflag):
pass
#
def final_integrate(self):
pass
#
def initial_integrate_respa(self, vflag, ilevel, iloop):
pass
#
def final_integrate_respa(self, ilevel, iloop):
pass
#
def reset_dt(self):
pass :pre
Any classes implementing new atom motion functionality have to be
derived from the [LAMMPSFixMove] class, overriding the available
methods as needed.
Examples for how to do this are in the {examples/python} folder.
:line
[Restart, fix_modify, output, run start/stop, minimize info:]
No information about this fix is written to "binary restart
files"_restart.html. None of the "fix_modify"_fix_modify.html options
are relevant to this fix. No global or per-atom quantities are stored
by this fix for access by various "output
commands"_Section_howto.html#howto_15. No parameter of this fix can
be used with the {start/stop} keywords of the "run"_run.html command.
This fix is not invoked during "energy minimization"_minimize.html.
[Restrictions:]
This pair style is part of the PYTHON package. It is only enabled if
LAMMPS was built with that package. See the "Making
LAMMPS"_Section_start.html#start_3 section for more info.
[Related commands:]
"fix nve"_fix_nve.html, "fix python"_fix_python.html
[Default:] none

View File

@ -71,6 +71,7 @@ Fixes :h1
fix_meso_stationary fix_meso_stationary
fix_momentum fix_momentum
fix_move fix_move
fix_move_python
fix_mscg fix_mscg
fix_msst fix_msst
fix_mvv_dpd fix_mvv_dpd

View File

@ -200,6 +200,7 @@ fix_meso.html
fix_meso_stationary.html fix_meso_stationary.html
fix_momentum.html fix_momentum.html
fix_move.html fix_move.html
fix_move_python.html
fix_mscg.html fix_mscg.html
fix_msst.html fix_msst.html
fix_mvv_dpd.html fix_mvv_dpd.html

4
src/.gitignore vendored
View File

@ -908,10 +908,10 @@
/python_impl.cpp /python_impl.cpp
/python_impl.h /python_impl.h
/python_compat.h /python_compat.h
/fix_move_python.cpp
/fix_move_python.h
/fix_python.cpp /fix_python.cpp
/fix_python.h /fix_python.h
/fix_python_move.cpp
/fix_python_move.h
/pair_python.cpp /pair_python.cpp
/pair_python.h /pair_python.h
/reader_molfile.cpp /reader_molfile.cpp