I have been working on writing a simple Li-H system to determine the atom ID atom that is maximally stretched from a neighbor.
compute C1 all property/atom id
compute C2 all pair/local dist
compute C3 all reduce max c_C1 c_C2 replace 1 2
variable MY_ATOM_ID equal c_C3[1]
Then I made a couple of changes, and this is how my last script looks like:
Li-H system for finding max nonbonded stretch
units metal
atom_style full
dimension 3
boundary p p p
region box block 0 10 0 10 0 10
create_box 2 box
Create 5 Li and 5 H atoms
create_atoms 1 random 5 12345 box
create_atoms 2 random 5 54321 box
mass 1 6.941
mass 2 1.008
pair_style lj/cut 5.0
pair_coeff * * 1.0 1.0
pair_coeff 1 1 0.5 1.5
pair_coeff 2 2 0.3 1.2
pair_coeff 1 2 0.7 1.3
Get atom IDs for all interacting pairs
compute C1 all property/local patom1 patom2
compute C2 all pair/local dist
Find pair with max distance
compute C3 all reduce max c_C1[1] c_C1[2] c_C2 replace 1 3 replace 2 3
Variables to store the result
variable A equal c_C3[1]
variable B equal c_C3[2]
variable D equal c_C3[3]
thermo 1
thermo_style custom step v_A v_B v_D
run 0
print “Nonbonded pair with maximal stretch: {A} and {B}, distance = ${D}”
It appears that the August 2023 version runs the script without any issues, but in my version (August 2024), I keep encountering the following error: “Compute reduce compute C1 does not calculate per-atom values.”