patch for compute_ackland in lammps (plain text)

mailing list note: apologies for the prior, possibly empty HTML-formatted mail. Outlook did not properly format a forwarded mail to the list -- this is freshly in plain text.

Hello LAMMPS developers,

I would like to submit for your consideration a modified version of the compute_ackland currently available in USER-MISC of 15May15 lammps. I contacted the original developer, Gerolf Ziegenhain, with these changes and he replied:
"It is great to see others using my old code :slight_smile: I have no objections merging your code into the master branch of LAMMPS. Ackland is only a better proven method for visualizing crystal structures using heuristic parameters. Go ahead and merge your improvement :)"

This modified version of compute_ackland_atom.cpp modifies compute_peratom() beginning at line 235. The header file did not need any changes. This patch has two main purposes. First, it avoids a divide by zero for unusual configurations when calculating delta_bcc, setting the value of that variable to something that will avoid atom classification as BCC if a divide-by-zero would have been encountered. I encountered this divide by zero issue in a production run of a shocked material state, while running LAMMPS using an executable built with floating-point traps.

Second, it follows a more strict adherence to the algorithm laid out in Ackland-Jones 2006 table II (e.g., testing for n0 < 11 and strictly following termination logic). For our tests, this results in only minor output differences from the original implementation, but the lack of a test against n0 in the original implementation and the original's ability to fall-through to other tests after a classification had been determined are different from my interpretation of the procedure in the original text.

The modified file has a bit over 30 +/- lines each when tallying up a unified diff. To Steve, Axel, and other C++ gurus: the coding style and implementation of my changes could probably be improved, but this is the version that was approved for public release. Please feel free to make any changes you deem prudent. To anyone reading this: tests would be welcome against a variety of physical systems, in case I've introduced a bug that my test cases did not catch.

I hope that you find this contribution useful. I also hope to meet people at the workshop in August! File attached.

cheers,

Brian Barnes, Ph.D.
US Army Research Laboratory

compute_ackland_atom.cpp (11.1 KB)