doc pages for new Python function wrappers
This commit is contained in:
46
examples/python/in.python.wrap
Normal file
46
examples/python/in.python.wrap
Normal file
@ -0,0 +1,46 @@
|
||||
# 3d Lennard-Jones melt with equal- and atom-style variables which
|
||||
# use a Python function wrapper in their formulas
|
||||
|
||||
variable x index 5
|
||||
variable y index 5
|
||||
variable z index 5
|
||||
|
||||
units lj
|
||||
atom_style atomic
|
||||
|
||||
lattice fcc 0.8442
|
||||
region box block 0 $x 0 $y 0 $z
|
||||
create_box 1 box
|
||||
create_atoms 1 box
|
||||
mass 1 1.0
|
||||
|
||||
velocity all create 1.44 87287 loop geom
|
||||
|
||||
pair_style lj/cut 2.5
|
||||
pair_coeff 1 1 1.0 1.0 2.5
|
||||
|
||||
neighbor 0.3 bin
|
||||
neigh_modify delay 0 every 20 check no
|
||||
|
||||
fix 1 all nve
|
||||
|
||||
variable foo python truncate
|
||||
python truncate return v_foo input 1 v_pyarg1 format fi here """
|
||||
def truncate(x):
|
||||
return int(x)
|
||||
"""
|
||||
variable pyarg1 internal 0.0
|
||||
|
||||
variable scalar equal py_foo(4.5)
|
||||
print "TRUNCATE ${scalar}"
|
||||
|
||||
variable xtrunc atom py_foo(x)
|
||||
variable ytrunc atom py_foo(y)
|
||||
variable ztrunc atom py_foo(z)
|
||||
|
||||
# examine dump file to see truncated xyz coords of each atom
|
||||
|
||||
#dump 1 all custom 100 tmp.dump id x y z
|
||||
dump 1 all custom 100 tmp.dump id x y z v_xtrunc v_ytrunc v_ztrunc
|
||||
|
||||
run 100
|
||||
Reference in New Issue
Block a user