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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 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>Advanced Atom Simulator</title>
|
| 7 |
+
<style>
|
| 8 |
+
body {
|
| 9 |
+
margin: 0;
|
| 10 |
+
overflow: hidden;
|
| 11 |
+
font-family: 'Roboto', sans-serif;
|
| 12 |
+
background: linear-gradient(to right, #0f2027, #203a43, #2c5364);
|
| 13 |
+
color: #f0f0f0;
|
| 14 |
+
display: flex;
|
| 15 |
+
flex-direction: column;
|
| 16 |
+
align-items: center;
|
| 17 |
+
justify-content: center;
|
| 18 |
+
height: 100vh;
|
| 19 |
+
}
|
| 20 |
+
#controls {
|
| 21 |
+
position: absolute;
|
| 22 |
+
top: 10px;
|
| 23 |
+
width: 100%;
|
| 24 |
+
display: flex;
|
| 25 |
+
justify-content: center;
|
| 26 |
+
gap: 20px;
|
| 27 |
+
backdrop-filter: blur(10px);
|
| 28 |
+
padding: 20px;
|
| 29 |
+
background: rgba(255, 255, 255, 0.1);
|
| 30 |
+
border-radius: 10px;
|
| 31 |
+
z-index: 10;
|
| 32 |
+
}
|
| 33 |
+
.control {
|
| 34 |
+
display: flex;
|
| 35 |
+
flex-direction: column;
|
| 36 |
+
align-items: center;
|
| 37 |
+
}
|
| 38 |
+
.control label {
|
| 39 |
+
margin-bottom: 5px;
|
| 40 |
+
font-weight: bold;
|
| 41 |
+
}
|
| 42 |
+
.control input, .control select {
|
| 43 |
+
width: 80px;
|
| 44 |
+
padding: 10px;
|
| 45 |
+
border: none;
|
| 46 |
+
border-radius: 5px;
|
| 47 |
+
background: #333;
|
| 48 |
+
color: #fff;
|
| 49 |
+
text-align: center;
|
| 50 |
+
}
|
| 51 |
+
#info {
|
| 52 |
+
position: absolute;
|
| 53 |
+
bottom: 20px;
|
| 54 |
+
text-align: center;
|
| 55 |
+
background: rgba(255, 255, 255, 0.1);
|
| 56 |
+
padding: 20px;
|
| 57 |
+
border-radius: 10px;
|
| 58 |
+
backdrop-filter: blur(10px);
|
| 59 |
+
z-index: 10;
|
| 60 |
+
}
|
| 61 |
+
#info div {
|
| 62 |
+
margin: 5px 0;
|
| 63 |
+
font-size: 1.2em;
|
| 64 |
+
}
|
| 65 |
+
canvas {
|
| 66 |
+
background-color: transparent;
|
| 67 |
+
}
|
| 68 |
+
</style>
|
| 69 |
+
</head>
|
| 70 |
+
<body>
|
| 71 |
+
<div id="controls">
|
| 72 |
+
<div class="control">
|
| 73 |
+
<label for="elements">Element</label>
|
| 74 |
+
<select id="elements"></select>
|
| 75 |
+
</div>
|
| 76 |
+
<div class="control">
|
| 77 |
+
<label for="protons">Protons</label>
|
| 78 |
+
<input type="number" id="protons" min="1" value="1">
|
| 79 |
+
</div>
|
| 80 |
+
<div class="control">
|
| 81 |
+
<label for="neutrons">Neutrons</label>
|
| 82 |
+
<input type="number" id="neutrons" min="0" value="1">
|
| 83 |
+
</div>
|
| 84 |
+
<div class="control">
|
| 85 |
+
<label for="electrons">Electrons</label>
|
| 86 |
+
<input type="number" id="electrons" min="1" value="1">
|
| 87 |
+
</div>
|
| 88 |
+
</div>
|
| 89 |
+
<div id="info">
|
| 90 |
+
<div id="elementName">Element: Hydrogen</div>
|
| 91 |
+
<div id="azeNotation">AZE Notation: 2H1</div>
|
| 92 |
+
<div id="elementMass">Mass: 2.016 u</div>
|
| 93 |
+
</div>
|
| 94 |
+
<canvas id="atomCanvas"></canvas>
|
| 95 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
|
| 96 |
+
<script>
|
| 97 |
+
const canvas = document.getElementById('atomCanvas');
|
| 98 |
+
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true });
|
| 99 |
+
const scene = new THREE.Scene();
|
| 100 |
+
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
|
| 101 |
+
camera.position.z = 10;
|
| 102 |
+
|
| 103 |
+
renderer.setSize(window.innerWidth, window.innerHeight);
|
| 104 |
+
const light = new THREE.AmbientLight(0x404040, 2);
|
| 105 |
+
scene.add(light);
|
| 106 |
+
|
| 107 |
+
const protonGeometry = new THREE.SphereGeometry(0.3, 32, 32);
|
| 108 |
+
const neutronGeometry = new THREE.SphereGeometry(0.3, 32, 32);
|
| 109 |
+
const electronGeometry = new THREE.SphereGeometry(0.1, 32, 32);
|
| 110 |
+
|
| 111 |
+
const protonMaterial = new THREE.MeshStandardMaterial({ color: 0xFF3333 });
|
| 112 |
+
const neutronMaterial = new THREE.MeshStandardMaterial({ color: 0x3333FF });
|
| 113 |
+
const electronMaterial = new THREE.MeshStandardMaterial({ color: 0x33FF33 });
|
| 114 |
+
|
| 115 |
+
const nucleus = new THREE.Group();
|
| 116 |
+
scene.add(nucleus);
|
| 117 |
+
|
| 118 |
+
const electrons = [];
|
| 119 |
+
|
| 120 |
+
const elements = {
|
| 121 |
+
1: { name: "Hydrogen", symbol: "H", mass: 1.008 },
|
| 122 |
+
2: { name: "Helium", symbol: "He", mass: 4.0026 },
|
| 123 |
+
3: { name: "Lithium", symbol: "Li", mass: 6.94 },
|
| 124 |
+
4: { name: "Beryllium", symbol: "Be", mass: 9.0122 },
|
| 125 |
+
5: { name: "Boron", symbol: "B", mass: 10.81 },
|
| 126 |
+
6: { name: "Carbon", symbol: "C", mass: 12.011 },
|
| 127 |
+
7: { name: "Nitrogen", symbol: "N", mass: 14.007 },
|
| 128 |
+
8: { name: "Oxygen", symbol: "O", mass: 15.999 },
|
| 129 |
+
9: { name: "Fluorine", symbol: "F", mass: 18.998 },
|
| 130 |
+
10: { name: "Neon", symbol: "Ne", mass: 20.180 },
|
| 131 |
+
11: { name: "Sodium", symbol: "Na", mass: 22.990 },
|
| 132 |
+
12: { name: "Magnesium", symbol: "Mg", mass: 24.305 },
|
| 133 |
+
13: { name: "Aluminium", symbol: "Al", mass: 26.982 },
|
| 134 |
+
14: { name: "Silicon", symbol: "Si", mass: 28.085 },
|
| 135 |
+
15: { name: "Phosphorus", symbol: "P", mass: 30.974 },
|
| 136 |
+
16: { name: "Sulfur", symbol: "S", mass: 32.06 },
|
| 137 |
+
17: { name: "Chlorine", symbol: "Cl", mass: 35.45 },
|
| 138 |
+
18: { name: "Argon", symbol: "Ar", mass: 39.948 },
|
| 139 |
+
19: { name: "Potassium", symbol: "K", mass: 39.098 },
|
| 140 |
+
20: { name: "Calcium", symbol: "Ca", mass: 40.078 },
|
| 141 |
+
21: { name: "Scandium", symbol: "Sc", mass: 44.956 },
|
| 142 |
+
22: { name: "Titanium", symbol: "Ti", mass: 47.867 },
|
| 143 |
+
23: { name: "Vanadium", symbol: "V", mass: 50.942 },
|
| 144 |
+
24: { name: "Chromium", symbol: "Cr", mass: 51.996 },
|
| 145 |
+
25: { name: "Manganese", symbol: "Mn", mass: 54.938 },
|
| 146 |
+
26: { name: "Iron", symbol: "Fe", mass: 55.845 },
|
| 147 |
+
27: { name: "Cobalt", symbol: "Co", mass: 58.933 },
|
| 148 |
+
28: { name: "Nickel", symbol: "Ni", mass: 58.693 },
|
| 149 |
+
29: { name: "Copper", symbol: "Cu", mass: 63.546 },
|
| 150 |
+
30: { name: "Zinc", symbol: "Zn", mass: 65.38 },
|
| 151 |
+
31: { name: "Gallium", symbol: "Ga", mass: 69.723 },
|
| 152 |
+
32: { name: "Germanium", symbol: "Ge", mass: 72.630 },
|
| 153 |
+
33: { name: "Arsenic", symbol: "As", mass: 74.922 },
|
| 154 |
+
34: { name: "Selenium", symbol: "Se", mass: 78.971 },
|
| 155 |
+
35: { name: "Bromine", symbol: "Br", mass: 79.904 },
|
| 156 |
+
36: { name: "Krypton", symbol: "Kr", mass: 83.798 },
|
| 157 |
+
37: { name: "Rubidium", symbol: "Rb", mass: 85.468 },
|
| 158 |
+
38: { name: "Strontium", symbol: "Sr", mass: 87.62 },
|
| 159 |
+
39: { name: "Yttrium", symbol: "Y", mass: 88.906 },
|
| 160 |
+
40: { name: "Zirconium", symbol: "Zr", mass: 91.224 },
|
| 161 |
+
41: { name: "Niobium", symbol: "Nb", mass: 92.906 },
|
| 162 |
+
42: { name: "Molybdenum", symbol: "Mo", mass: 95.95 },
|
| 163 |
+
43: { name: "Technetium", symbol: "Tc", mass: 98 },
|
| 164 |
+
44: { name: "Ruthenium", symbol: "Ru", mass: 101.07 },
|
| 165 |
+
45: { name: "Rhodium", symbol: "Rh", mass: 102.91 },
|
| 166 |
+
46: { name: "Palladium", symbol: "Pd", mass: 106.42 },
|
| 167 |
+
47: { name: "Silver", symbol: "Ag", mass: 107.87 },
|
| 168 |
+
48: { name: "Cadmium", symbol: "Cd", mass: 112.41 },
|
| 169 |
+
49: { name: "Indium", symbol: "In", mass: 114.82 },
|
| 170 |
+
50: { name: "Tin", symbol: "Sn", mass: 118.71 },
|
| 171 |
+
51: { name: "Antimony", symbol: "Sb", mass: 121.76 },
|
| 172 |
+
52: { name: "Tellurium", symbol: "Te", mass: 127.60 },
|
| 173 |
+
53: { name: "Iodine", symbol: "I", mass: 126.90 },
|
| 174 |
+
54: { name: "Xenon", symbol: "Xe", mass: 131.29 },
|
| 175 |
+
55: { name: "Cesium", symbol: "Cs", mass: 132.91 },
|
| 176 |
+
56: { name: "Barium", symbol: "Ba", mass: 137.33 },
|
| 177 |
+
57: { name: "Lanthanum", symbol: "La", mass: 138.91 },
|
| 178 |
+
58: { name: "Cerium", symbol: "Ce", mass: 140.12 },
|
| 179 |
+
59: { name: "Praseodymium", symbol: "Pr", mass: 140.91 },
|
| 180 |
+
60: { name: "Neodymium", symbol: "Nd", mass: 144.24 },
|
| 181 |
+
61: { name: "Promethium", symbol: "Pm", mass: 145 },
|
| 182 |
+
62: { name: "Samarium", symbol: "Sm", mass: 150.36 },
|
| 183 |
+
63: { name: "Europium", symbol: "Eu", mass: 151.96 },
|
| 184 |
+
64: { name: "Gadolinium", symbol: "Gd", mass: 157.25 },
|
| 185 |
+
65: { name: "Terbium", symbol: "Tb", mass: 158.93 },
|
| 186 |
+
66: { name: "Dysprosium", symbol: "Dy", mass: 162.50 },
|
| 187 |
+
67: { name: "Holmium", symbol: "Ho", mass: 164.93 },
|
| 188 |
+
68: { name: "Erbium", symbol: "Er", mass: 167.26 },
|
| 189 |
+
69: { name: "Thulium", symbol: "Tm", mass: 168.93 },
|
| 190 |
+
70: { name: "Ytterbium", symbol: "Yb", mass: 173.05 },
|
| 191 |
+
71: { name: "Lutetium", symbol: "Lu", mass: 174.97 },
|
| 192 |
+
72: { name: "Hafnium", symbol: "Hf", mass: 178.49 },
|
| 193 |
+
73: { name: "Tantalum", symbol: "Ta", mass: 180.95 },
|
| 194 |
+
74: { name: "Tungsten", symbol: "W", mass: 183.84 },
|
| 195 |
+
75: { name: "Rhenium", symbol: "Re", mass: 186.21 },
|
| 196 |
+
76: { name: "Osmium", symbol: "Os", mass: 190.23 },
|
| 197 |
+
77: { name: "Iridium", symbol: "Ir", mass: 192.22 },
|
| 198 |
+
78: { name: "Platinum", symbol: "Pt", mass: 195.08 },
|
| 199 |
+
79: { name: "Gold", symbol: "Au", mass: 196.97 },
|
| 200 |
+
80: { name: "Mercury", symbol: "Hg", mass: 200.59 },
|
| 201 |
+
81: { name: "Thallium", symbol: "Tl", mass: 204.38 },
|
| 202 |
+
82: { name: "Lead", symbol: "Pb", mass: 207.2 },
|
| 203 |
+
83: { name: "Bismuth", symbol: "Bi", mass: 208.98 },
|
| 204 |
+
84: { name: "Polonium", symbol: "Po", mass: 209 },
|
| 205 |
+
85: { name: "Astatine", symbol: "At", mass: 210 },
|
| 206 |
+
86: { name: "Radon", symbol: "Rn", mass: 222 },
|
| 207 |
+
87: { name: "Francium", symbol: "Fr", mass: 223 },
|
| 208 |
+
88: { name: "Radium", symbol: "Ra", mass: 226 },
|
| 209 |
+
89: { name: "Actinium", symbol: "Ac", mass: 227 },
|
| 210 |
+
90: { name: "Thorium", symbol: "Th", mass: 232.04 },
|
| 211 |
+
91: { name: "Protactinium", symbol: "Pa", mass: 231.04 },
|
| 212 |
+
92: { name: "Uranium", symbol: "U", mass: 238.03 },
|
| 213 |
+
93: { name: "Neptunium", symbol: "Np", mass: 237 },
|
| 214 |
+
94: { name: "Plutonium", symbol: "Pu", mass: 244 },
|
| 215 |
+
95: { name: "Americium", symbol: "Am", mass: 243 },
|
| 216 |
+
96: { name: "Curium", symbol: "Cm", mass: 247 },
|
| 217 |
+
97: { name: "Berkelium", symbol: "Bk", mass: 247 },
|
| 218 |
+
98: { name: "Californium", symbol: "Cf", mass: 251 },
|
| 219 |
+
99: { name: "Einsteinium", symbol: "Es", mass: 252 },
|
| 220 |
+
100: { name: "Fermium", symbol: "Fm", mass: 257 },
|
| 221 |
+
101: { name: "Mendelevium", symbol: "Md", mass: 258 },
|
| 222 |
+
102: { name: "Nobelium", symbol: "No", mass: 259 },
|
| 223 |
+
103: { name: "Lawrencium", symbol: "Lr", mass: 266 },
|
| 224 |
+
104: { name: "Rutherfordium", symbol: "Rf", mass: 267 },
|
| 225 |
+
105: { name: "Dubnium", symbol: "Db", mass: 270 },
|
| 226 |
+
106: { name: "Seaborgium", symbol: "Sg", mass: 271 },
|
| 227 |
+
107: { name: "Bohrium", symbol: "Bh", mass: 270 },
|
| 228 |
+
108: { name: "Hassium", symbol: "Hs", mass: 277 },
|
| 229 |
+
109: { name: "Meitnerium", symbol: "Mt", mass: 278 },
|
| 230 |
+
110: { name: "Darmstadtium", symbol: "Ds", mass: 281 },
|
| 231 |
+
111: { name: "Roentgenium", symbol: "Rg", mass: 282 },
|
| 232 |
+
112: { name: "Copernicium", symbol: "Cn", mass: 285 },
|
| 233 |
+
113: { name: "Nihonium", symbol: "Nh", mass: 286 },
|
| 234 |
+
114: { name: "Flerovium", symbol: "Fl", mass: 289 },
|
| 235 |
+
115: { name: "Moscovium", symbol: "Mc", mass: 290 },
|
| 236 |
+
116: { name: "Livermorium", symbol: "Lv", mass: 293 },
|
| 237 |
+
117: { name: "Tennessine", symbol: "Ts", mass: 294 },
|
| 238 |
+
118: { name: "Oganesson", symbol: "Og", mass: 294 }
|
| 239 |
+
};
|
| 240 |
+
|
| 241 |
+
const elementSelect = document.getElementById('elements');
|
| 242 |
+
Object.keys(elements).forEach(key => {
|
| 243 |
+
const option = document.createElement('option');
|
| 244 |
+
option.value = key;
|
| 245 |
+
option.textContent = elements[key].name;
|
| 246 |
+
elementSelect.appendChild(option);
|
| 247 |
+
});
|
| 248 |
+
|
| 249 |
+
function createParticles(numProtons, numNeutrons, numElectrons) {
|
| 250 |
+
nucleus.clear();
|
| 251 |
+
electrons.forEach(e => scene.remove(e));
|
| 252 |
+
electrons.length = 0;
|
| 253 |
+
|
| 254 |
+
for (let i = 0; i < numProtons; i++) {
|
| 255 |
+
const proton = new THREE.Mesh(protonGeometry, protonMaterial);
|
| 256 |
+
proton.position.set((Math.random() - 0.5), (Math.random() - 0.5), (Math.random() - 0.5));
|
| 257 |
+
nucleus.add(proton);
|
| 258 |
+
}
|
| 259 |
+
for (let i = 0; i < numNeutrons; i++) {
|
| 260 |
+
const neutron = new THREE.Mesh(neutronGeometry, neutronMaterial);
|
| 261 |
+
neutron.position.set((Math.random() - 0.5), (Math.random() - 0.5), (Math.random() - 0.5));
|
| 262 |
+
nucleus.add(neutron);
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
for (let i = 0; i < numElectrons; i++) {
|
| 266 |
+
const electron = new THREE.Mesh(electronGeometry, electronMaterial);
|
| 267 |
+
const angle = (i / numElectrons) * Math.PI * 2;
|
| 268 |
+
const radius = 2.5;
|
| 269 |
+
electron.position.set(Math.cos(angle) * radius, Math.sin(angle) * radius, 0);
|
| 270 |
+
scene.add(electron);
|
| 271 |
+
electrons.push(electron);
|
| 272 |
+
}
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
function animate() {
|
| 276 |
+
requestAnimationFrame(animate);
|
| 277 |
+
nucleus.rotation.y += 0.01;
|
| 278 |
+
electrons.forEach((e, i) => {
|
| 279 |
+
e.position.x = Math.cos(Date.now() * 0.001 + i) * 2.5;
|
| 280 |
+
e.position.y = Math.sin(Date.now() * 0.001 + i) * 2.5;
|
| 281 |
+
});
|
| 282 |
+
renderer.render(scene, camera);
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
function updateInfo() {
|
| 286 |
+
const numProtons = parseInt(document.getElementById('protons').value);
|
| 287 |
+
const numNeutrons = parseInt(document.getElementById('neutrons').value);
|
| 288 |
+
const numElectrons = parseInt(document.getElementById('electrons').value);
|
| 289 |
+
const selectedElement = elements[numProtons] || { name: "Unknown", symbol: "?", mass: 0 };
|
| 290 |
+
|
| 291 |
+
const massNumber = numProtons + numNeutrons;
|
| 292 |
+
const calculatedMass = numProtons * 1.007 + numNeutrons * 1.008 + numElectrons * 0.00055;
|
| 293 |
+
|
| 294 |
+
document.getElementById('elementName').textContent = `Element: ${selectedElement.name}`;
|
| 295 |
+
document.getElementById('azeNotation').textContent = `AZE Notation: ${massNumber}${selectedElement.symbol}${numProtons}`;
|
| 296 |
+
document.getElementById('elementMass').textContent = `Mass: ${calculatedMass.toFixed(3)} u`;
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
document.querySelectorAll('input[type="number"]').forEach(input => {
|
| 300 |
+
input.addEventListener('input', () => {
|
| 301 |
+
const numProtons = parseInt(document.getElementById('protons').value);
|
| 302 |
+
const numNeutrons = parseInt(document.getElementById('neutrons').value);
|
| 303 |
+
const numElectrons = parseInt(document.getElementById('electrons').value);
|
| 304 |
+
|
| 305 |
+
createParticles(numProtons, numNeutrons, numElectrons);
|
| 306 |
+
updateInfo();
|
| 307 |
+
});
|
| 308 |
+
});
|
| 309 |
+
|
| 310 |
+
elementSelect.addEventListener('change', () => {
|
| 311 |
+
const selectedElement = elements[elementSelect.value];
|
| 312 |
+
document.getElementById('protons').value = elementSelect.value;
|
| 313 |
+
document.getElementById('neutrons').value = Math.round(selectedElement.mass) - elementSelect.value;
|
| 314 |
+
document.getElementById('electrons').value = elementSelect.value;
|
| 315 |
+
createParticles(elementSelect.value, Math.round(selectedElement.mass) - elementSelect.value, elementSelect.value);
|
| 316 |
+
updateInfo();
|
| 317 |
+
});
|
| 318 |
+
|
| 319 |
+
createParticles(1, 1, 1);
|
| 320 |
+
animate();
|
| 321 |
+
updateInfo();
|
| 322 |
+
|
| 323 |
+
window.addEventListener('resize', () => {
|
| 324 |
+
camera.aspect = window.innerWidth / window.innerHeight;
|
| 325 |
+
camera.updateProjectionMatrix();
|
| 326 |
+
renderer.setSize(window.innerWidth, window.innerHeight);
|
| 327 |
+
});
|
| 328 |
+
</script>
|
| 329 |
+
</body>
|
| 330 |
</html>
|