diff --git a/doc/src/python.rst b/doc/src/python.rst index f39e7a505d..c23b44d5d8 100644 --- a/doc/src/python.rst +++ b/doc/src/python.rst @@ -593,7 +593,7 @@ variable which invokes the same Python "truncate" function: compute ke all temp variable ke vector c_ke variable ketrunc vector py_foo(v_ke) - thermo_style custom step temp epair v_ketrunc[*] + thermo_style custom step temp epair v_ketrunc[*6] The vector-style variable "ketrunc" invokes the Python "truncate" function on each of the 6 components of the global kinetic energy @@ -601,8 +601,9 @@ tensor calculated by the :doc:`compute ke ` command. The 6 truncated values will be printed with thermo output to the screen and log file. -Alternatively, the last 2 lines can be replaced by these to define -atom-style variables which invoke the same Python "truncate" function: +Or the last 2 lines of the equal-style variable example can be +replaced by these to define atom-style variables which invoke the same +Python "truncate" function: .. code-block:: LAMMPS @@ -625,13 +626,13 @@ example, consider these (made up) commands: .. code-block:: LAMMPS variable foo python mixedargs - python mixedargs return v_foo input 6 7.5 v_myValue iv_arg1 iv_argy iv_argz v_flags & + python mixedargs return v_foo input 6 7.5 v_myValue iv_arg1 iv_argy iv_argz v_flag & format fffffsf here """ -def mixedargs(a,b,x,y,z,flags): +def mixedargs(a,b,x,y,z,flag): ... return result """ - variable flags string optionABC + variable flag string optionABC variable myValue equal "2.0*temp*c_pe" compute pe all pe compute peatom all pe/atom @@ -644,13 +645,13 @@ In this example, these arguments are themselves small formulas containing the x,y,z coordinates of each atom as well as a per-atom compute (c_peratom) and thermodynamic keyword (zlo). -The other three arguements (7.5,v_myValue,v_flags) are defined by the +The other three arguements (7.5,v_myValue,v_flag) are defined by the *python* command. The first and last are constant values (7.5 and the optionABC string). The second argument (myValue) is the result of an equal-style variable formula which accesses the system temperature and potential energy. -The "result" returned by teach invocation of the Python "mixedargs" +The "result" returned by each invocation of the Python "mixedargs" function becomes the per-atom value in the atom-style "field" variable, which could be output to a dump file or used elsewhere in the input script. diff --git a/examples/python/dump.1May25.python.wrap.g++.1 b/examples/python/dump.1May25.python.wrap.g++.1 new file mode 100644 index 0000000000..b294b70d67 --- /dev/null +++ b/examples/python/dump.1May25.python.wrap.g++.1 @@ -0,0 +1,234 @@ +ITEM: TIMESTEP +0 +ITEM: NUMBER OF ATOMS +108 +ITEM: BOX BOUNDS pp pp pp +0.0000000000000000e+00 5.0387885741475218e+00 +0.0000000000000000e+00 5.0387885741475218e+00 +0.0000000000000000e+00 5.0387885741475218e+00 +ITEM: ATOMS id x y z v_xtrunc v_ytrunc v_ztrunc +1 0 0 0 0 0 0 +2 0.839798 0.839798 0 0 0 0 +3 0.839798 0 0.839798 0 0 0 +4 0 0.839798 0.839798 0 0 0 +5 1.6796 0 0 1 0 0 +6 2.51939 0.839798 0 2 0 0 +7 2.51939 0 0.839798 2 0 0 +8 1.6796 0.839798 0.839798 1 0 0 +9 3.35919 0 0 3 0 0 +10 4.19899 0.839798 0 4 0 0 +11 4.19899 0 0.839798 4 0 0 +12 3.35919 0.839798 0.839798 3 0 0 +13 0 1.6796 0 0 1 0 +14 0.839798 2.51939 0 0 2 0 +15 0.839798 1.6796 0.839798 0 1 0 +16 0 2.51939 0.839798 0 2 0 +17 1.6796 1.6796 0 1 1 0 +18 2.51939 2.51939 0 2 2 0 +19 2.51939 1.6796 0.839798 2 1 0 +20 1.6796 2.51939 0.839798 1 2 0 +21 3.35919 1.6796 0 3 1 0 +22 4.19899 2.51939 0 4 2 0 +23 4.19899 1.6796 0.839798 4 1 0 +24 3.35919 2.51939 0.839798 3 2 0 +25 0 3.35919 0 0 3 0 +26 0.839798 4.19899 0 0 4 0 +27 0.839798 3.35919 0.839798 0 3 0 +28 0 4.19899 0.839798 0 4 0 +29 1.6796 3.35919 0 1 3 0 +30 2.51939 4.19899 0 2 4 0 +31 2.51939 3.35919 0.839798 2 3 0 +32 1.6796 4.19899 0.839798 1 4 0 +33 3.35919 3.35919 0 3 3 0 +34 4.19899 4.19899 0 4 4 0 +35 4.19899 3.35919 0.839798 4 3 0 +36 3.35919 4.19899 0.839798 3 4 0 +37 0 0 1.6796 0 0 1 +38 0.839798 0.839798 1.6796 0 0 1 +39 0.839798 0 2.51939 0 0 2 +40 0 0.839798 2.51939 0 0 2 +41 1.6796 0 1.6796 1 0 1 +42 2.51939 0.839798 1.6796 2 0 1 +43 2.51939 0 2.51939 2 0 2 +44 1.6796 0.839798 2.51939 1 0 2 +45 3.35919 0 1.6796 3 0 1 +46 4.19899 0.839798 1.6796 4 0 1 +47 4.19899 0 2.51939 4 0 2 +48 3.35919 0.839798 2.51939 3 0 2 +49 0 1.6796 1.6796 0 1 1 +50 0.839798 2.51939 1.6796 0 2 1 +51 0.839798 1.6796 2.51939 0 1 2 +52 0 2.51939 2.51939 0 2 2 +53 1.6796 1.6796 1.6796 1 1 1 +54 2.51939 2.51939 1.6796 2 2 1 +55 2.51939 1.6796 2.51939 2 1 2 +56 1.6796 2.51939 2.51939 1 2 2 +57 3.35919 1.6796 1.6796 3 1 1 +58 4.19899 2.51939 1.6796 4 2 1 +59 4.19899 1.6796 2.51939 4 1 2 +60 3.35919 2.51939 2.51939 3 2 2 +61 0 3.35919 1.6796 0 3 1 +62 0.839798 4.19899 1.6796 0 4 1 +63 0.839798 3.35919 2.51939 0 3 2 +64 0 4.19899 2.51939 0 4 2 +65 1.6796 3.35919 1.6796 1 3 1 +66 2.51939 4.19899 1.6796 2 4 1 +67 2.51939 3.35919 2.51939 2 3 2 +68 1.6796 4.19899 2.51939 1 4 2 +69 3.35919 3.35919 1.6796 3 3 1 +70 4.19899 4.19899 1.6796 4 4 1 +71 4.19899 3.35919 2.51939 4 3 2 +72 3.35919 4.19899 2.51939 3 4 2 +73 0 0 3.35919 0 0 3 +74 0.839798 0.839798 3.35919 0 0 3 +75 0.839798 0 4.19899 0 0 4 +76 0 0.839798 4.19899 0 0 4 +77 1.6796 0 3.35919 1 0 3 +78 2.51939 0.839798 3.35919 2 0 3 +79 2.51939 0 4.19899 2 0 4 +80 1.6796 0.839798 4.19899 1 0 4 +81 3.35919 0 3.35919 3 0 3 +82 4.19899 0.839798 3.35919 4 0 3 +83 4.19899 0 4.19899 4 0 4 +84 3.35919 0.839798 4.19899 3 0 4 +85 0 1.6796 3.35919 0 1 3 +86 0.839798 2.51939 3.35919 0 2 3 +87 0.839798 1.6796 4.19899 0 1 4 +88 0 2.51939 4.19899 0 2 4 +89 1.6796 1.6796 3.35919 1 1 3 +90 2.51939 2.51939 3.35919 2 2 3 +91 2.51939 1.6796 4.19899 2 1 4 +92 1.6796 2.51939 4.19899 1 2 4 +93 3.35919 1.6796 3.35919 3 1 3 +94 4.19899 2.51939 3.35919 4 2 3 +95 4.19899 1.6796 4.19899 4 1 4 +96 3.35919 2.51939 4.19899 3 2 4 +97 0 3.35919 3.35919 0 3 3 +98 0.839798 4.19899 3.35919 0 4 3 +99 0.839798 3.35919 4.19899 0 3 4 +100 0 4.19899 4.19899 0 4 4 +101 1.6796 3.35919 3.35919 1 3 3 +102 2.51939 4.19899 3.35919 2 4 3 +103 2.51939 3.35919 4.19899 2 3 4 +104 1.6796 4.19899 4.19899 1 4 4 +105 3.35919 3.35919 3.35919 3 3 3 +106 4.19899 4.19899 3.35919 4 4 3 +107 4.19899 3.35919 4.19899 4 3 4 +108 3.35919 4.19899 4.19899 3 4 4 +ITEM: TIMESTEP +100 +ITEM: NUMBER OF ATOMS +108 +ITEM: BOX BOUNDS pp pp pp +0.0000000000000000e+00 5.0387885741475218e+00 +0.0000000000000000e+00 5.0387885741475218e+00 +0.0000000000000000e+00 5.0387885741475218e+00 +ITEM: ATOMS id x y z v_xtrunc v_ytrunc v_ztrunc +1 4.97801 0.0605812 4.88474 4 0 4 +2 0.800305 0.813213 0.0576603 0 0 0 +3 0.6485 5.00484 0.836947 0 5 0 +4 5.01236 0.786108 0.77507 5 0 0 +5 1.50261 4.9277 4.9755 1 4 4 +6 2.46756 0.653742 5.0003 2 0 5 +7 2.55699 4.96491 0.926671 2 4 0 +8 1.62464 0.676882 0.777822 1 0 0 +9 3.57018 0.00324557 4.76943 3 0 4 +10 4.24909 0.985667 5.01613 4 0 5 +11 4.13124 0.178555 0.700886 4 0 0 +12 3.22537 0.963341 0.639686 3 0 0 +13 4.90815 1.75715 0.0826318 4 1 0 +14 1.00239 2.45421 0.0111309 1 2 0 +15 0.88902 1.62097 0.874547 0 1 0 +16 0.269512 2.41383 0.844638 0 2 0 +17 1.54513 1.51174 0.0869798 1 1 0 +18 2.0637 2.5991 0.0826392 2 2 0 +19 2.44634 1.71869 0.918144 2 1 0 +20 1.57997 2.52559 1.04361 1 2 1 +21 3.26063 2.10027 0.0160498 3 2 0 +22 4.21774 2.61172 0.0367453 4 2 0 +23 4.32215 1.8333 0.925663 4 1 0 +24 3.38151 2.6788 0.906258 3 2 0 +25 0.275459 3.26838 0.21932 0 3 0 +26 0.675354 4.14887 4.94054 0 4 4 +27 0.867201 3.35405 1.17655 0 3 1 +28 4.78788 4.34273 0.478103 4 4 0 +29 1.42014 3.50181 0.191388 1 3 0 +30 2.39935 4.14279 0.0726977 2 4 0 +31 2.68157 3.57418 0.921633 2 3 0 +32 1.77965 4.13041 0.925765 1 4 0 +33 3.10555 3.22911 5.00703 3 3 5 +34 4.24908 3.67507 4.83053 4 3 4 +35 4.2444 3.59428 0.837193 4 3 0 +36 3.52155 4.21032 0.423884 3 4 0 +37 0.00881412 4.90616 1.74242 0 4 1 +38 0.800033 0.812556 1.72553 0 0 1 +39 0.929754 0.0251285 2.53734 0 0 2 +40 0.0189933 0.897729 2.4272 0 0 2 +41 1.77025 0.0864618 1.69637 1 0 1 +42 2.6077 0.984882 1.7897 2 0 1 +43 2.55819 4.95626 2.45373 2 4 2 +44 1.77963 0.875522 2.5056 1 0 2 +45 3.50499 0.0189748 1.5186 3 0 1 +46 4.47856 0.849521 1.59138 4 0 1 +47 3.99 0.309367 2.42507 3 0 2 +48 3.06373 0.748905 2.87477 3 0 2 +49 0.149175 1.72252 1.81302 0 1 1 +50 0.963279 2.42412 1.76899 0 2 1 +51 0.879984 1.74899 2.55389 0 1 2 +52 0.211736 2.57456 2.48446 0 2 2 +53 1.75238 1.7433 1.79028 1 1 1 +54 2.61023 2.6802 1.55816 2 2 1 +55 2.55259 1.72904 2.60295 2 1 2 +56 1.7903 2.56204 2.41895 1 2 2 +57 3.43857 1.71819 1.54054 3 1 1 +58 4.20455 2.5331 1.87607 4 2 1 +59 4.12961 1.48438 2.40107 4 1 2 +60 3.36606 2.52455 2.67203 3 2 2 +61 0.0138563 3.23504 1.76147 0 3 1 +62 0.968224 4.42746 1.67526 0 4 1 +63 0.965745 3.43479 2.52674 0 3 2 +64 0.144542 4.27264 2.61793 0 4 2 +65 1.7741 3.32184 1.66819 1 3 1 +66 2.4878 4.29352 1.69069 2 4 1 +67 2.56992 3.44579 2.4534 2 3 2 +68 1.72356 4.2344 2.49376 1 4 2 +69 3.43363 3.36417 1.87451 3 3 1 +70 4.32623 4.1046 1.69102 4 4 1 +71 4.22927 3.23505 2.64208 4 3 2 +72 3.41086 4.28362 2.42553 3 4 2 +73 4.85349 0.0953155 3.14546 4 0 3 +74 0.833593 0.840282 3.27238 0 0 3 +75 0.578712 4.99093 3.85234 0 4 3 +76 0.119704 1.00404 4.09942 0 1 4 +77 1.78347 4.95586 3.31184 1 4 3 +78 2.34318 0.736887 3.54475 2 0 3 +79 2.34858 4.82316 4.28272 2 4 4 +80 1.55893 0.765128 4.31112 1 0 4 +81 3.13128 0.0257347 3.70936 3 0 3 +82 4.10851 0.877375 3.36388 4 0 3 +83 4.30691 4.69041 4.14081 4 4 4 +84 3.48471 1.07347 4.35888 3 1 4 +85 0.0668209 1.77975 3.29313 0 1 3 +86 0.894798 2.5043 3.34172 0 2 3 +87 0.743432 1.71961 4.3483 0 1 4 +88 0.135168 2.69084 4.12098 0 2 4 +89 1.73749 1.5259 3.46692 1 1 3 +90 2.47391 2.57508 3.27574 2 2 3 +91 2.4825 1.46064 4.38907 2 1 4 +92 1.67786 2.47309 4.03082 1 2 4 +93 3.34694 1.70248 3.44784 3 1 3 +94 4.20676 2.29697 3.23228 4 2 3 +95 4.31748 1.76411 4.20898 4 1 4 +96 3.1135 2.59262 4.08996 3 2 4 +97 0.0727406 3.44797 3.30247 0 3 3 +98 1.0752 4.05296 3.38036 1 4 3 +99 1.0085 3.35058 4.3598 1 3 4 +100 0.054939 4.00087 4.11831 0 4 4 +101 1.72259 3.24691 3.19685 1 3 3 +102 2.54324 4.21582 3.29642 2 4 3 +103 2.33008 3.38603 4.27885 2 3 4 +104 1.65617 4.10852 4.3491 1 4 4 +105 3.14646 3.43756 3.28105 3 3 3 +106 4.09781 4.10691 3.24439 4 4 3 +107 4.1529 3.22538 3.79605 4 3 3 +108 3.16394 3.96553 4.31023 3 3 4 diff --git a/examples/python/dump.1May25.python.wrap.g++.4 b/examples/python/dump.1May25.python.wrap.g++.4 new file mode 100644 index 0000000000..4f1ad1f2c8 --- /dev/null +++ b/examples/python/dump.1May25.python.wrap.g++.4 @@ -0,0 +1,234 @@ +ITEM: TIMESTEP +0 +ITEM: NUMBER OF ATOMS +108 +ITEM: BOX BOUNDS pp pp pp +0.0000000000000000e+00 5.0387885741475218e+00 +0.0000000000000000e+00 5.0387885741475218e+00 +0.0000000000000000e+00 5.0387885741475218e+00 +ITEM: ATOMS id x y z v_xtrunc v_ytrunc v_ztrunc +1 0 0 0 0 0 0 +2 0.839798 0.839798 0 0 0 0 +3 0.839798 0 0.839798 0 0 0 +4 0 0.839798 0.839798 0 0 0 +13 0 1.6796 0 0 1 0 +14 0.839798 1.6796 0.839798 0 1 0 +19 0 0 1.6796 0 0 1 +20 0.839798 0.839798 1.6796 0 0 1 +25 0 1.6796 1.6796 0 1 1 +5 1.6796 0 0 1 0 0 +6 2.51939 0.839798 0 2 0 0 +7 2.51939 0 0.839798 2 0 0 +8 1.6796 0.839798 0.839798 1 0 0 +15 1.6796 1.6796 0 1 1 0 +16 2.51939 1.6796 0.839798 2 1 0 +21 1.6796 0 1.6796 1 0 1 +22 2.51939 0.839798 1.6796 2 0 1 +26 1.6796 1.6796 1.6796 1 1 1 +9 3.35919 0 0 3 0 0 +10 4.19899 0.839798 0 4 0 0 +11 4.19899 0 0.839798 4 0 0 +12 3.35919 0.839798 0.839798 3 0 0 +17 3.35919 1.6796 0 3 1 0 +18 4.19899 1.6796 0.839798 4 1 0 +23 3.35919 0 1.6796 3 0 1 +24 4.19899 0.839798 1.6796 4 0 1 +27 3.35919 1.6796 1.6796 3 1 1 +28 0.839798 0 2.51939 0 0 2 +29 0 0.839798 2.51939 0 0 2 +34 0.839798 1.6796 2.51939 0 1 2 +37 0 0 3.35919 0 0 3 +38 0.839798 0.839798 3.35919 0 0 3 +39 0.839798 0 4.19899 0 0 4 +40 0 0.839798 4.19899 0 0 4 +49 0 1.6796 3.35919 0 1 3 +50 0.839798 1.6796 4.19899 0 1 4 +30 2.51939 0 2.51939 2 0 2 +31 1.6796 0.839798 2.51939 1 0 2 +35 2.51939 1.6796 2.51939 2 1 2 +41 1.6796 0 3.35919 1 0 3 +42 2.51939 0.839798 3.35919 2 0 3 +43 2.51939 0 4.19899 2 0 4 +44 1.6796 0.839798 4.19899 1 0 4 +51 1.6796 1.6796 3.35919 1 1 3 +52 2.51939 1.6796 4.19899 2 1 4 +32 4.19899 0 2.51939 4 0 2 +33 3.35919 0.839798 2.51939 3 0 2 +36 4.19899 1.6796 2.51939 4 1 2 +45 3.35919 0 3.35919 3 0 3 +46 4.19899 0.839798 3.35919 4 0 3 +47 4.19899 0 4.19899 4 0 4 +48 3.35919 0.839798 4.19899 3 0 4 +53 3.35919 1.6796 3.35919 3 1 3 +54 4.19899 1.6796 4.19899 4 1 4 +55 0.839798 2.51939 0 0 2 0 +56 0 2.51939 0.839798 0 2 0 +61 0 3.35919 0 0 3 0 +62 0.839798 4.19899 0 0 4 0 +63 0.839798 3.35919 0.839798 0 3 0 +64 0 4.19899 0.839798 0 4 0 +73 0.839798 2.51939 1.6796 0 2 1 +76 0 3.35919 1.6796 0 3 1 +77 0.839798 4.19899 1.6796 0 4 1 +57 2.51939 2.51939 0 2 2 0 +58 1.6796 2.51939 0.839798 1 2 0 +65 1.6796 3.35919 0 1 3 0 +66 2.51939 4.19899 0 2 4 0 +67 2.51939 3.35919 0.839798 2 3 0 +68 1.6796 4.19899 0.839798 1 4 0 +74 2.51939 2.51939 1.6796 2 2 1 +78 1.6796 3.35919 1.6796 1 3 1 +79 2.51939 4.19899 1.6796 2 4 1 +59 4.19899 2.51939 0 4 2 0 +60 3.35919 2.51939 0.839798 3 2 0 +69 3.35919 3.35919 0 3 3 0 +70 4.19899 4.19899 0 4 4 0 +71 4.19899 3.35919 0.839798 4 3 0 +72 3.35919 4.19899 0.839798 3 4 0 +75 4.19899 2.51939 1.6796 4 2 1 +80 3.35919 3.35919 1.6796 3 3 1 +81 4.19899 4.19899 1.6796 4 4 1 +82 0 2.51939 2.51939 0 2 2 +85 0.839798 3.35919 2.51939 0 3 2 +86 0 4.19899 2.51939 0 4 2 +91 0.839798 2.51939 3.35919 0 2 3 +92 0 2.51939 4.19899 0 2 4 +97 0 3.35919 3.35919 0 3 3 +98 0.839798 4.19899 3.35919 0 4 3 +99 0.839798 3.35919 4.19899 0 3 4 +100 0 4.19899 4.19899 0 4 4 +83 1.6796 2.51939 2.51939 1 2 2 +87 2.51939 3.35919 2.51939 2 3 2 +88 1.6796 4.19899 2.51939 1 4 2 +93 2.51939 2.51939 3.35919 2 2 3 +94 1.6796 2.51939 4.19899 1 2 4 +101 1.6796 3.35919 3.35919 1 3 3 +102 2.51939 4.19899 3.35919 2 4 3 +103 2.51939 3.35919 4.19899 2 3 4 +104 1.6796 4.19899 4.19899 1 4 4 +84 3.35919 2.51939 2.51939 3 2 2 +89 4.19899 3.35919 2.51939 4 3 2 +90 3.35919 4.19899 2.51939 3 4 2 +95 4.19899 2.51939 3.35919 4 2 3 +96 3.35919 2.51939 4.19899 3 2 4 +105 3.35919 3.35919 3.35919 3 3 3 +106 4.19899 4.19899 3.35919 4 4 3 +107 4.19899 3.35919 4.19899 4 3 4 +108 3.35919 4.19899 4.19899 3 4 4 +ITEM: TIMESTEP +100 +ITEM: NUMBER OF ATOMS +108 +ITEM: BOX BOUNDS pp pp pp +0.0000000000000000e+00 5.0387885741475218e+00 +0.0000000000000000e+00 5.0387885741475218e+00 +0.0000000000000000e+00 5.0387885741475218e+00 +ITEM: ATOMS id x y z v_xtrunc v_ytrunc v_ztrunc +27 3.43857 1.71819 1.54054 3 1 1 +55 1.00239 2.45421 0.0111309 1 2 0 +24 4.47856 0.849521 1.59138 4 0 1 +4 5.01236 0.786108 0.77507 5 0 0 +13 4.90815 1.75715 0.0826318 4 1 0 +14 0.88902 1.62097 0.874547 0 1 0 +23 3.50499 0.0189748 1.5186 3 0 1 +20 0.800033 0.812556 1.72553 0 0 1 +25 0.149175 1.72252 1.81302 0 1 1 +18 4.32215 1.8333 0.925663 4 1 0 +2 0.800305 0.813213 0.0576603 0 0 0 +11 4.13124 0.178555 0.700886 4 0 0 +8 1.62464 0.676882 0.777822 1 0 0 +15 1.54513 1.51174 0.0869798 1 1 0 +16 2.44634 1.71869 0.918144 2 1 0 +21 1.77025 0.0864618 1.69637 1 0 1 +22 2.6077 0.984882 1.7897 2 0 1 +26 1.75238 1.7433 1.79028 1 1 1 +56 0.269512 2.41383 0.844638 0 2 0 +73 0.963279 2.42412 1.76899 0 2 1 +12 3.22537 0.963341 0.639686 3 0 0 +29 0.0189933 0.897729 2.4272 0 0 2 +36 4.12961 1.48438 2.40107 4 1 2 +31 1.77963 0.875522 2.5056 1 0 2 +17 3.26063 2.10027 0.0160498 3 2 0 +32 3.99 0.309367 2.42507 3 0 2 +10 4.24909 0.985667 5.01613 4 0 5 +9 3.57018 0.00324557 4.76943 3 0 4 +34 0.879984 1.74899 2.55389 0 1 2 +54 4.31748 1.76411 4.20898 4 1 4 +38 0.833593 0.840282 3.27238 0 0 3 +53 3.34694 1.70248 3.44784 3 1 3 +40 0.119704 1.00404 4.09942 0 1 4 +49 0.0668209 1.77975 3.29313 0 1 3 +50 0.743432 1.71961 4.3483 0 1 4 +1 4.97801 0.0605812 4.88474 4 0 4 +28 0.929754 0.0251285 2.53734 0 0 2 +94 1.67786 2.47309 4.03082 1 2 4 +48 3.48471 1.07347 4.35888 3 1 4 +42 2.34318 0.736887 3.54475 2 0 3 +46 4.10851 0.877375 3.36388 4 0 3 +44 1.55893 0.765128 4.31112 1 0 4 +51 1.73749 1.5259 3.46692 1 1 3 +52 2.4825 1.46064 4.38907 2 1 4 +45 3.13128 0.0257347 3.70936 3 0 3 +33 3.06373 0.748905 2.87477 3 0 2 +37 4.85349 0.0953155 3.14546 4 0 3 +95 4.20676 2.29697 3.23228 4 2 3 +91 0.894798 2.5043 3.34172 0 2 3 +6 2.46756 0.653742 5.0003 2 0 5 +35 2.55259 1.72904 2.60295 2 1 2 +75 4.20455 2.5331 1.87607 4 2 1 +83 1.7903 2.56204 2.41895 1 2 2 +90 3.41086 4.28362 2.42553 3 4 2 +7 2.55699 4.96491 0.926671 2 4 0 +63 0.867201 3.35405 1.17655 0 3 1 +64 4.78788 4.34273 0.478103 4 4 0 +81 4.32623 4.1046 1.69102 4 4 1 +76 0.0138563 3.23504 1.76147 0 3 1 +77 0.968224 4.42746 1.67526 0 4 1 +57 2.0637 2.5991 0.0826392 2 2 0 +80 3.43363 3.36417 1.87451 3 3 1 +65 1.42014 3.50181 0.191388 1 3 0 +58 1.57997 2.52559 1.04361 1 2 1 +67 2.68157 3.57418 0.921633 2 3 0 +68 1.77965 4.13041 0.925765 1 4 0 +74 2.61023 2.6802 1.55816 2 2 1 +78 1.7741 3.32184 1.66819 1 3 1 +79 2.4878 4.29352 1.69069 2 4 1 +59 4.21774 2.61172 0.0367453 4 2 0 +72 3.52155 4.21032 0.423884 3 4 0 +19 0.00881412 4.90616 1.74242 0 4 1 +71 4.2444 3.59428 0.837193 4 3 0 +60 3.38151 2.6788 0.906258 3 2 0 +88 1.72356 4.2344 2.49376 1 4 2 +87 2.56992 3.44579 2.4534 2 3 2 +61 0.275459 3.26838 0.21932 0 3 0 +3 0.6485 5.00484 0.836947 0 5 0 +66 2.39935 4.14279 0.0726977 2 4 0 +82 0.211736 2.57456 2.48446 0 2 2 +30 2.55819 4.95626 2.45373 2 4 2 +108 3.16394 3.96553 4.31023 3 3 4 +62 0.675354 4.14887 4.94054 0 4 4 +47 4.30691 4.69041 4.14081 4 4 4 +107 4.1529 3.22538 3.79605 4 3 3 +92 0.135168 2.69084 4.12098 0 2 4 +97 0.0727406 3.44797 3.30247 0 3 3 +98 1.0752 4.05296 3.38036 1 4 3 +99 1.0085 3.35058 4.3598 1 3 4 +100 0.054939 4.00087 4.11831 0 4 4 +106 4.09781 4.10691 3.24439 4 4 3 +70 4.24908 3.67507 4.83053 4 3 4 +43 2.34858 4.82316 4.28272 2 4 4 +105 3.14646 3.43756 3.28105 3 3 3 +96 3.1135 2.59262 4.08996 3 2 4 +101 1.72259 3.24691 3.19685 1 3 3 +102 2.54324 4.21582 3.29642 2 4 3 +103 2.33008 3.38603 4.27885 2 3 4 +104 1.65617 4.10852 4.3491 1 4 4 +84 3.36606 2.52455 2.67203 3 2 2 +89 4.22927 3.23505 2.64208 4 3 2 +41 1.78347 4.95586 3.31184 1 4 3 +93 2.47391 2.57508 3.27574 2 2 3 +39 0.578712 4.99093 3.85234 0 4 3 +86 0.144542 4.27264 2.61793 0 4 2 +5 1.50261 4.9277 4.9755 1 4 4 +69 3.10555 3.22911 5.00703 3 3 5 +85 0.965745 3.43479 2.52674 0 3 2 diff --git a/examples/python/in.python.wrap b/examples/python/in.python.wrap index 35c080f11b..47a2d3a572 100644 --- a/examples/python/in.python.wrap +++ b/examples/python/in.python.wrap @@ -1,9 +1,9 @@ # 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 @@ -24,21 +24,37 @@ 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}" +# 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 + +print "KE TENSOR ${ketrunc}" + + diff --git a/examples/python/log.1May25.python.wrap.g++.1 b/examples/python/log.1May25.python.wrap.g++.1 index a5edfe079e..3a7dd1c7b2 100644 --- a/examples/python/log.1May25.python.wrap.g++.1 +++ b/examples/python/log.1May25.python.wrap.g++.1 @@ -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 diff --git a/examples/python/log.1May25.python.wrap.g++.4 b/examples/python/log.1May25.python.wrap.g++.4 index ff3e94ddf7..5f28f5bc34 100644 --- a/examples/python/log.1May25.python.wrap.g++.4 +++ b/examples/python/log.1May25.python.wrap.g++.4 @@ -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 2 by 2 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.609 | 2.609 | 2.609 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.0062374 on 4 procs for 100 steps with 500 atoms +Per MPI rank memory allocation (min/avg/max) = 2.59 | 2.59 | 2.59 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.00268845 on 4 procs for 100 steps with 108 atoms -Performance: 6925957.189 tau/day, 16032.308 timesteps/s, 8.016 Matom-step/s -74.7% CPU use with 4 MPI tasks x no OpenMP threads +Performance: 16068745.964 tau/day, 37196.171 timesteps/s, 4.017 Matom-step/s +66.7% CPU use with 4 MPI tasks x no OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.0027648 | 0.0028431 | 0.0029465 | 0.1 | 45.58 -Neigh | 0.00084567 | 0.00086563 | 0.00088168 | 0.0 | 13.88 -Comm | 0.0020822 | 0.0021609 | 0.0022418 | 0.1 | 34.64 -Output | 0.00021567 | 0.00022125 | 0.00022624 | 0.0 | 3.55 -Modify | 6.2567e-05 | 6.4105e-05 | 6.63e-05 | 0.0 | 1.03 -Other | | 8.241e-05 | | | 1.32 +Pair | 0.00043389 | 0.00051695 | 0.00061255 | 0.0 | 19.23 +Neigh | 0.00017121 | 0.00018976 | 0.00019891 | 0.0 | 7.06 +Comm | 0.0017423 | 0.0018487 | 0.0019509 | 0.2 | 68.76 +Output | 6.7449e-05 | 6.9998e-05 | 7.5195e-05 | 0.0 | 2.60 +Modify | 2.1329e-05 | 2.2855e-05 | 2.4821e-05 | 0.0 | 0.85 +Other | | 4.018e-05 | | | 1.49 -Nlocal: 125 ave 126 max 123 min -Histogram: 1 0 0 0 0 0 1 0 0 2 -Nghost: 1085.75 ave 1090 max 1082 min -Histogram: 1 0 1 0 0 0 1 0 0 1 -Neighs: 4691.5 ave 4969 max 4368 min -Histogram: 1 0 0 0 1 0 0 1 0 1 +Nlocal: 27 ave 30 max 25 min +Histogram: 1 0 1 0 1 0 0 0 0 1 +Nghost: 614 ave 616 max 612 min +Histogram: 1 0 1 0 0 0 0 1 0 1 +Neighs: 1017.75 ave 1149 max 894 min +Histogram: 1 1 0 0 0 0 0 1 0 1 -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