Atom style variables

Dear all,

I am trying to define some atom style variables using the atom vectors x, y and z for the purpose of defining a position-dependent electric field. I find it necessary to perform divisions such as y/x, which will result in a divide by zero error if an atom has a x-coordinate of zero. Therefore, is it possible to restrict such division operations only to atoms for which x is non-zero without looping over all atoms ?


***DISCLAIMER*** The sender of this email is an alumnus of National University of Singapore (NUS). Kindly note that NUS is not responsible for the contents of this email, and views and opinions expressed are solely the sender's.

I believe you can nest your variables command inside an if statement.



Noted with thanks. In any case, I have found a work-around to avoid the division by zero problem.