I found this source code written by someone:
def get_energy_of_one_atom(atoms_vec, period_box_len__int, atom_index__int, min_atom_distance__float, max_atom_distance__float): """ Evaluates the energy of a single atom """ en = 0 for i in range(len(atoms_vec)): if i == atom_index__int: continue dx = abs(atoms_vec[atom_index__int][0] - atoms_vec[i][0]) dy = abs(atoms_vec[atom_index__int][1] - atoms_vec[i][1]) dx = dx if dx < period_box_len__int / 2 else period_box_len__int - dx dy = dy if dy < period_box_len__int / 2 else period_box_len__int - dy d = math.sqrt(dx ** 2 + dy ** 2) if d < min_atom_distance__float: en += 10000000 elif d < max_atom_distance__float: en += -1 return en This source code calculates the energy of one gas atom in a box.
What formula was used here?
Can you supply me with a reference?