Spaces:
Running
Running
undefined - Initial Deployment
Browse files- README.md +7 -5
- index.html +422 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: hydrogen
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: yellow
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,422 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Hydrogen Atom Wave Function Visualization</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
|
| 9 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/11.9.1/math.js"></script>
|
| 10 |
+
<style>
|
| 11 |
+
.wavefunction-equation {
|
| 12 |
+
font-size: 1.2rem;
|
| 13 |
+
line-height: 2;
|
| 14 |
+
}
|
| 15 |
+
.orbital-canvas {
|
| 16 |
+
width: 100%;
|
| 17 |
+
height: 400px;
|
| 18 |
+
background: #f0f0f0;
|
| 19 |
+
}
|
| 20 |
+
.slider-container {
|
| 21 |
+
transition: all 0.3s ease;
|
| 22 |
+
}
|
| 23 |
+
.slider-container:hover {
|
| 24 |
+
transform: scale(1.02);
|
| 25 |
+
}
|
| 26 |
+
.navbar {
|
| 27 |
+
backdrop-filter: blur(10px);
|
| 28 |
+
}
|
| 29 |
+
</style>
|
| 30 |
+
</head>
|
| 31 |
+
<body class="bg-gray-100 text-gray-800 font-sans">
|
| 32 |
+
<!-- Navigation -->
|
| 33 |
+
<nav class="navbar bg-blue-600 text-white p-4 sticky top-0 z-50 shadow-lg">
|
| 34 |
+
<div class="container mx-auto flex justify-between items-center">
|
| 35 |
+
<h1 class="text-2xl font-bold">Hydrogen Atom Wave Function Visualizer</h1>
|
| 36 |
+
<div class="space-x-4">
|
| 37 |
+
<a href="#theory" class="hover:text-blue-200">Theory</a>
|
| 38 |
+
<a href="#visualizer" class="hover:text-blue-200">Visualizer</a>
|
| 39 |
+
<a href="#interactive" class="hover:text-blue-200">Interactive</a>
|
| 40 |
+
</div>
|
| 41 |
+
</div>
|
| 42 |
+
</nav>
|
| 43 |
+
|
| 44 |
+
<!-- Hero Section -->
|
| 45 |
+
<section class="bg-gradient-to-r from-blue-500 to-purple-600 text-white py-20">
|
| 46 |
+
<div class="container mx-auto px-4 text-center">
|
| 47 |
+
<h1 class="text-4xl md:text-5xl font-bold mb-6">Explore Quantum Realms</h1>
|
| 48 |
+
<p class="text-xl mb-8 max-w-3xl mx-auto">Visualize the mysterious wave functions of the hydrogen atom in 3D space</p>
|
| 49 |
+
<a href="#visualizer" class="bg-white text-blue-600 px-6 py-3 rounded-full font-bold hover:bg-gray-100 transition duration-300 inline-block">
|
| 50 |
+
Start Exploration
|
| 51 |
+
</a>
|
| 52 |
+
</div>
|
| 53 |
+
</section>
|
| 54 |
+
|
| 55 |
+
<!-- Theory Section -->
|
| 56 |
+
<section id="theory" class="py-16 bg-white">
|
| 57 |
+
<div class="container mx-auto px-4">
|
| 58 |
+
<h2 class="text-3xl font-bold mb-8 text-center text-blue-600">Quantum Theory of Hydrogen Atom</h2>
|
| 59 |
+
|
| 60 |
+
<div class="grid md:grid-cols-2 gap-8 items-center">
|
| 61 |
+
<div>
|
| 62 |
+
<h3 class="text-xl font-semibold mb-4 text-purple-600">The Wave Function ψ<sub>nlm</sub>(r,θ,φ)</h3>
|
| 63 |
+
<p class="mb-4">The hydrogen atom's wave functions are solutions to the Schrödinger equation for a Coulomb potential. Each solution is described by three quantum numbers:</p>
|
| 64 |
+
<ul class="list-disc pl-6 mb-6 space-y-2">
|
| 65 |
+
<li><strong>n</strong> - Principal quantum number (energy level, n ≥ 1)</li>
|
| 66 |
+
<li><strong>l</strong> - Angular momentum quantum number (0 ≤ l < n)</li>
|
| 67 |
+
<li><strong>m</strong> - Magnetic quantum number (-l ≤ m ≤ l)</li>
|
| 68 |
+
</ul>
|
| 69 |
+
<p class="mb-6">The wave function separates into radial and angular components:</p>
|
| 70 |
+
<div class="wavefunction-equation bg-gray-100 p-4 rounded-lg text-center mb-6">
|
| 71 |
+
ψ<sub>nlm</sub>(r,θ,φ) = R<sub>nl</sub>(r) Y<sub>l</sub><sup>m</sup>(θ,φ)
|
| 72 |
+
</div>
|
| 73 |
+
</div>
|
| 74 |
+
<div class="bg-gray-100 p-6 rounded-lg">
|
| 75 |
+
<h4 class="text-lg font-semibold mb-4 text-blue-600">Radial Part R<sub>nl</sub>(r)</h4>
|
| 76 |
+
<p class="mb-4">Describes electron distribution as function of distance from nucleus:</p>
|
| 77 |
+
<div class="bg-white p-3 rounded mb-4 overflow-x-auto">
|
| 78 |
+
R<sub>nl</sub>(r) ∝ e<sup>-r/(na<sub>0</sub>)</sup> (2r/(na<sub>0</sub>))<sup>l</sup> L<sub>n-l-1</sub><sup>2l+1</sup>(2r/(na<sub>0</sub>))
|
| 79 |
+
</div>
|
| 80 |
+
<p>Where L are associated Laguerre polynomials and a<sub>0</sub> is the Bohr radius.</p>
|
| 81 |
+
|
| 82 |
+
<h4 class="text-lg font-semibold mt-6 mb-4 text-blue-600">Angular Part Y<sub>l</sub><sup>m</sup>(θ,φ)</h4>
|
| 83 |
+
<p class="mb-4">Spherical harmonics describing angular distribution:</p>
|
| 84 |
+
<div class="bg-white p-3 rounded overflow-x-auto">
|
| 85 |
+
Y<sub>l</sub><sup>m</sup>(θ,φ) ∝ P<sub>l</sub><sup>|m|</sup>(cosθ) e<sup>imφ</sup>
|
| 86 |
+
</div>
|
| 87 |
+
</div>
|
| 88 |
+
</div>
|
| 89 |
+
</div>
|
| 90 |
+
</section>
|
| 91 |
+
|
| 92 |
+
<!-- Visualizer Section -->
|
| 93 |
+
<section id="visualizer" class="py-16 bg-gray-50">
|
| 94 |
+
<div class="container mx-auto px-4">
|
| 95 |
+
<h2 class="text-3xl font-bold mb-8 text-center text-blue-600">Wave Function Visualizer</h2>
|
| 96 |
+
|
| 97 |
+
<div class="bg-white p-6 rounded-lg shadow-lg">
|
| 98 |
+
<div class="grid md:grid-cols-3 gap-6 mb-8">
|
| 99 |
+
<div class="slider-container">
|
| 100 |
+
<label for="n-slider" class="block text-sm font-medium text-gray-700 mb-2">Principal Quantum Number (n)</label>
|
| 101 |
+
<input type="range" id="n-slider" min="1" max="6" value="1" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
|
| 102 |
+
<div class="flex justify-between text-xs text-gray-500 mt-1">
|
| 103 |
+
<span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span>
|
| 104 |
+
</div>
|
| 105 |
+
<div class="text-center mt-2">
|
| 106 |
+
<span id="n-value" class="font-bold text-blue-600">1</span>
|
| 107 |
+
</div>
|
| 108 |
+
</div>
|
| 109 |
+
|
| 110 |
+
<div class="slider-container">
|
| 111 |
+
<label for="l-slider" class="block text-sm font-medium text-gray-700 mb-2">Angular Quantum Number (l)</label>
|
| 112 |
+
<input type="range" id="l-slider" min="0" max="5" value="0" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
|
| 113 |
+
<div class="flex justify-between text-xs text-gray-500 mt-1">
|
| 114 |
+
<span>0</span><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span>
|
| 115 |
+
</div>
|
| 116 |
+
<div class="text-center mt-2">
|
| 117 |
+
<span id="l-value" class="font-bold text-blue-600">0</span>
|
| 118 |
+
</div>
|
| 119 |
+
</div>
|
| 120 |
+
|
| 121 |
+
<div class="slider-container">
|
| 122 |
+
<label for="m-slider" class="block text-sm font-medium text-gray-700 mb-2">Magnetic Quantum Number (m)</label>
|
| 123 |
+
<input type="range" id="m-slider" min="-5" max="5" value="0" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
|
| 124 |
+
<div class="flex justify-between text-xs text-gray-500 mt-1">
|
| 125 |
+
<span>-5</span><span>-3</span><span>-1</span><span>0</span><span>1</span><span>3</span><span>5</span>
|
| 126 |
+
</div>
|
| 127 |
+
<div class="text-center mt-2">
|
| 128 |
+
<span id="m-value" class="font-bold text-blue-600">0</span>
|
| 129 |
+
</div>
|
| 130 |
+
</div>
|
| 131 |
+
</div>
|
| 132 |
+
|
| 133 |
+
<div class="grid md:grid-cols-2 gap-6">
|
| 134 |
+
<div>
|
| 135 |
+
<h3 class="text-xl font-semibold mb-4 text-center text-purple-600">Probability Density |ψ(r,θ,φ)|²</h3>
|
| 136 |
+
<div id="plot3d" class="orbital-canvas rounded-lg shadow-md"></div>
|
| 137 |
+
</div>
|
| 138 |
+
<div>
|
| 139 |
+
<h3 class="text-xl font-semibold mb-4 text-center text-purple-600">Cross-Section View</h3>
|
| 140 |
+
<div id="plot2d" class="orbital-canvas rounded-lg shadow-md"></div>
|
| 141 |
+
</div>
|
| 142 |
+
</div>
|
| 143 |
+
</div>
|
| 144 |
+
</div>
|
| 145 |
+
</section>
|
| 146 |
+
|
| 147 |
+
<!-- Interactive Explanation -->
|
| 148 |
+
<section id="interactive" class="py-16 bg-white">
|
| 149 |
+
<div class="container mx-auto px-4">
|
| 150 |
+
<h2 class="text-3xl font-bold mb-8 text-center text-blue-600">Interactive Explanation</h2>
|
| 151 |
+
|
| 152 |
+
<div class="bg-gray-50 p-6 rounded-lg shadow-lg">
|
| 153 |
+
<div class="grid md:grid-cols-2 gap-6">
|
| 154 |
+
<div>
|
| 155 |
+
<h3 class="text-xl font-semibold mb-4 text-purple-600">What You're Seeing</h3>
|
| 156 |
+
<ul class="space-y-4">
|
| 157 |
+
<li class="flex items-start">
|
| 158 |
+
<div class="bg-blue-100 p-2 rounded-full mr-3">
|
| 159 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-blue-600" viewBox="0 0 20 20" fill="currentColor">
|
| 160 |
+
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2h-1V9z" clip-rule="evenodd" />
|
| 161 |
+
</svg>
|
| 162 |
+
</div>
|
| 163 |
+
<div>
|
| 164 |
+
<strong class="text-blue-600">3D Plot:</strong> Shows the probability density (darker regions indicate higher probability of finding the electron)
|
| 165 |
+
</div>
|
| 166 |
+
</li>
|
| 167 |
+
<li class="flex items-start">
|
| 168 |
+
<div class="bg-blue-100 p-2 rounded-full mr-3">
|
| 169 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-blue-600" viewBox="0 0 20 20" fill="currentColor">
|
| 170 |
+
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2h-1V9z" clip-rule="evenodd" />
|
| 171 |
+
</svg>
|
| 172 |
+
</div>
|
| 173 |
+
<div>
|
| 174 |
+
<strong class="text-blue-600">2D Slice:</strong> Displays a cross-section through the center of the atom (x-z plane)
|
| 175 |
+
</div>
|
| 176 |
+
</li>
|
| 177 |
+
<li class="flex items-start">
|
| 178 |
+
<div class="bg-blue-100 p-2 rounded-full mr-3">
|
| 179 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-blue-600" viewBox="0 0 20 20" fill="currentColor">
|
| 180 |
+
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2h-1V9z" clip-rule="evenodd" />
|
| 181 |
+
</svg>
|
| 182 |
+
</div>
|
| 183 |
+
<div>
|
| 184 |
+
<strong class="text-blue-600">Quantum Numbers:</strong> Change n, l, m to see different orbitals (1s, 2p, 3d, etc.)
|
| 185 |
+
</div>
|
| 186 |
+
</li>
|
| 187 |
+
</ul>
|
| 188 |
+
</div>
|
| 189 |
+
|
| 190 |
+
<div>
|
| 191 |
+
<h3 class="text-xl font-semibold mb-4 text-purple-600">Key Observations</h3>
|
| 192 |
+
<div class="space-y-4">
|
| 193 |
+
<div class="flex items-start">
|
| 194 |
+
<div class="bg-green-100 p-2 rounded-full mr-3">
|
| 195 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-green-600" viewBox="0 0 20 20" fill="currentColor">
|
| 196 |
+
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
|
| 197 |
+
</svg>
|
| 198 |
+
</div>
|
| 199 |
+
<div>
|
| 200 |
+
<strong>n determines:</strong> Number of radial nodes (n-l-1) and size of orbital
|
| 201 |
+
</div>
|
| 202 |
+
</div>
|
| 203 |
+
<div class="flex items-start">
|
| 204 |
+
<div class="bg-green-100 p-2 rounded-full mr-3">
|
| 205 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-green-600" viewBox="0 0 20 20" fill="currentColor">
|
| 206 |
+
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
|
| 207 |
+
</svg>
|
| 208 |
+
</div>
|
| 209 |
+
<div>
|
| 210 |
+
<strong>l determines:</strong> Shape of orbital (s=sphere, p=dumbbell, d=cloverleaf, etc.)
|
| 211 |
+
</div>
|
| 212 |
+
</div>
|
| 213 |
+
<div class="flex items-start">
|
| 214 |
+
<div class="bg-green-100 p-2 rounded-full mr-3">
|
| 215 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-green-600" viewBox="0 0 20 20" fill="currentColor">
|
| 216 |
+
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
|
| 217 |
+
</svg>
|
| 218 |
+
</div>
|
| 219 |
+
<div>
|
| 220 |
+
<strong>m determines:</strong> Orientation of orbital in space
|
| 221 |
+
</div>
|
| 222 |
+
</div>
|
| 223 |
+
</div>
|
| 224 |
+
</div>
|
| 225 |
+
</div>
|
| 226 |
+
</div>
|
| 227 |
+
</div>
|
| 228 |
+
</section>
|
| 229 |
+
|
| 230 |
+
<footer class="bg-gray-800 text-white py-8">
|
| 231 |
+
<div class="container mx-auto px-4 text-center">
|
| 232 |
+
<p class="mb-4">Hydrogen Atom Wave Function Visualizer</p>
|
| 233 |
+
<p class="text-sm text-gray-400">Created with Plotly.js, Math.js, and Tailwind CSS</p>
|
| 234 |
+
<p class="text-sm text-gray-400 mt-2">© 2023 Quantum Visualization Project</p>
|
| 235 |
+
</div>
|
| 236 |
+
</footer>
|
| 237 |
+
|
| 238 |
+
<script>
|
| 239 |
+
// Initialize quantum numbers
|
| 240 |
+
let n = 1, l = 0, m = 0;
|
| 241 |
+
|
| 242 |
+
// Update display values when sliders change
|
| 243 |
+
document.getElementById('n-slider').addEventListener('input', function() {
|
| 244 |
+
n = parseInt(this.value);
|
| 245 |
+
document.getElementById('n-value').textContent = n;
|
| 246 |
+
updateLMax();
|
| 247 |
+
updateWaveFunction();
|
| 248 |
+
});
|
| 249 |
+
|
| 250 |
+
document.getElementById('l-slider').addEventListener('input', function() {
|
| 251 |
+
l = parseInt(this.value);
|
| 252 |
+
document.getElementById('l-value').textContent = l;
|
| 253 |
+
updateMMax();
|
| 254 |
+
updateWaveFunction();
|
| 255 |
+
});
|
| 256 |
+
|
| 257 |
+
document.getElementById('m-slider').addEventListener('input', function() {
|
| 258 |
+
m = parseInt(this.value);
|
| 259 |
+
document.getElementById('m-value').textContent = m;
|
| 260 |
+
updateWaveFunction();
|
| 261 |
+
});
|
| 262 |
+
|
| 263 |
+
// Constrain l to be less than n
|
| 264 |
+
function updateLMax() {
|
| 265 |
+
const lSlider = document.getElementById('l-slider');
|
| 266 |
+
const currentL = parseInt(lSlider.value);
|
| 267 |
+
const newMax = n - 1;
|
| 268 |
+
lSlider.max = newMax;
|
| 269 |
+
|
| 270 |
+
if (currentL > newMax) {
|
| 271 |
+
l = newMax;
|
| 272 |
+
lSlider.value = newMax;
|
| 273 |
+
document.getElementById('l-value').textContent = newMax;
|
| 274 |
+
}
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
// Constrain |m| to be ≤ l
|
| 278 |
+
function updateMMax() {
|
| 279 |
+
const mSlider = document.getElementById('m-slider');
|
| 280 |
+
const currentM = parseInt(mSlider.value);
|
| 281 |
+
mSlider.min = -l;
|
| 282 |
+
mSlider.max = l;
|
| 283 |
+
|
| 284 |
+
if (Math.abs(currentM) > l) {
|
| 285 |
+
m = 0;
|
| 286 |
+
mSlider.value = 0;
|
| 287 |
+
document.getElementById('m-value').textContent = 0;
|
| 288 |
+
}
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
// Generate data for the wave function
|
| 292 |
+
function generateWaveFunctionData(n, l, m) {
|
| 293 |
+
// Constants
|
| 294 |
+
const a0 = 1; // Bohr radius
|
| 295 |
+
const numPoints = 50;
|
| 296 |
+
const maxR = 5 * n; // Scale with n
|
| 297 |
+
|
| 298 |
+
// Radial grid
|
| 299 |
+
const r = math.linspace(0.1, maxR, numPoints);
|
| 300 |
+
|
| 301 |
+
// Angular grid
|
| 302 |
+
const theta = math.linspace(0, Math.PI, numPoints);
|
| 303 |
+
const phi = math.linspace(0, 2 * Math.PI, numPoints);
|
| 304 |
+
|
| 305 |
+
// Combined grid for probability density calculation
|
| 306 |
+
const xArr = [], yArr = [], zArr = [], cArr = [];
|
| 307 |
+
const xSlice = [], zSlice = [], cSlice = []; // For 2D slice at y=0
|
| 308 |
+
|
| 309 |
+
for (let i = 0; i < numPoints; i++) {
|
| 310 |
+
for (let j = 0; j < numPoints; j++) {
|
| 311 |
+
for (let k = 0; k < numPoints; k += 5) { // Sample sparsely in z for performance
|
| 312 |
+
const rad = r[i];
|
| 313 |
+
const thetaVal = theta[j];
|
| 314 |
+
const phiVal = phi[k];
|
| 315 |
+
|
| 316 |
+
// Convert to cartesian
|
| 317 |
+
const x = rad * Math.sin(thetaVal) * Math.cos(phiVal);
|
| 318 |
+
const y = rad * Math.sin(thetaVal) * Math.sin(phiVal);
|
| 319 |
+
const z = rad * Math.cos(thetaVal);
|
| 320 |
+
|
| 321 |
+
// Simple approximation of probability density (actual would need proper wave functions)
|
| 322 |
+
// Radial part (simplified)
|
| 323 |
+
const radialPart = Math.exp(-rad/(n*a0)) * Math.pow(rad, l);
|
| 324 |
+
|
| 325 |
+
// Angular part (simplified)
|
| 326 |
+
let angularPart;
|
| 327 |
+
if (l === 0) { // s orbital
|
| 328 |
+
angularPart = 1;
|
| 329 |
+
} else if (l === 1) { // p orbital
|
| 330 |
+
if (m === 0) angularPart = Math.cos(thetaVal);
|
| 331 |
+
else angularPart = Math.sin(thetaVal) * Math.cos(phiVal);
|
| 332 |
+
} else { // d and higher (simplified)
|
| 333 |
+
angularPart = Math.pow(Math.sin(thetaVal), Math.abs(m)) * Math.cos(m*phiVal);
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
// Probability density (absolute square of wave function)
|
| 337 |
+
const probDensity = Math.pow(radialPart * angularPart, 2);
|
| 338 |
+
|
| 339 |
+
// Only plot points with significant probability
|
| 340 |
+
if (probDensity > 0.001 * Math.max(1, n*n)) {
|
| 341 |
+
xArr.push(x);
|
| 342 |
+
yArr.push(y);
|
| 343 |
+
zArr.push(z);
|
| 344 |
+
cArr.push(probDensity);
|
| 345 |
+
|
| 346 |
+
// For 2D slice (y=0 plane)
|
| 347 |
+
if (Math.abs(phiVal) < 0.3 || Math.abs(phiVal - Math.PI) < 0.3) {
|
| 348 |
+
xSlice.push(x);
|
| 349 |
+
zSlice.push(z);
|
| 350 |
+
cSlice.push(probDensity);
|
| 351 |
+
}
|
| 352 |
+
}
|
| 353 |
+
}
|
| 354 |
+
}
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
return {x3d: xArr, y3d: yArr, z3d: zArr, c3d: cArr,
|
| 358 |
+
x2d: xSlice, z2d: zSlice, c2d: cSlice};
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
// Update the plots with new wave function data
|
| 362 |
+
function updateWaveFunction() {
|
| 363 |
+
const data = generateWaveFunctionData(n, l, m);
|
| 364 |
+
|
| 365 |
+
// 3D plot
|
| 366 |
+
const trace3d = {
|
| 367 |
+
x: data.x3d,
|
| 368 |
+
y: data.y3d,
|
| 369 |
+
z: data.z3d,
|
| 370 |
+
mode: 'markers',
|
| 371 |
+
marker: {
|
| 372 |
+
size: 3,
|
| 373 |
+
color: data.c3d,
|
| 374 |
+
colorscale: 'Viridis',
|
| 375 |
+
opacity: 0.8,
|
| 376 |
+
showscale: true,
|
| 377 |
+
colorbar: {
|
| 378 |
+
title: 'Probability<br>Density'
|
| 379 |
+
}
|
| 380 |
+
},
|
| 381 |
+
type: 'scatter3d'
|
| 382 |
+
};
|
| 383 |
+
|
| 384 |
+
Plotly.newPlot('plot3d', [trace3d], {
|
| 385 |
+
title: `Hydrogen Orbital (n=${n}, l=${l}, m=${m})`,
|
| 386 |
+
scene: {
|
| 387 |
+
xaxis: {title: 'x'},
|
| 388 |
+
yaxis: {title: 'y'},
|
| 389 |
+
zaxis: {title: 'z'},
|
| 390 |
+
aspectratio: {x: 1, y: 1, z: 1}
|
| 391 |
+
},
|
| 392 |
+
margin: {l: 0, r: 0, b: 0, t: 40}
|
| 393 |
+
});
|
| 394 |
+
|
| 395 |
+
// 2D plot
|
| 396 |
+
const trace2d = {
|
| 397 |
+
x: data.x2d,
|
| 398 |
+
y: data.z2d,
|
| 399 |
+
mode: 'markers',
|
| 400 |
+
marker: {
|
| 401 |
+
size: 5,
|
| 402 |
+
color: data.c2d,
|
| 403 |
+
colorscale: 'Viridis',
|
| 404 |
+
opacity: 0.8,
|
| 405 |
+
showscale: true
|
| 406 |
+
},
|
| 407 |
+
type: 'scatter'
|
| 408 |
+
};
|
| 409 |
+
|
| 410 |
+
Plotly.newPlot('plot2d', [trace2d], {
|
| 411 |
+
title: `2D Cross-Section (x-z plane)`,
|
| 412 |
+
xaxis: {title: 'x'},
|
| 413 |
+
yaxis: {title: 'z', scaleanchor: 'x'},
|
| 414 |
+
margin: {l: 50, r: 0, b: 50, t: 40}
|
| 415 |
+
});
|
| 416 |
+
}
|
| 417 |
+
|
| 418 |
+
// Initialize
|
| 419 |
+
updateWaveFunction();
|
| 420 |
+
</script>
|
| 421 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=holyhigh666/hydrogen" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 422 |
+
</html>
|