3D Cosine Function for an HCP Lattice I would like to construct a 3D cosine function, $f$, which is scaled to the range $f\in[-1,1]$, and which has maxima which coincide with the HCP lattice.
For example, here are the analogous 3D cosine functions for other lattices:


*

*Simple Cubic (CUB) $$f_\text{CUB}(x,y,z)=\frac{1}{3}\left(\cos x + \cos y + \cos z \right)$$
Plot of $f_\text{CUB}(2\pi x,2\pi y,2\pi z)>0.9$ for $\{x,y,z\}\in[-1,1]$


*

*Body-centred Cubic (BCC) $$f_\text{BCC}(x,y,z)=-1+\frac{2}{3}\left(\cos x \cos y + \cos y\cos z +\cos z \cos x \right)$$
Plot of $f_\text{BCC}(2\pi x,2\pi y,2\pi z)>0.6$ for $\{x,y,z\}\in[-0.5,0.5]$


*

*Face-centred Cubic (FCC) $$f_\text{FCC}(x,y,z)=\cos x \cos y\cos z$$
Plot of $f_\text{FCC}(2\pi x,2\pi y,2\pi z)>0.8$ for $\{x,y,z\}\in[-0.5,0.5]$

My closest guess at a general solution so far is something of the form: $$f_\text{lattice}(\mathbf{r})=A+B\sum_{i=1}^{\tilde{N}^\text{lattice}} \cos (2\mathbf{r}\cdot\tilde{\mathbf{r}}_i^\text{lattice}),$$
where $\mathbf{r}=(x,y,z)$, $A$ and $B$ are offset and scaling constants, $\{\tilde{\mathbf{r}}_i^\text{lattice}\}$ is the set of displacements from the origin to nearest neighbours in a cuboidal unit cell of the reciprocal lattice, and $\tilde{N}^\text{lattice}$ is the corresponding length of the set. However, this does not quite work for me... Any help, tips, or advice would be greatly appreciated! Thank you :-)

2D EXAMPLE: Simple Hexagonal Lattice (HEX)
1) Write down all of the displacement vectors in one hexagon:
$$\mathbf{a}_1=\left(\frac{1}{2},\frac{\sqrt{3}}{2}\right)$$
$$\mathbf{a}_2=\left(1,0\right)$$
$$\mathbf{a}_3=\left(-\frac{1}{2},\frac{\sqrt{3}}{2}\right)$$
$$\mathbf{a}_4=\left(\frac{1}{2},-\frac{\sqrt{3}}{2}\right)$$
$$\mathbf{a}_5=\left(-1,0\right)$$
$$\mathbf{a}_6=\left(-\frac{1}{2},-\frac{\sqrt{3}}{2}\right)$$
2) Plot these displacement vectors to verify that the hexagon has a lattice constant in the $x$-direction of $a_\text{x}=1$ and a lattice constant in the $y$-direction of $a_\text{y}=\sqrt{3}$.

3) Construct the density and plot
$$f_\text{HEX}(\mathbf{r})=\frac{1}{6}\sum_{i=1}^{6}\cos(2\mathbf{r}\cdot\mathbf{a}_i),$$
where $\mathbf{r}=(x,y)$.

Note that $a_\text{x}\to2\pi/a_\text{x}$ and $a_\text{y}\to2\pi/a_\text{y}$ since we recover the reciprocal lattice.
 A: I eventually found the answer to this, so I'm posting it here in case other people find it helpful in the future. The solution is to take the superposition of the Fourier transforms of two offset hexagonal lattices, with an appropriate modulation along the z-axis. Something of the form
$$\begin{align}f_\text{hcp}(\mathbf{r})=A_\text{hcp}+\frac{B_\text{hcp}}{6}\Bigg[&\sum_{i=1}^{6}\cos(\mathbf{r}\cdot\tilde{\mathbf{r}}^\text{hcp}_i)\cos\left( \frac{3\pi}{\sqrt{6}a}z\right)\\
&+\sum_{i=1}^{6}\cos\left(\left(\mathbf{r}-\mathbf{r}^\text{hcp}_7
   \right)\cdot\tilde{\mathbf{r}}^\text{hcp}_i\right)\cos\left( \frac{3\pi}{\sqrt{6}a}\left(z-\frac{\sqrt{6}a}{3}\right)\right)\Bigg],\end{align}$$
where $A_\text{hcp}$ if the offset constant, $B_\text{hcp}$ is the scaling constant, $\{\tilde{\mathbf{r}}^\text{hcp}_i\}$ is the set of displacement vectors to nearest neighbors in the reciprocal unit cell (where the first 6 form a hexagon in the $z=0$ plane), and $\mathbf{r}^\text{hcp}_7$ is the displacement to an atom in the neighboring plane for this AB stacking e.g. $\mathbf{r}^\text{hcp}_7=(1/2,\sqrt{3}/6,\sqrt{6}/3)$.
$f_\text{hcp}(\mathbf{r})>0.9$">
This is a 3D cosine function, of an analogous form to the ones presented in the examples, which can be scaled to the range $f\in[-1,1]$, and which has maxima which coincide with the hcp lattice. Therefore, this precisely answers my original question.
