For studying a spin model on a lattice, I have to generate a random unit vector starting from a pre-exstisting one. There are multiple ways to do it, but the book I use suggests generating a random displacement vector $\Delta\boldsymbol{S}=\Delta S_{max}(p_1,p_2,p_3)$ with $p_i$ three random numbers in $[-1,1]$ and $\Delta S_{max}$ a parameter, then adding the displacement to the original vector and normalizing the sum. What I don't understand is the following. The authors say to check if $|\Delta\boldsymbol{S}|>\Delta S_{max}$ and generate another displacement if this condition is verified. They say that:

This latter step is necessary to insure that the change in a spin direction is symmetrically distributed around the current spin direction.

Here, the current spin is the pre-existing unit vector. I don't see what they mean with the sentence quoted basically. Why do I need to do that check?

The book is "Introduction to Computer Simulation Methods" by Harvey Gould, Jan Tobochnik, and Wolfgang Christian.

  • $\begingroup$ What book is this procedure from? What is the value of S_max? Is it just a parameter or does it have some interpretation? $\endgroup$
    – Tyberius
    Jun 17, 2021 at 1:09
  • $\begingroup$ I've added this information in the post $\endgroup$ Jun 17, 2021 at 7:36

1 Answer 1


What you’re seeing is a basic acceptance-rejection method. $\Delta S$ generated in that way will be uniform in the ball of radius $\Delta S_{\text{max}}$ centered at the origin.


I imagine you're doing some kind of optimization by random search, in which case the goal is to find a set of spins that extremize some objective function. The way it looks is that you have an initial spin, $S$, and want to explore the improvement a random variation of it yields. In this case $\Delta S_{\text{max}}$ give you a sort of maximum step size, and the vector $S + \Delta S$, with $\Delta S$ generated as you describe, gives you a new candidate after you normalize it. If $\Delta S_{\text{max}}$ is small, say much smaller than 1, the new candidate will be pretty close to the initial one.

So why is ''rotationally symmetric'' important? It seems like a nice thing to have, taking a step isotropically, but I doubt it's important if, in fact, this is an optimization problem. All you really need is a controlled way of generating new, reasonable candidates.

  • $\begingroup$ But why would I care about $\Delta \boldsymbol{S}$ being generated in a sphere? After generating the displacement, I sum it to the original vector and then normalize the sum. I guess in some way without this requirement the final normalized vector wouldn't be uniformly distributed on the unit sphere but I can't see why. $\endgroup$ Jun 17, 2021 at 7:32
  • $\begingroup$ Given $\mathbf{S}$ is a unit vector and the generation of $\mathbf{\Delta S}$, it is conceivable that $\mathbf{\Delta S}=-\mathbf{S}$. If accepted, this change would stop the spin immediately, which may not be physical. I suspect that $\Delta S_{\max}$ is strictly (and significantly) smaller than $1$ to guarantee a smooth transition (of course, if $|\cdot|$ is the Euclidean vector norm). $\endgroup$ Jun 17, 2021 at 13:30
  • $\begingroup$ I could just put a check for the condition $\Delta\boldsymbol{S}=-\boldsymbol{S}$ for that though. It could be that the authors suggest doing that so to have smooth changes, but it is not what they have written and actually changes that are too smooth might generate other problems in my case (I'm using a Metropolis algorithm and ergodicity is implied. If spin changes are too smooth I think this assumption becomes shaky). $\endgroup$ Jun 17, 2021 at 13:53
  • $\begingroup$ I forgot to mention you and I can't edit my comment @AbdullahAliSivas $\endgroup$ Jun 17, 2021 at 14:41
  • $\begingroup$ That will depend on $\Delta S_{\max}$; maybe if it is too small, I would be concerned. However, I don't know if it is actually an issue. Afaik, there are smooth ergodic functions, and small updates to the spin may be generating one of those. $\endgroup$ Jun 17, 2021 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.