Computational Physics - Department of Physics

(Axel Boer) #1

14.5 Variational Monte Carlo for atoms 485


r_single_particle;
doubler_plus,r_minus;
// allocate matrices which contain the position of the particles
// the function matrix is defined in the progam library
r_plus = (double) matrix( number_particles, dimension,sizeof(double));
r_minus = (double
) matrix( number_particles, dimension, sizeof(double));
for(i = 0; i < number_particles; i++){
for( j=0; j < dimension; j++){
r_plus[i][j] = r_minus[i][j] = r[i][j];
}
}
// compute the kinetic energy
e_kinetic = 0;
for(i = 0; i < number_particles; i++){
for(j = 0; j < dimension; j++){
r_plus[i][j] = r[i][j]+h;
r_minus[i][j] = r[i][j]-h;
wfminus = wave_function(r_minus, alpha, dimension, number_particles);
wfplus = wave_function(r_plus, alpha, dimension, number_particles);
e_kinetic -= (wfminus+wfplus-2wfold);
r_plus[i][j] = r[i][j];
r_minus[i][j] = r[i][j];
}
}
// include electron mass and hbar squared and divide by wave function
e_kinetic = 0.5
h2e_kinetic/wfold;
// compute the potential energy
e_potential = 0;
// contribution from electron-proton potential
for(i = 0; i < number_particles; i++){
r_single_particle = 0;
for(j = 0; j < dimension; j++){
r_single_particle += r[i][j]
r[i][j];
}
e_potential -= charge/sqrt(r_single_particle);
}
// contribution from electron-electron potential
for(i = 0; i < number_particles-1; i++){
for(j = i+1; j < number_particles; j++){
r_12 = 0;
for(k = 0; k < dimension; k++){
r_12 += (r[i][k]-r[j][k])*(r[i][k]-r[j][k]);
}
e_potential += 1/sqrt(r_12);
}
}
free_matrix((void) r_plus);// free memory
free_matrix((void
) r_minus);
e_local = e_potential+e_kinetic;
returne_local;
}


The remaining part of the program consists of the output and initialize functions and is not
listed here.
The way we have rewritten Schrödinger’s equation results inenergies given in atomic
units. If we wish to convert these energies into more familiar units like electronvolt (eV), we
have to multiply our reults with 2 E 0 whereE 0 = 13. 6 eV, the binding energy of the hydrogen
atom. Using Eq. (14.21) for the trial wave function, we obtain an energy minimum atα=

Free download pdf