Mismatched Compute in Variable Formula

Hello,

I just want to first say thank you for all the past help. I am running across an error that I can not see where my issue is. I am getting that I have a mismatch compute in variable forumala.

The code:

#Computations

compute cordnum all coord/atom cutoff 2.0

compute coordnum all reduce ave c_cordnum

compute eperatom all pe/atom

compute maxeng all reduce max c_eperatom

compute mineng all reduce min c_eperatom

compute distance all pair/local dist

compute mindist all reduce min c_distance

compute maxdist all reduce max c_distance

variable test1 equal “c_eperatom[1]”

variable test2 equal “c_eperatom[2]”

variable test3 equal “c_eperatom[3]”

variable test4 equal “c_eperatom[4]”

variable test5 equal “c_eperatom[5]”

variable test6 equal “c_eperatom[6]”

variable test7 equal “c_eperatom[7]”

variable test8 equal “c_eperatom[8]”

variable test9 equal “c_eperatom[9]”

variable test10 equal “c_eperatom[10]”

variable test11 equal “c_eperatom[11]”

variable test12 equal “c_eperatom[12]”

variable test13 equal “c_eperatom[13]”

variable dtest equal “c_distance[1]”

Minimize/Run Sim

reset_timestep 0

thermo 10

thermo_style custom step c_coordnum v_dtest v_test1 v_test2 v_test3 v_test4 v_test5 v_test6 v_test7 v_test8 v_test9 v_test10 v_test11 v_test12 v_test13

min_style cg

minimize 1e-25 1e-25 100 1000

I feel since pair/local will give a vector for the pair distances, I should be able to do a similar way of looking at the individual components like I do for the energy, but I keep getting an error that will not allow me to look a the individual pair distance value.

Thank you,

Philip Chrostoski

PhD Candidate

Department of Physics and Astronomy

Center for Nanoscience

University of Missouri - St. Louis

please make an effort to debug your input yourself. just take out all the compute related lines and put them back in steps and try a run after each step. at some point, it will fail, and then you know which step is problematic and then you take out everything else and try to narrow it down and compare to the documentation unless you have found the reason and can fix it.

if you find a mismatch between the documentation and the behavior of LAMMPS. please report back, as that is a possible indication of a bug in LAMMPS. but make certain, that you have conclusive proof. :wink:

axel.

Hello Axel,

I had debugged as much as I could before messaging in. Sorry if my questions are being too vague. I just did some more debugging this morning and like before, my code fails when I try to get the vector components for pair/local distance values.

Stated in LAMMPS documentation, pair/local compute makes a vector or an array based on the amount of keywords, quote: “This compute calculates a local vector or local array depending on the number of keywords.” My only keyword is dist, so I should get a vector, so then when I try to grab one single component I create a variable to look at that desired component, but I get a mismatch in the compute for my variable. I have gone back and checked spelling, but I do not see an error. This method works perfectly for energy values that Steve was able to help me with when getting the pe/atom, I just do not see why this method is erroring out. I will post my code for just getting the pair/local dist vector components.

Just to preface, the supercomputer I am working on is using the oct 23 2017 version of LAMMPS. This may be a bug from this older version that you have fixed in a newer version.

Code:

Initialzation

clear

units metal

dimension 3

boundary f f f

atom_style full

Create Atoms

region space block -1000 1000 -1000 1000 -1000 1000

create_box 1 space

create_atoms 1 single 0 0 0

create_atoms 1 single -0.5 0.86 0

create_atoms 1 single -1.5 0.86 0

create_atoms 1 single -2 0 0

create_atoms 1 single -1.5 -0.86 0

create_atoms 1 single -0.5 -0.86 0

create_atoms 1 single 1 0 0

create_atoms 1 single 0 1.73 0

create_atoms 1 single 0 -1.73 0

create_atoms 1 single 1.5 0.86 0

create_atoms 1 single 1 -1.73 0

create_atoms 1 single 1.5 -0.86 0

create_atoms 1 single 1 1.73 0

mass 1 12

Set Interatomic Potential

pair_style lcbop

pair_coeff * * C.lcbop C

neighbor 0.1 bin

neigh_modify delay 10 check yes

Computations

compute distance all pair/local dist

variable dtest equal “c_distance[1]”

Minimize/Run Sim

reset_timestep 0

thermo 10

thermo_style custom step v_dtest

min_style cg

minimize 1e-25 1e-25 100 1000

Print Outputs

print “The bond distance for atom 1 = ${v_dtest};”

print " "

print “This Ran!”

ERROR: Mismatched compute in variable formula (…/variable.cpp:1547)

Thank you for all of the help,

Philip Chrostoski

PhD Candidate

Department of Physics and Astronomy

Center for Nanoscience

University of Missouri - St. Louis

what you see is documented behavior. compute pe/atom computes a per-atom vector. compute pair/local doesn’t; it computes “local” data. here is the relevant section on accessing individual vector/array elements in variables:

As discussed in the doc page for the compute command, computes can produce global, per-atom, or local values. Only global and per-atom values can be used in a variable.

there you have it. what you are trying to do is not supported.

axel.