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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
| public class calcul {
public static void main(String[] args) {
// declaration
int npas;
// parametres
double hbar = 1.0, me = 1.0;
double delta = 0.01, a = -10.0, b = 5.0;
// variables fonction d'onde
double psi[]; // tableau allocatable
// calcul numerov
double num1, num2, denom, fnm1, fn, fnp1;
double E, pot;
// divers
int i,j;
double x;
// nouvelle ligne
// String newLine = System.getProperty("line.separator");
// Monfichier.write(newLine);
// * * * impression parametres * * *
System.out.printf("delta = %10.4f", (float) delta);
System.out.println();
System.out.printf("a = %10.4f", (float) a );
System.out.println();
System.out.printf("b = %10.4f", (float) b );
System.out.println();
// * * * calcul du nombre de pas * * *
npas = (int) Math.round( ( b - a ) / delta );
npas++;
System.out.printf("npas = %10d", npas );
// allocate psi
psi = new double [npas];
// * * * fichier resultats * * *
// open(10,file="res")
// * * * impression potentiel * * *
for (i = 0; i <= npas; i++ ) {
x = a + (i-1) * delta;
pot = 0.5 * ( x - 0.) * (x - 0.);
//System.out.println( x + pot(x) );
}
// write(10,"(a)")"&"
// * * * calcul numerov * * *
E = 1.45;
for (j = 1; j <= 10; j++ ) {
E = E + 0.01;
System.out.println(E);
// * * * initialisation psi * * *
for (i=0; i < npas; i++) {
psi[i] = 0.0;
}
psi[1] = 1.0d-10;
// write(10,*)x,psi(1)
// write(10,*)x,psi(2)
// * * * calcul de psi * * *
for ( i=2; i < npas; i++ ) {
x = a + i * delta;
// fnm1 = (2. * me / Math.pow(hbar,2.) ) * ( pot(x-2.d0*delta) - E );
// fn = (2. * me / Math.pow(hbar,2.) ) * ( pot( x - delta ) - E );
// fnp1 = (2. * me / Math.pow(hbar,2.) ) * ( pot( x ) - E );
pot = 0.5 * ( (x-2.*delta) - 0.) * ( (x-2.*delta) - 0.);
fnm1 = (2. * me / (hbar*hbar) ) * ( pot - E );
pot = 0.5 * ( (x-delta) - 0.) * ( (x-delta) - 0.);
fn = (2. * me / (hbar*hbar) ) * ( pot - E );
pot = 0.5 * ( x - 0.) * (x - 0.);
fnp1 = (2. * me / (hbar*hbar) ) * ( pot - E );
num1 = ( 2. + 5. * fn * (delta*delta) / 6. ) * psi[i-1];
num2 = ( 1. - fnm1 * (delta*delta) / 12. ) * psi[i-2];
denom = 1. - fnp1 * (delta*delta) / 12.;
psi[i] = ( num1 - num2 ) / denom;
}
for (i=0; i < npas; i++) {
x = a + i * delta;
// System.out.println( x + psi[i]);
}
// write(10,"(a)")"&"
} // boucle sur j
} // fin methode
} // fin classe |