Generalization of the heisenberg hamiltonian for the case of an atomic system with a variable atomic spin value