Each cubature has tens of thousands of nodes, so in an effort to prevent the memory requirements from becoming prohibitively large for big systems, the basis functions of each atom are recomputed as needed. This requires a sine and cosine evaluation for each cubature node, so to minimize the number of times that the basis functions are computed to two, we iterate through all of the long-range neighbors of each cell and sum the structure factors of the remote cells. This summed structure factor is then used to calculate the longrange energy so the basis functions for each atom can be reused.