Rename fix python/integrate to python/move
This is to avoid confusion to what LAMMPS considers to be an integrator like Verlet and RESPA.
This commit is contained in:
@ -1,15 +1,16 @@
|
||||
This folder contains several LAMMPS input scripts and a python module
|
||||
file py_integrate.py to demonstrate the use of the fix style python/integrate.
|
||||
file py_nve.py to demonstrate the use of the fix style python/move
|
||||
to reimplement NVE using Python.
|
||||
|
||||
in.fix_python_integrate_melt:
|
||||
in.fix_python_nve_melt:
|
||||
This is a version of the melt example which replaces the default NVE integrator
|
||||
with a Python implementation. Fix python/integrate is used to create an
|
||||
instance of the py_integrate.NVE class which implements the required interface.
|
||||
with a Python implementation. Fix python/move is used to create an
|
||||
instance of the py_nve.NVE class which implements the required interface.
|
||||
It demonstrates how to access LAMMPS data as numpy arrays. This gives direct
|
||||
access to memory owned by the C++ code, allows easy manipulation through numpy
|
||||
operations and avoids unnecessary copies.
|
||||
|
||||
in.fix_python_integrate_melt_opt:
|
||||
in.fix_python_nve_melt_opt:
|
||||
This version of melt example uses NVE_Opt instead of NVE. While this Python
|
||||
implementation is still much slower than the native version, it shows that
|
||||
simple code transformations can lead to speedups.
|
||||
@ -17,7 +17,7 @@ pair_coeff 1 1 1.0 1.0 2.5
|
||||
neighbor 0.3 bin
|
||||
neigh_modify every 20 delay 0 check no
|
||||
|
||||
fix 1 all python/integrate py_integrate.NVE
|
||||
fix 1 all python/move py_nve.NVE
|
||||
|
||||
thermo 50
|
||||
run 250
|
||||
@ -17,7 +17,7 @@ pair_coeff 1 1 1.0 1.0 2.5
|
||||
neighbor 0.3 bin
|
||||
neigh_modify every 20 delay 0 check no
|
||||
|
||||
fix 1 all python/integrate py_integrate.NVE_Opt
|
||||
fix 1 all python/move py_nve.NVE_Opt
|
||||
|
||||
thermo 50
|
||||
run 250
|
||||
@ -9,9 +9,9 @@ class LAMMPSFix(object):
|
||||
self.lmp = lammps.lammps(ptr=ptr)
|
||||
self.group_name = group_name
|
||||
|
||||
class LAMMPSIntegrator(LAMMPSFix):
|
||||
class LAMMPSFixMove(LAMMPSFix):
|
||||
def __init__(self, ptr, group_name="all"):
|
||||
super(LAMMPSIntegrator, self).__init__(ptr, group_name)
|
||||
super(LAMMPSFixMove, self).__init__(ptr, group_name)
|
||||
|
||||
def init(self):
|
||||
pass
|
||||
@ -32,7 +32,7 @@ class LAMMPSIntegrator(LAMMPSFix):
|
||||
pass
|
||||
|
||||
|
||||
class NVE(LAMMPSIntegrator):
|
||||
class NVE(LAMMPSFixMove):
|
||||
""" Python implementation of fix/nve """
|
||||
def __init__(self, ptr, group_name="all"):
|
||||
super(NVE, self).__init__(ptr)
|
||||
@ -70,7 +70,7 @@ class NVE(LAMMPSIntegrator):
|
||||
v[i,:] += dtfm * f[i,:]
|
||||
|
||||
|
||||
class NVE_Opt(LAMMPSIntegrator):
|
||||
class NVE_Opt(LAMMPSFixMove):
|
||||
""" Performance-optimized Python implementation of fix/nve """
|
||||
def __init__(self, ptr, group_name="all"):
|
||||
super(NVE_Opt, self).__init__(ptr)
|
||||
Reference in New Issue
Block a user