Orbitales Atomiques - Visualisation par nuages de points
De Physix.
Il s'agit ici de visualiser des orbitales atomiques simples modélisées sous forme d'un nuage de points. La distribution des points suit la densité de probabilité associée à la fonction d'onde de l'orbitale atomique considérée. Le code correspondant est publié avec chacune des orbitales.
Sommaire |
Visualisation de quelques orbitales
Code Orbitale 1s
import java.awt.*;
import java.applet.*;
/*** simulation of a 1s orbital with the Rejection Sampling Method** @author Cécile POT* @version PhysiX - January 2009*/public class Orbitale_1s extends Applet {
static final long serialVersionUID = 1L;
int n = 50000; // number of points
Point tab[]; // array of points
// --------------------------------------------------// wave functiondouble f(double r, double theta) {
return 1. / Math.sqrt(Math.PI) * Math.exp(-r);
}// --------------------------------------------------// uniform probability distribution across the interval [-5,5] (easily simulated)double g(double x, double y) {
return 1. / 25;
}// f(x)<=a*g(x)double a = 25. * d(0, 1 / 2.);
// probability density function associated with fdouble d(double x, double y) {
double r = Math.sqrt(x * x + y * y);
double theta = Math.atan2(y, x);
return r * f(r, theta) * f(r, theta);
}// --------------------------------------------------// The applet is initialisedpublic void init() {
// resizingthis.setSize(500, 500);
// array is initialisedtab = new Point[n];
// array is filled with n samplingsint k = 0;
while (k < n) {
double x, y, U;
// x is sampled from the g-distributionx = 10. * Math.random() - 5.;
y = 10. * Math.random() - 5.;
// uniform variable is simulatedU = Math.random();
// acceptance or rejectionif (d(x, y) > U * a * g(x, y)) {
tab[k] = new Point(x, y);
k++;}}} // init()
// --------------------------------------------------public void start() {
} // start()
// --------------------------------------------------// The applet is displayedpublic void paint(Graphics g) {
int k;
for (k = 0; k < n; k++) {
int x, y;
x = (int) (50. * (5. + tab[k].x));
y = (int) (50. * (5. - tab[k].y));
g.drawLine(x, y, x, y);
}g.setColor(Color.BLACK);
} // paint()
// --------------------------------------------------} // class Orbitale_1s
Code Orbitale 2s
import java.awt.*;
import java.applet.*;
/*** simulation of a 2s Orbital with the Rejection Sampling Method** @author Cécile POT* @version PhysiX - January 2009*/public class Orbitale_2s extends Applet {
static final long serialVersionUID = 1L;
int n = 100000; // number of points
Point tab[]; // array of points
// --------------------------------------------------// wave functionpublic double f(double x, double y) {
double r = Math.sqrt(x * x + y * y);
double theta = Math.atan2(y, x);
return 2. / Math.sqrt(3 * Math.PI) * (2 - r) * Math.exp(-r);
}// --------------------------------------------------// uniform probability distribution across the interval [-5,5] (easily simulated)double g(double x, double y) {
return 1. / 25;
}// f(x)<=a*g(x)double a = 25. * 0.5;
// probability density function associated with fdouble d(double x, double y) {
double r = Math.sqrt(x * x + y * y);
return r * f(x, y) * f(x, y);
}// --------------------------------------------------// The applet is initialisedpublic void init() {
// resizingthis.setSize(500, 500);
// array is initialisedtab = new Point[n];
// array is filled with n samplingsint k = 0;
while (k < n) {
double x, y, U;
// x is sampled from the g-distributionx = 10. * Math.random() - 5.;
y = 10. * Math.random() - 5.;
// uniform variable is simulatedU = Math.random();
// acceptance or rejectionif (d(x, y) > U * a * g(x, y)) {
tab[k] = new Point(x, y);
k++;}}} // init()
// --------------------------------------------------public void start() {
} // start()
// --------------------------------------------------// The applet is displayedpublic void paint(Graphics g) {
int k;
for (k = 0; k < n; k++) {
int x, y;
x = (int) (50. * (5. + tab[k].x));
y = (int) (50. * (5. - tab[k].y));
// f(x)<0 in blue and f(x)>0 in redg.setColor(f(tab[k].x, tab[k].y) >= 0. ? Color.RED : Color.BLUE);
g.drawLine(x, y, x, y);
}g.setColor(Color.BLACK);
} // paint()
// --------------------------------------------------} // class Orbitale_2s
<source lang="java" line="1">
import java.awt.*;
import java.applet.*;
/*** simulation of a 2px Orbital with the Rejection Sampling Method** @author Cécile POT* @version PhysiX - January 2009*/public class Orbitale_2px extends Applet {
static final long serialVersionUID = 1L;
int n = 100000; // number of points
Point tab[]; // array of points
// --------------------------------------------------// wave functionpublic double f(double x, double y) {
double r = Math.sqrt(x * x + y * y);
double theta = Math.atan2(y, x);
return x * Math.exp(-3*r/2);
}// --------------------------------------------------// uniform probability distribution across the interval [-5,5] (easily simulated)double g(double x, double y) {
return 1. / 25;
}// f(x)<=a*g(x)double a = 5;
// probability density function associated with fdouble d(double x, double y) {
double r = Math.sqrt(x * x + y * y);
return r * f(x, y) * f(x, y);
}// --------------------------------------------------// The applet is initialisedpublic void init() {
// resizingthis.setSize(500, 500);
// array is initialisedtab = new Point[n];
// array is filled with n samplingsint k = 0;
while (k < n) {
double x, y, U;
// x is sampled from the g-distributionx = 10. * Math.random() - 5.;
y = 10. * Math.random() - 5.;
// uniform variable is simulatedU = Math.random();
// acceptance or rejectionif (d(x, y) > U * a * g(x, y)) {
tab[k] = new Point(x, y);
k++;System.out.println(k);
}}} // init()
// --------------------------------------------------public void start() {
} // start()
// --------------------------------------------------// The applet is displayedpublic void paint(Graphics g) {
int k;
for (k = 0; k < n; k++) {
int x, y;
x = (int) (50. * (5. + tab[k].x));
y = (int) (50. * (5. - tab[k].y));
// f(x)<0 in blue and f(x)>0 in redg.setColor(f(tab[k].x, tab[k].y) >= 0. ? Color.RED : Color.BLUE);
g.drawLine(x, y, x, y);
}g.setColor(Color.BLACK);
} // paint()
// --------------------------------------------------} // class Orbitale_2px
Code Orbitale 3px
import java.awt.*;
import java.applet.*;
/*** simulation of a 3px Orbital with the Rejection Sampling Method** @author Cécile POT* @version PhysiX - January 2009*/public class Orbitale_3dxy extends Applet {
static final long serialVersionUID = 1L;
int n = 100000; // number of points
Point tab[]; // array of points
// --------------------------------------------------// wave functionpublic double f(double x, double y) {
double r = Math.sqrt(x * x + y * y);
double theta = Math.atan2(y, x);
return x * r * (1-r) * Math.exp(-3*r/2);
}// --------------------------------------------------// uniform probability distribution across the interval [-5,5] (easily simulated)double g(double x, double y) {
return 1. / 25;
}// f(x)<=a*g(x)double a = 5;
// probability density function associated with fdouble d(double x, double y) {
double r = Math.sqrt(x * x + y * y);
return r * f(x, y) * f(x, y);
}// --------------------------------------------------// The applet is initialisedpublic void init() {
// resizingthis.setSize(500, 500);
// array is initialisedtab = new Point[n];
// array is filled with n samplingsint k = 0;
while (k < n) {
double x, y, U;
// x is sampled from the g-distributionx = 10. * Math.random() - 5.;
y = 10. * Math.random() - 5.;
// a uniform variable is simulatedU = Math.random();
// acceptance or rejectionif (d(x, y) > U * a * g(x, y)) {
tab[k] = new Point(x, y);
k++;}}} // init()
// --------------------------------------------------public void start() {
} // start()
// --------------------------------------------------// The applet is displayedpublic void paint(Graphics g) {
int k;
for (k = 0; k < n; k++) {
int x, y;
x = (int) (50. * (5. + tab[k].x));
y = (int) (50. * (5. - tab[k].y));
// f(x)<0 in blue and f(x)>0 in redg.setColor(f(tab[k].x, tab[k].y) >= 0. ? Color.RED : Color.BLUE);
g.drawLine(x, y, x, y);
}g.setColor(Color.BLACK);
} // paint()
// --------------------------------------------------} // class Orbitale_3dxy
public class Orbitale_3dxy {
}
Code Orbitale 3dxy
import java.awt.*;
import java.applet.*;
/*** simulation of a 3dxy Orbital with the Rejection Sampling Method** @author Cécile POT* @version PhysiX - January 2009*/public class Orbitale_3dxy extends Applet {
static final long serialVersionUID = 1L;
int n = 100000; // number of points
Point tab[]; // array of points
// --------------------------------------------------// wave functionpublic double f(double x, double y) {
double r = Math.sqrt(x * x + y * y);
double theta = Math.atan2(y, x);
return x * y * Math.exp(-3*r/2);
}// --------------------------------------------------// uniform probability distribution across the interval [-5,5] (easily simulated)double g(double x, double y) {
return 1. / 25;
}// f(x)<=a*g(x)double a = 5;
// probability density function associated with fdouble d(double x, double y) {
double r = Math.sqrt(x * x + y * y);
return r * f(x, y) * f(x, y);
}// --------------------------------------------------// The applet is initialisedpublic void init() {
// resizingthis.setSize(500, 500);
// array is initialisedtab = new Point[n];
// array is filled with n samplingsint k = 0;
while (k < n) {
double x, y, U;
// x is sampled from the g-distributionx = 10. * Math.random() - 5.;
y = 10. * Math.random() - 5.;
// a uniform variable is simulatedU = Math.random();
// acceptance or rejectionif (d(x, y) > U * a * g(x, y)) {
tab[k] = new Point(x, y);
k++;}}} // init()
// --------------------------------------------------public void start() {
} // start()
// --------------------------------------------------// The applet is displayedpublic void paint(Graphics g) {
int k;
for (k = 0; k < n; k++) {
int x, y;
x = (int) (50. * (5. + tab[k].x));
y = (int) (50. * (5. - tab[k].y));
// f(x)<0 in blue and f(x)>0 in redg.setColor(f(tab[k].x, tab[k].y) >= 0. ? Color.RED : Color.BLUE);
g.drawLine(x, y, x, y);
}g.setColor(Color.BLACK);
} // paint()
// --------------------------------------------------} // class Orbitale_3dxy
Code Orbitale 3dx²
import java.awt.*;
import java.applet.*;
/*** simulation of a 3dx² Orbital with the Rejection Sampling Method** @author Cécile POT* @version PhysiX - January 2009*/public class Orbitale_3dx2 extends Applet {
static final long serialVersionUID = 1L;
int n = 100000; // number of points
Point tab[]; // array of points
// --------------------------------------------------// wave functionpublic double f(double x, double y) {
double r = Math.sqrt(x * x + y * y);
double theta = Math.atan2(y, x);
return (3*x*x - r*r) * Math.exp(-3*r/2);
}// --------------------------------------------------// uniform probability distribution across the interval [-5,5] (easily simulated)double g(double x, double y) {
return 1. / 25;
}// f(x)<=a*g(x)double a = 5;
// probability density function associated with fdouble d(double x, double y) {
double r = Math.sqrt(x * x + y * y);
return r * f(x, y) * f(x, y);
}// --------------------------------------------------// The applet is initialisedpublic void init() {
// resizingthis.setSize(500, 500);
// array is initialisedtab = new Point[n];
// array is filled with n samplingsint k = 0;
while (k < n) {
double x, y, U;
// x is sampled from the g-distributionx = 10. * Math.random() - 5.;
y = 10. * Math.random() - 5.;
// a uniform variable is simulatedU = Math.random();
// acceptance or rejectionif (d(x, y) > U * a * g(x, y)) {
tab[k] = new Point(x, y);
k++;}}} // init()
// --------------------------------------------------public void start() {
} // start()
// --------------------------------------------------// The applet is displayedpublic void paint(Graphics g) {
int k;
for (k = 0; k < n; k++) {
int x, y;
x = (int) (50. * (5. + tab[k].x));
y = (int) (50. * (5. - tab[k].y));
// f(x)<0 in blue and f(x)>0 in redg.setColor(f(tab[k].x, tab[k].y) >= 0. ? Color.RED : Color.BLUE);
g.drawLine(x, y, x, y);
}g.setColor(Color.BLACK);
} // paint()
// --------------------------------------------------} // class Orbitale_3dx2
Voir aussi
Orbitales Atomiques - Visualisation par surfaces d'isodensité





