-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimconf.cc
86 lines (73 loc) · 2.19 KB
/
simconf.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include <math.h>
#include <stdio.h>
//#include <stdlib.h>
#include <iostream>
#include "config.h"
#include "simconf.h"
simconfType *simconf;
simconfType::simconfType( double _alfa )
{
ed = 25.0; // displacement energy
alfa = _alfa; // angle of incidence (degrees)
alpha = alfa * M_PI / 180.0;
tmin = 1.0; //max impact parameter set by min. transferred energy
//tmin = 5.0; //max impact parameter set by min. transferred energy
tau = 0.0;
da = 3.0; // angular grid for transmitted ions
cw = 0.001; // channel width 1% of layer thickness
// output full trajectories
fullTraj = false;
// set global ion id to zero (will be incremented for each new projectile)
id = 0;
// initialize global statistics
vacancies_created = 0;
EelTotal = 0.0;
EnucTotal = 0.0;
// read data tables
read_snuc();
read_scoef();
}
void simconfType::read_snuc()
{
FILE *sf = fopen( DATA_DIR"/SNUC03.dat", "rt" );
if( sf == 0 )
{
std::cerr << "Unable to open " << DATA_DIR"/SNUC03.dat" << std::endl;
exit(1);
}
for( int i = 0; i < 92; i++ )
for( int j = i; j < 92; j++ )
{
fscanf( sf, "%*d %*d %lf %lf %lf %lf\n",
&snuc[j][i][0], &snuc[j][i][1], &snuc[j][i][2], &snuc[j][i][3] );
for( int n = 0; n < 4; n++ )
snuc[i][j][n] = snuc[j][i][n];
}
fclose( sf );
}
void simconfType::read_scoef()
{
char buf[2001];
FILE *sf;
sf = fopen( DATA_DIR"/SCOEF.95A", "rt" );
fgets( buf, 2000, sf ); // header
fgets( buf, 2000, sf ); // header
for( int i = 0; i < 92; i++ )
{
fscanf( sf, "%*d %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf\n",
&scoef[i].mm1, &scoef[i].m1, &scoef[i].mnat,
&scoef[i].rho, &scoef[i].atrho, &scoef[i].vfermi, &scoef[i].heat,
&pcoef[i][0], &pcoef[i][1], &pcoef[i][2], &pcoef[i][3],
&pcoef[i][4], &pcoef[i][5], &pcoef[i][6], &pcoef[i][7] );
}
fclose( sf );
sf = fopen( DATA_DIR"/SLFCTR.dat", "rt" );
fgets( buf, 2000, sf ); // header
for( int i = 0; i < 92; i++ )
fscanf( sf, "%*d %lf\n", &scoef[i].lfctr );
fclose( sf );
sf = fopen( DATA_DIR"/ELNAME.dat", "rt" );
for( int i = 0; i < 92; i++ )
fscanf( sf, "%*d %s %s\n", scoef[i].sym, scoef[i].name );
fclose( sf );
}