renderAtom
Renders an atomic model visualization showing electron shells and their electron distribution for a given element.- A title showing the element symbol and atomic number
- An SVG visualization with a nucleus (labeled with the element symbol)
- Orbital rings representing electron shells
- Individual electrons positioned around each shell
Parameters
The DOM element ID where the atom visualization will be rendered. The function will clear any existing content in this container.
The atomic number (Z) of the element to visualize. This determines the electron configuration.
The chemical symbol of the element (e.g., “Si”, “P”, “B”). This is displayed in the nucleus and title.
Side effects
- Modifies the
innerHTMLof the target DOM element - Returns
undefinedif the container element is not found - Uses Tailwind CSS classes for styling (requires Tailwind CSS to be available)
- Generates an SVG with dynamically calculated viewBox based on the number of electron shells
Example usage
renderLattice
Renders a crystal lattice structure visualization showing a semiconductor material with optional dopant atoms.- A title indicating the material type
- A 3×3 grid representing the crystal lattice
- Host atoms (shown in blue)
- A central dopant atom (shown in orange) if the material is not intrinsic
- Visual indicators for excess electrons (N-type) or holes (P-type)
- A descriptive caption explaining the doping type
Parameters
The DOM element ID where the lattice visualization will be rendered. The function will clear any existing content in this container.
The atomic number of the host material (typically Silicon, Z=14)
The atomic number of the dopant element (e.g., Phosphorus Z=15 for N-type, Boron Z=5 for P-type)
The semiconductor material classification. Expected values:
"Intrínseco (Aislante)"— Pure semiconductor with no dopant visualization"Tipo N (Exceso de electrones)"— N-type with electron visualization"Tipo P (Exceso de huecos)"— P-type with hole visualization
determineMaterial().Side effects
- Modifies the
innerHTMLof the target DOM element - Returns
undefinedif the container element is not found - Uses Tailwind CSS classes for styling (requires Tailwind CSS to be available)
- Generates an SVG showing a 3×3 atom grid with connecting bonds
- The center atom is replaced with the dopant unless the material is intrinsic
