yuanpeng

yuanpeng / uniform_move_snippet

Последняя активность 4 months ago

Нравится 0
uniform_move_snippet.f90 Исходник
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.
5polar_ang = dacos(2.0d0*(rmca_ran(1)-0.5d0))
6azim_ang = rmca_ran(1) * 2.0d0 * pi
7rand_x = delta(move_type) * dsin(polar_ang) * dcos(azim_ang)
8rand_y = delta(move_type) * dsin(polar_ang) * dsin(azim_ang)
9rand_z = delta(move_type) * dcos(polar_ang)
10! We go from the Cartesian coordinates to fractional with respect
11! to the lattice.
12move(4) = rand_x * inv_vectors_init(1,1) + &
13 rand_y * inv_vectors_init(1,2) + &
14 rand_z * inv_vectors_init(1,3)
15move(5) = rand_x * inv_vectors_init(2,1) + &
16 rand_y * inv_vectors_init(2,2) + &
17 rand_z * inv_vectors_init(2,3)
18move(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