~ubuntu-branches/ubuntu/vivid/psicode/vivid

« back to all changes in this revision

Viewing changes to src/bin/cints/DFT/init_unf_prim_atomic_grid.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2009-02-23 00:12:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090223001202-rutldoy3dimfpesc
Tags: 3.4.0-1
* New upstream release.

[ Michael Banck ]
* debian/patches/01_DESTDIR.dpatch: Refreshed.
* debian/patches/02_FHS.dpatch: Removed, applied upstream.
* debian/patches/03_debian_docdir: Likewise.
* debian/patches/04_man.dpatch: Likewise.
* debian/patches/06_466828_fix_gcc_43_ftbfs.dpatch: Likewise.
* debian/patches/07_464867_move_executables: Fixed and refreshed.
* debian/patches/00list: Adjusted.
* debian/control: Improved description.
* debian/patches-held: Removed.
* debian/rules (install/psi3): Do not ship the ruby bindings for now.

[ Daniel Leidert ]
* debian/rules: Fix txtdir via DEB_MAKE_INSTALL_TARGET.
* debian/patches/01_DESTDIR.dpatch: Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include<stdio.h>
2
 
#include<stdlib.h>
3
 
#include<math.h>
4
 
#include <libipv1/ip_lib.h>
5
 
#include <libciomr/libciomr.h>
6
 
 
7
 
#include"defines.h"
8
 
#define EXTERN
9
 
#include"global.h"
10
 
#include"lebedev_init.h"
11
 
#include"physconst.h"
12
 
 
13
 
prim_atomic_grid_t init_uniform_prim_atomic_grid(int n_rpoints,int n_angpoints,int num_chunks){
14
 
    int i,j,k;
15
 
    int start,end;
16
 
    int chunk_size;
17
 
    int n_rpoints_plus_two;
18
 
    double qr;
19
 
    double r;
20
 
    double rind;
21
 
    double n_rpoints_d;
22
 
    double four_pi_div_by_rps;
23
 
    double x,y,z;
24
 
    double drdq;
25
 
    
26
 
    prim_atomic_grid_t prim_atomic_grid;
27
 
    leb_sphere_t unit_sphere;
28
 
    leb_sphere_t *sph;
29
 
    
30
 
    /* Constants */
31
 
    
32
 
    n_rpoints_plus_two = n_rpoints+1.0;
33
 
    n_rpoints_d = (double) n_rpoints+1.0;
34
 
    four_pi_div_by_rps = 4.0*_pi/n_rpoints_d;
35
 
    
36
 
    prim_atomic_grid.chunk_num = num_chunks;
37
 
 
38
 
/*-------------------------
39
 
  Initialize the unit sphere, 
40
 
  there is only one here 
41
 
  ---------------------------*/
42
 
    
43
 
    unit_sphere = lebedev_init(n_angpoints);
44
 
    
45
 
    /* ------------------------
46
 
       Set up primitive chunks
47
 
       -----------------------*/
48
 
    
49
 
    chunk_size = n_rpoints/num_chunks;
50
 
    
51
 
    prim_atomic_grid.leb_chunk = (prim_leb_chunk_t *)
52
 
        malloc(sizeof(prim_leb_chunk_t)*num_chunks);
53
 
    
54
 
    for(i=0;i<num_chunks;i++){
55
 
        
56
 
        /* ----- Set up radial offsets for each chunk ------*/
57
 
        
58
 
        start = i*chunk_size+1;
59
 
        end = start+chunk_size;
60
 
        
61
 
        
62
 
        if(i == num_chunks-1){
63
 
            end = n_rpoints+1;
64
 
            chunk_size = end-start; 
65
 
        }
66
 
        
67
 
        
68
 
        
69
 
        /*------------------------------
70
 
          Here I am actually going to 
71
 
          calculate the r values as
72
 
          if the Bragg radii was 1.0.
73
 
          This way the primitive 
74
 
          atomic grid will be self contained
75
 
          ------------------------------*/
76
 
        
77
 
        prim_atomic_grid.leb_chunk[i].spheres = (leb_sphere_t *)
78
 
            malloc(sizeof(leb_sphere_t)*chunk_size);
79
 
        
80
 
        for(j=0;j<chunk_size;j++){
81
 
            sph = &(prim_atomic_grid.leb_chunk[i].spheres[j]);
82
 
            
83
 
            rind = (double) j + (double) start;
84
 
            
85
 
            qr = rind/n_rpoints_d;
86
 
            
87
 
            /* -------------------------------
88
 
               Straight from the Murray, Handy, Laming paper
89
 
               for mr = 2 
90
 
               ----------------------------------*/
91
 
                
92
 
            r = rind*rind/((n_rpoints_d  - rind)
93
 
                           *(n_rpoints_d  - rind));
94
 
            
95
 
            /*drdq = four_pi_div_by_rps*r*r*2.0*qr/((1-qr)*(1-qr)*(1-qr));*/
96
 
            drdq = 2.0*pow(rind,5)*(n_rpoints_d)*pow(n_rpoints_d-rind,-7.0);
97
 
            sph->points = (leb_point_t *)malloc(sizeof(leb_point_t)*n_angpoints);
98
 
            
99
 
            for(k=0;k<n_angpoints;k++){
100
 
                
101
 
                sph->points[k].p_cart.x = 
102
 
                    unit_sphere.points[k].p_cart.x*r;
103
 
                sph->points[k].p_cart.y =
104
 
                    unit_sphere.points[k].p_cart.y*r;
105
 
                sph->points[k].p_cart.z =
106
 
                    unit_sphere.points[k].p_cart.z*r;
107
 
                sph->points[k].ang_weight =
108
 
                    unit_sphere.points[k].ang_weight;
109
 
            }
110
 
 
111
 
            sph->r = r;
112
 
            
113
 
            sph->drdq = drdq;
114
 
            sph->n_ang_points = unit_sphere.n_ang_points;
115
 
        }
116
 
        
117
 
        prim_atomic_grid.leb_chunk[i].radial_start = start;
118
 
        prim_atomic_grid.leb_chunk[i].radial_end = end;
119
 
        prim_atomic_grid.leb_chunk[i].size = chunk_size;    
120
 
    }
121
 
    return prim_atomic_grid;
122
 
}          
123
 
 
124
 
 
125
 
 
126
 
 
127
 
 
128