I want to calculate the heat flux in a solid system with periodic boundary conditions. The microscopic formula I’m implementing in a compute is as follows:
J = sum_i v_i epsilon_i + 1/2 sum_pairs F_ij r_ij . (v_i+v_j)
v is velocity
epsilon is local energy (KE and an appropriate share of PE)
F_ij is the force that atom j exerts on atom i
and sum_pairs means that i and j are iterated such that each pair is visited once only.
The neighbor lists in LAMMPS are (at least for pairwise interactions) constructed such that a double sum over each real atom i and all their neighbors j visits each pair once, so that aspect is fine. However, I have a problem if j happens to be a ghost atom, i.e. a periodic copy of a real atom, since LAMMPS only keeps track of the positions of ghost atoms but not their velocities.
How can I find out the velocity of a ghost atom? Two posssibilities occur to me, but I can’t make progress with either:
I assume that when positions are being updated after an integration step the positions of real atoms are simply copied to their corresponding ghosts, i.e. if there are 30 real atoms and atom 43 is a (periodic) copy of atom 7, I would expect there to be a line of code like x = x. I’ve looked but can’t find it. Where is it and can I simply copy this book-keeping for the velocities, writing v = v?
Somewhere there must be a list recording that 43 is simply a copy of 7, i.e. something of the form parent = 7 (which would also contain the information parent = 7). When in my formula I need v, how can I access this list to perform the necessary mapping? Instead of v[j] I could then write v[parent[j]].
I’d greatly appreciate any help you can give with this problem.
PS: By the way, I can’t find any distinction in the code between ghost atoms that arise from parallelization and those that arise from periodic boundary conditions. Am I correct in thinking that both are treated the same?
Siemens Aktiengesellschaft: Vorsitzender des Aufsichtsrats: Gerhard Cromme; Vorstand: Peter Löscher, Vorsitzender; Johannes Feldmayer, Heinrich Hiesinger, Joe Kaeser, Rudi Lamprecht, Eduardo Montes, Jürgen Radomski, Erich R. Reinhardt, Hermann Requardt, Uriel J. Sharef, Klaus Wucherer; Sitz der Gesellschaft: Berlin und München; Registergericht: Berlin Charlottenburg, HRB 12300, München, HRB 6684; WEEE-Reg.-Nr. DE 23691322