uniform_move_snippet.f90
                        
                             · 895 B · Fortran
                        
                    
                    
                      
                        Sin formato
                      
                      
                        
                          
                        
                    
                    
                
                
            ! For the polar angle part, since projection is involved and therefore
! we need to guarantee that the projection is uniform. We don't need
! to do this for the phi angle since only rotation is involved in
! that case.
polar_ang = dacos(2.0d0*(rmca_ran(1)-0.5d0))
azim_ang = rmca_ran(1) * 2.0d0 * pi
rand_x = delta(move_type) * dsin(polar_ang) * dcos(azim_ang)
rand_y = delta(move_type) * dsin(polar_ang) * dsin(azim_ang)
rand_z = delta(move_type) * dcos(polar_ang)
! We go from the Cartesian coordinates to fractional with respect
! to the lattice.
move(4) = rand_x * inv_vectors_init(1,1) + &
  rand_y * inv_vectors_init(1,2) + &
  rand_z * inv_vectors_init(1,3)
move(5) = rand_x * inv_vectors_init(2,1) + &
  rand_y * inv_vectors_init(2,2) + &
  rand_z * inv_vectors_init(2,3)
move(6) = rand_x * inv_vectors_init(3,1) + &
  rand_y * inv_vectors_init(3,2) + &
  rand_z * inv_vectors_init(3,3)
                | 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 |