variable style equal can be used with per atom value x[i] but not with fx[i]

Dear all,

According to the doc page of the variable command and my runs, `variable dis equal sqrt((x[1]-x[2])^2+(y[1]-y[2])^2+(z[1]-z[2])^2)` can be used to set the distance of two atoms as a variable and output with fix print command. However, if I use `variable Force equil sqrt(fx[1]^2+fy[1]^2+fz[1]^2)` to set a variable to be the force magnitude acting on atom 1, LAMMPS will give the error "Illegal variable command". I think x[i] and fx[i] are both the elements of an atom type vector, so they should be equivalent for the variable setting. But it seems that does not work for fx[i]. Could you please explain why? Did I do something wrong?

By the way, I am trying to tabulate the potential energy and force of the pairwise repulsive part of the second generation REBO potential, so I can change the short-range force to be more repulsive and to be used with pair_style table. I found pair_write does not work with AIREBO or REBO.

Any help would be much appreciated!

Wenqiang

Dear all,

According to the doc page of the variable command and my runs, variable dis equal sqrt((x[1]-x[2])^2+(y[1]-y[2])^2+(z[1]-z[2])^2) can be used
to set the distance of two atoms as a variable and output with fix print
command. However, if I use variable Force equil sqrt(fx[1]^2+fy[1]^2+fz[1]^2) to set a variable to be the force
magnitude acting on atom 1, LAMMPS will give the error “Illegal variable
command”. I think x[i] and fx[i] are both the elements of an atom type
vector, so they should be equivalent for the variable setting. But it
seems that does not work for fx[i]. Could you please explain why? Did I
do something wrong?

it looks like you have a typo: equil != equal

variable Force equal ‘sqrt(fx[1]^2+fy[1]^2+fz[1]^2)’ works for me.

By the way, I am trying to tabulate the potential energy and force of
the pairwise repulsive part of the second generation REBO potential, so
I can change the short-range force to be more repulsive and to be used
with pair_style table. I found pair_write does not work with AIREBO or REBO.

there is no support for pair_write in AIREBO (or REBO) since this is a manybody potential and thus cannot be described by a pairwise-additive potential only. in other words, the interaction between two atoms depends on the location of other nearby atoms.
this is true for all manybody potentials and that is why they have no support for pair_write or only write out the pair-wise additive component (cf. EAM).

if you want to add some arbitrary repulsion you could just use pair style hybrid overlay and then add something like pair style soft with suitable parameters to add additional repulsion.

axel.

Dear Axel,

Thank you very much! I am sorry I made a stupid mistake. I will mention the typos in the future.

Is that possible for pair_write to support to write only the two-body repulsive portion for some many-body potentials? I think the repulsion potential of the AIREBO or REBO potential is only part of them and are pure two-body interactions.

The doc page of pair_write says that the energy and force are computed from two interacting atoms. So I think if I put two atoms with variable distances and output the energy and force, I should obtain similar results for the short range interactions since the repulsive force is dominant at this range. From my current test, it seems the energy and force values are close to the results in the table from pair_write for pair_style EAM and ZBL. Is this method also applicable to AIREBO or REBO potential? Could you please give me some advice?

I want to spline the potential with ZBL potential at the short inter-atomic distances. I want to follow the ways used in the publications and tabulate the values and use pair_style table, the advantage is that the splined potential and the derivatives are continuous at the splined points. However, the doc page of pair_style table does not give much information about the accuracy and computational efficient compared with the original ones. Could you please give me some instructions on how many points should I use if I want to tabulate the potential from 0 to 1 angstrom?

Thanks a lot in advance!

Best Regards,

Wenqiang

Dear Axel,

Thank you very much! I am sorry I made a stupid mistake. I will mention the typos in the future.

Is that possible for pair_write to support to write only the two-body repulsive portion for some many-body potentials?

no. pair write (and compute group/group) require a function PairXXX::single() to be implemented. It cannot be done for manybody potentials.

I think the repulsion potential of the AIREBO or REBO potential is only part of them and are pure two-body interactions.

The doc page of pair_write says that the energy and force are computed from two interacting atoms. So I think if I put two atoms with variable distances and output the energy and force, I should obtain similar results for the short range interactions since the repulsive force is dominant at this range. From my current test, it seems the energy and force values are close to the results in the table from pair_write for pair_style EAM and ZBL. Is this method also applicable to AIREBO or REBO potential? Could you please give me some advice?

no. i have already explained why this is not the same. ZBL is pairwise additive. EAM is missing the embedding term in the pair_write output. it is also explain in the EAM doc page.

to re-iterate: you must not only compare the result of what happens when you change the distance between two atoms, but also consider what happens, if there are other atoms close or not. for pairwise additive potentials like lj/cut, morse or ZBL, there is no difference, for manybody potentials, there is.

I want to spline the potential with ZBL potential at the short inter-atomic distances. I want to follow the ways used in the publications and tabulate the values and use pair_style table, the advantage is that the splined potential and the derivatives are continuous at the splined points. However, the doc page of pair_style table does not give much information about the accuracy and computational efficient compared with the original ones. Could you please give me some instructions on how many points should I use if I want to tabulate the potential from 0 to 1 angstrom?

just compare the results (accuracy and performance) from pair table (using output from pair write) with that of a pair-wise additive potential like lj/cut or morse, e.g. for the melt example. or if you are too lazy to convert that to metal units, use the equivalent input from the UNITS example.

If you read through the description of the AIREBO potential in the LAMMPS manual you should already see that your strategy is doomed for REBO style potentials:

The :math:E^{\text{REBO}} term in the AIREBO potential gives the model its
reactive capabilities and only describes short-ranged C-C, C-H and H-H
interactions (:math:r < 2 Angstroms). These interactions have strong
coordination-dependence through a bond order parameter, which adjusts
the attraction between the I,J atoms based on the position of other
nearby atoms and thus has 3- and 4-body dependence.

In other words, those potentials are emphatically not pair-wise additive at short range. And if you keep reading you will also see that the Lennard-Jones term only applies to 2 < r < cutoff and is smoothly added with a switching function to avoid the repulsive part of the LJ potential.

axel.

Dear Axel,

Thanks very much for your instruction! I will use an example input file to compare the accuracy and performance of pair table with lj.

I have read the paper of the second-generation REBO potential in 2002. I think what you mean possibly is that the attractive portion of the REBO potential has a prefoctor bij which is the bond order and includes the influence from the neighbor atoms. What if I only change the repulsive portion? The repulsion potential have a expression basically like exp(-r)/r, which in my opinion should be pure pair-additive interactions. And if I place two atoms at very short distance, the repulsive portion of REBO potential should contribute the majority of the energy and force. The contribution from the attractive portion and the bond order should be very small. I think the LJ and Torsion part of the AIREBO also have very minor effects on the energy and force at very short distance. But as you said, only two approaching atoms can not include the energy and force from the manybody terms, the results can not reproduce the values as exactly the same as the original REBO or AIREBO potential. I am looking forward to your comments. Any help would be much appreciated!

Best Regards,

Wenqiang

I have given and explained my opinion on this already twice. I have nothing to add to that.
You are free to have a different opinion and continue along the lines of what you were doing.
To figure out whether this works sufficiently and how to implement it, is your job not mine.

Axel.

OK, Axel. Thank you very very much!

Best Regards,

Wenqiang