| 1 | ! For the polar angle part, since projection is involved and therefore |
| 2 | ! we need to guarantee that the projection is uniform. We don't need |
| 3 | ! to do this for the phi angle since only rotation is involved in |
| 4 | ! that case. |
| 5 | polar_ang = dacos(2.0d0*(rmca_ran(1)-0.5d0)) |
| 6 | azim_ang = rmca_ran(1) * 2.0d0 * pi |
| 7 | rand_x = delta(move_type) * dsin(polar_ang) * dcos(azim_ang) |
| 8 | rand_y = delta(move_type) * dsin(polar_ang) * dsin(azim_ang) |
| 9 | rand_z = delta(move_type) * dcos(polar_ang) |
| 10 | ! We go from the Cartesian coordinates to fractional with respect |
| 11 | ! to the lattice. |
| 12 | move(4) = rand_x * inv_vectors_init(1,1) + & |
| 13 | rand_y * inv_vectors_init(1,2) + & |
| 14 | rand_z * inv_vectors_init(1,3) |
| 15 | move(5) = rand_x * inv_vectors_init(2,1) + & |
| 16 | rand_y * inv_vectors_init(2,2) + & |
| 17 | rand_z * inv_vectors_init(2,3) |
| 18 | move(6) = rand_x * inv_vectors_init(3,1) + & |
| 19 | rand_y * inv_vectors_init(3,2) + & |
| 20 | rand_z * inv_vectors_init(3,3) |
| 21 |
yuanpeng / uniform_move_snippet
Last active 2 months ago
Revision 985b4110d7780b09fd0907b0a1480547841e1e38