def get_forces(self, a=None):
        """Calculate atomic forces."""
        if a is None:
            a = self.a
        forces = np.zeros([len(a), 3], dtype=float)
        if self.mask is None:
            forces[self.mask] = self.force
        else:
            forces[:] = self.force
        return forces