add example for Python with vector-style variable
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
LAMMPS (2 Apr 2025 - Development - patch_2Apr2025-266-gebfb94a717-modified)
|
||||
LAMMPS (2 Apr 2025 - Development - patch_2Apr2025-270-g2351418c94-modified)
|
||||
# 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
|
||||
variable x index 3
|
||||
variable y index 3
|
||||
variable z index 3
|
||||
|
||||
units lj
|
||||
atom_style atomic
|
||||
@ -12,15 +12,15 @@ atom_style atomic
|
||||
lattice fcc 0.8442
|
||||
Lattice spacing in x,y,z = 1.6795962 1.6795962 1.6795962
|
||||
region box block 0 $x 0 $y 0 $z
|
||||
region box block 0 5 0 $y 0 $z
|
||||
region box block 0 5 0 5 0 $z
|
||||
region box block 0 5 0 5 0 5
|
||||
region box block 0 3 0 $y 0 $z
|
||||
region box block 0 3 0 3 0 $z
|
||||
region box block 0 3 0 3 0 3
|
||||
create_box 1 box
|
||||
Created orthogonal box = (0 0 0) to (8.397981 8.397981 8.397981)
|
||||
Created orthogonal box = (0 0 0) to (5.0387886 5.0387886 5.0387886)
|
||||
1 by 1 by 1 MPI processor grid
|
||||
create_atoms 1 box
|
||||
Created 500 atoms
|
||||
using lattice units in orthogonal box = (0 0 0) to (8.397981 8.397981 8.397981)
|
||||
Created 108 atoms
|
||||
using lattice units in orthogonal box = (0 0 0) to (5.0387886 5.0387886 5.0387886)
|
||||
create_atoms CPU = 0.000 seconds
|
||||
mass 1 1.0
|
||||
|
||||
@ -34,24 +34,36 @@ neigh_modify delay 0 every 20 check no
|
||||
|
||||
fix 1 all nve
|
||||
|
||||
# define Python truncate() function
|
||||
|
||||
variable foo python truncate
|
||||
python truncate return v_foo input 1 iv_arg format fi here """
|
||||
def truncate(x):
|
||||
return int(x)
|
||||
"""
|
||||
|
||||
# use in equal-style variable
|
||||
|
||||
variable scalar equal py_foo(4.5)
|
||||
print "TRUNCATE ${scalar}"
|
||||
TRUNCATE 4
|
||||
|
||||
# use in atom-style variable
|
||||
# examine dump file to see truncated xyz coords of each atom
|
||||
|
||||
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 v_xtrunc v_ytrunc v_ztrunc
|
||||
|
||||
# use in vector-style variable
|
||||
|
||||
compute ke all temp
|
||||
variable ke vector c_ke
|
||||
variable ketrunc vector py_foo(v_ke)
|
||||
thermo_style custom step temp epair v_ketrunc[*6]
|
||||
|
||||
run 100
|
||||
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
|
||||
Neighbor list info ...
|
||||
@ -59,41 +71,46 @@ Neighbor list info ...
|
||||
max neighbors/atom: 2000, page size: 100000
|
||||
master list distance cutoff = 2.8
|
||||
ghost atom cutoff = 2.8
|
||||
binsize = 1.4, bins = 6 6 6
|
||||
binsize = 1.4, bins = 4 4 4
|
||||
1 neighbor lists, perpetual/occasional/extra = 1 0 0
|
||||
(1) pair lj/cut, perpetual
|
||||
attributes: half, newton on
|
||||
pair build: half/bin/atomonly/newton
|
||||
stencil: half/bin/3d
|
||||
bin: standard
|
||||
Per MPI rank memory allocation (min/avg/max) = 2.644 | 2.644 | 2.644 Mbytes
|
||||
Step Temp E_pair E_mol TotEng Press
|
||||
0 1.44 -6.7733681 0 -4.6176881 -5.0221006
|
||||
100 0.75627408 -5.7580082 0 -4.6258659 0.21870071
|
||||
Loop time of 0.014627 on 1 procs for 100 steps with 500 atoms
|
||||
Per MPI rank memory allocation (min/avg/max) = 2.598 | 2.598 | 2.598 Mbytes
|
||||
Step Temp E_pair v_ketrunc[1] v_ketrunc[2] v_ketrunc[3] v_ketrunc[4] v_ketrunc[5] v_ketrunc[6]
|
||||
0 1.44 -6.7733681 155 152 154 -10 -4 -6
|
||||
100 0.82217015 -5.8614684 113 65 84 7 -1 -12
|
||||
Loop time of 0.00278186 on 1 procs for 100 steps with 108 atoms
|
||||
|
||||
Performance: 2953445.899 tau/day, 6836.680 timesteps/s, 3.418 Matom-step/s
|
||||
Performance: 15529161.573 tau/day, 35947.133 timesteps/s, 3.882 Matom-step/s
|
||||
100.0% CPU use with 1 MPI tasks x no OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 0.010546 | 0.010546 | 0.010546 | 0.0 | 72.10
|
||||
Neigh | 0.0027775 | 0.0027775 | 0.0027775 | 0.0 | 18.99
|
||||
Comm | 0.00044818 | 0.00044818 | 0.00044818 | 0.0 | 3.06
|
||||
Output | 0.00060601 | 0.00060601 | 0.00060601 | 0.0 | 4.14
|
||||
Modify | 0.00018516 | 0.00018516 | 0.00018516 | 0.0 | 1.27
|
||||
Other | | 6.39e-05 | | | 0.44
|
||||
Pair | 0.0018161 | 0.0018161 | 0.0018161 | 0.0 | 65.29
|
||||
Neigh | 0.00057543 | 0.00057543 | 0.00057543 | 0.0 | 20.68
|
||||
Comm | 0.00019634 | 0.00019634 | 0.00019634 | 0.0 | 7.06
|
||||
Output | 0.00012056 | 0.00012056 | 0.00012056 | 0.0 | 4.33
|
||||
Modify | 4.8221e-05 | 4.8221e-05 | 4.8221e-05 | 0.0 | 1.73
|
||||
Other | | 2.516e-05 | | | 0.90
|
||||
|
||||
Nlocal: 500 ave 500 max 500 min
|
||||
Nlocal: 108 ave 108 max 108 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Nghost: 1941 ave 1941 max 1941 min
|
||||
Nghost: 980 ave 980 max 980 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
Neighs: 18766 ave 18766 max 18766 min
|
||||
Neighs: 4071 ave 4071 max 4071 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
||||
Total # of neighbors = 18766
|
||||
Ave neighs/atom = 37.532
|
||||
Total # of neighbors = 4071
|
||||
Ave neighs/atom = 37.694444
|
||||
Neighbor list builds = 5
|
||||
Dangerous builds not checked
|
||||
|
||||
print "KE TENSOR ${ketrunc}"
|
||||
KE TENSOR [113,65,84,7,-1,-12]
|
||||
|
||||
|
||||
Total wall time: 0:00:00
|
||||
|
||||
Reference in New Issue
Block a user