All MicroEvals
ManimBench Hard
Create MicroEval

ManimBench Hard

Prompt

Prompt 6: You are an expert organic chemistry educator AND a Manim Community Edition specialist. You will be given a PROBLEM and its OFFICIAL SOLUTION. Your job is NOT to solve the problem. Your job is to turn the given solution into ONE runnable Manim animation that visually explains it to an advanced JEE / Chemistry Olympiad student in an interactive, think-first style. 1. FIDELITY TO THE GIVEN SOLUTION - Follow the official reaction mechanism, arrow-pushing formalism, stereochemical assignments, and kinetic/thermodynamic logic exactly. - Represent every electron-pushing arrow (curved arrow) accurately: arrows must start from a bond or a defined lone pair and point directly to the destination atom or newly forming bond. - Explicitly preserve and visually contrast stereochemical 3D configuration: use wedge/dash representations to show retention (frontside substitution) versus inversion (backside attack with umbrella inversion of substituents). - Every intermediate (chlorosulfite ester, intimate ion pair, pyridinium adduct) and transition state must follow standard IUPAC/Olympiad conventions. 2. INTERACTIVE, THINK-FIRST STYLE (REQUIRED) Make the viewer participate rather than watch: - At least 3 "PAUSE & PREDICT" moments: show a short question in a highlighted box, e.g.: 1. "Does the C–O chiral bond break during the initial esterification with SOCl2?" self.wait(4) -> Reveal: No! Stereocenter remains completely untouched. 2. "In the absence of pyridine, from which face must chloride attack the carbocation?" self.wait(4) -> Reveal: Frontside delivery from the same face via an intimate ion pair (SNi). 3. "What critical role does pyridine play in flipping retention into inversion?" self.wait(4) -> Reveal: Traps HCl and generates free, solvated Cl- for backside SN2 attack. - Progressive disclosure: Build mechanisms step-by-step: (1) Reactants with lone pairs -> (2) Curved electron-pushing arrows appear -> (3) Bonds break and form -> (4) Intermediate / Transition state in brackets [ ]— -> (5) Final products with updated stereochemical labels ((R) vs (S)). - Link mechanism to stereochemistry: When a stereocenter is attacked, visually emphasize the movement of the spectator groups (the "umbrella inversion" for SN2 vs fixed spatial scaffolding for SNi). Use consistent color coding across atoms and arrows: - Carbon skeleton / Chiral carbon: WHITE / GOLD - Oxygen atom & lone pairs: RED - Sulfur atom: YELLOW - Chlorine atom & attacking nucleophile: GREEN - Nitrogen / Pyridine catalyst: BLUE - Electron-pushing curved arrows: TEAL / CYAN - After each major stage: a one-line checkpoint recap. At the end: a summary table contrasting SNi (retention) vs SN2 (inversion) with the final answer box. 3. STRUCTURE A. Title Card: Problem statement and reaction scheme. self.wait(5). FadeOut. B. Setup: Chiral substrate (R)-1-phenylethanol drawn with wedge-and-dash bonds. Persistent reference structure stays on the LEFT (~40% of frame width); the active mechanism & electron pushing occurs on the RIGHT (~60% of frame width). C. Mechanism Walkthrough: - Stage 1: Formation of alkyl chlorosulfite ester (common first step, C–O bond intact). - Stage 2 (Condition I - SNi): Heterolysis to intimate ion pair inside solvent cage, concerted loss of SO2, and frontside Cl delivery -> RETENTION -> (R)-enantiomer. - Stage 3 (Condition II - Pyridine / SN2): Nucleophilic catalysis by pyridine, generation of free uncoordinated Cl-, backside attack -> INVERSION -> (S)-enantiomer. D. Comparative Energy / Stereochemical Summary (The "Aha!" visual). E. Final answer box + takeaway points. Pacing (minimum): wait(2) after each reaction step; wait(3) after each intermediate; wait(4) during prediction prompts; wait(5) on the final summary card. Target total length: 3–4 minutes. Quality over brevity. 4. LAYOUT RULES (THESE PREVENT MOST VISUAL BUGS) - NEVER draw chemical structures by importing external images or using Chemfig/Mhchem. Construct structures purely using native Manim primitives: - Single bonds: Line - Double bonds: pair of parallel Lines - Wedge bonds: filled Polygon (triangle) - Dash bonds: VGroup of 4–5 short parallel Lines with decreasing length - Lone pairs: VGroup of two small Dots adjacent to the atom - Curved electron arrows: CurvedArrow with angle adjusted to clear atom labels - Max 1 major reaction step / transition state on the right side at a time. FadeOut previous step components before bringing in the next intermediate. - Right-side content capped to frame width * 0.55; diagram height capped to frame height * 0.65. - Nothing may leave the frame (14.2 x 8). No text or bond overlaps. 5. TECHNICAL REQUIREMENTS - Manim Community Edition >= 0.18 only. Imports: `from manim import *` and `import numpy as np`. No external packages, no LaTeX chemfig/mhchem plugins. - Exactly ONE class: `class GeneratedScene(Scene)`. Must render with: manim -ql file.py GeneratedScene - Typography: Text(...) for IUPAC names and explanatory prose; MathTex(r"...") for formulas (e.g., MathTex(r"\text{SOCl}_2"), MathTex(r"\text{S}_\text{N}\text{i}")). - Header comment block at top of file: (1) Reaction mechanisms animated, (2) Key stereochemical insights, (3) Segment timestamps, (4) The 3 PAUSE & PREDICT questions. 6. OUTPUT FORMAT Return ONLY one ```python code block containing the complete file. No prose outside it. PROBLEM An optically pure chiral secondary alcohol, (R)-1-phenylethanol, is subjected to two distinct reaction conditions: Condition I: Treated with thionyl chloride (SOCl2) in dry diethyl ether at room temperature to give compound P as the major organic product, alongside evolution of SO2 and HCl. Condition II: Treated with thionyl chloride (SOCl2) in the presence of 1.0 equivalent of pyridine to give compound Q as the major organic product, alongside pyridinium hydrochloride and evolution of SO2. Which of the following statement(s) is(are) correct? (A) Compound P is (R)-1-chloro-1-phenylethane formed via an SNi mechanism with net retention of configuration at the chiral center. (B) In Condition I, the rate-determining step proceeds through an intimate (contact) ion-pair intermediate [R+ || -OSOCl] trapped in a solvent cage. (C) Compound Q is (R)-1-chloro-1-phenylethane formed with net retention of configuration because pyridine acts purely as a spectator base. (D) In Condition II, pyridine acts as a nucleophilic catalyst, displacing chloride to generate free, solvated Cl- ions that carry out backside bimolecular nucleophilic substitution (SN2) with net inversion of configuration to give (S)-1-chloro-1-phenylethane. OFFICIAL SOLUTION MECHANISMS ANIMATED: 1. Chlorosulfite ester formation (shared first step). 2. SNi (Substitution Nucleophilic internal) via an intimate ion pair (Condition I). 3. Nucleophile-catalyzed SN2 displacement via pyridine assistance (Condition II). STAGE 1 — Initial Formation of Alkyl Chlorosulfite (Common to both): - The lone pair of oxygen in (R)-1-phenylethanol attacks the electrophilic sulfur atom of SOCl2. - The S=O pi-bond breaks toward oxygen, then collapses back to eject a chloride ion (addition-elimination). - Loss of a proton (as HCl) yields alkyl chlorosulfite: R-O-S(=O)-Cl. - CRITICAL OBSERVATION: The carbon-oxygen (C–O) bond at the chiral center is NOT broken in this step. The configuration at the chiral carbon remains strictly (R). STAGE 2 — Condition I: The SNi Mechanism (Pure SOCl2 in Ether): - In the absence of a base/nucleophile like pyridine, the chlorosulfite ester undergoes thermal heterolysis: the C–O bond cleaves heterolytically to produce an intimate (contact) ion-pair held within a solvent cage: [ R+ ... -O-S(=O)-Cl ] (intimate ion pair) - Decomposition occurs rapidly inside the solvent cage: As sulfur dioxide (SO2) gas is extruded, the chlorine atom is delivered directly from the SAME FACE where the oxygen leaving group was attached (frontside delivery). - Because the attacking chlorine attacks from the same face as the leaving group: Configuration is RETAINED -> Compound P is (R)-1-chloro-1-phenylethane. => Statement (A) is TRUE. => Statement (B) is TRUE. STAGE 3 — Condition II: The SN2 Mechanism (SOCl2 + Pyridine): - Pyridine is both a tertiary amine base and a potent nucleophilic catalyst. - Pyridine attacks the sulfur atom of the alkyl chlorosulfite intermediate, displacing chloride as a free, well-solvated chloride ion (Cl-) into solution, while forming an activated pyridinium-sulfinyl intermediate [R-O-S(=O)-py]+ Cl-. - In addition, pyridine traps the generated HCl to form insoluble pyridinium hydrochloride. - The high concentration of free, unbonded chloride (Cl-) in solution now acts as an external nucleophile. It attacks the chiral carbon from the OPPOSITE (backside) face to the C–O bond in a classic bimolecular SN2 pathway. - The nucleophilic backside attack simultaneously expels SO2 and regenerates pyridine: Cl- (backside) + C(alpha) -> Umbrella inversion of Ph, H, CH3 -> (S)-product. - Result: Net INVERSION of stereochemical configuration -> Compound Q is (S)-1-chloro-1-phenylethane. => Statement (C) is FALSE (claims retention and spectator role). => Statement (D) is TRUE. FINAL ANSWER: Statements (A), (B), and (D) are TRUE. ```markdown # Manim-Chemistry Animation Reference Guide This document provides a streamlined reference for the high-level classes and methods in Manim-Chemistry. It is optimized for AI-assisted animation generation, focusing exclusively on online data retrieval via PubChem and spatial positioning for visual effects. **IMPORTANT**: For any chemistry animation, ALWAYS prefer using actual molecular structures (MMoleculeObject) over simple text formulas. When showing reaction mechanisms, DRAW THE MOLECULES using `molecule_from_pubchem()` and animate the transformation. This creates much more engaging and educational animations. ## 2D Molecular Visualization The `MMoleculeObject` is the primary class for academic-style 2D molecular structures. It is a `VGroup`, making it compatible with standard Manim animations like `Write`, `FadeIn`, and `Create`. ### MMoleculeObject **Method: `molecule_from_pubchem`** Generates a molecule object directly from the PubChem database using an identifier. ```python # Parameters: # name (str): Common name (e.g., "benzene") # cid (str): PubChem Compound ID # smiles (str): SMILES string # explicit_hydrogens (bool): Whether to render H atoms. Defaults to False. ``` **Example Animation:** ```python from manim import * from manim_chemistry import * class PubChemScene(Scene): def construct(self): # Fetching caffeine by name caffeine = MMoleculeObject.molecule_from_pubchem(name="caffeine") # ALWAYS scale molecules down to valid overlap with text/edges caffeine.scale(0.7) self.play(Write(caffeine)) self.wait() ``` **CRITICAL LAYOUT RULE:** - MObjects from PubChem are often too large. - **ALWAYS** apply `.scale(0.7)` (or smaller) to `MMoleculeObject` immediately after creation. - Check `.get_width()` if unsure. --- ## 3D Molecular Visualization For 3D scenes, the `ThreeDMolecule` class utilizes the OpenGL renderer. Note that `three_d=True` must be passed to the PubChem method to retrieve XYZ coordinates. ### ThreeDMolecule **Method: `molecule_from_pubchem`** Fetches 3D spatial data for rendering. ```python # Usage Example: molecule = ThreeDMolecule.molecule_from_pubchem( name="acetone", three_d=True, ignore_hydrogens=False ) ``` **Example Animation:** ```python class ThreeDScene(Scene): def construct(self): config.renderer = "opengl" molecule = ThreeDMolecule.molecule_from_pubchem(name="ethanol", three_d=True) self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES) self.play(Create(molecule)) self.play(Rotate(molecule, angle=PI, axis=UP)) ``` --- ## Graph-Based Molecules `GraphMolecule` inherits from Manim's `Graph`. This is useful if you want to use graph-theory layout logic or animate the molecule as a network of nodes and edges. ### GraphMolecule **Example Usage:** ```python molecule = GraphMolecule.molecule_from_pubchem(name="aspirin") ``` **Key Feature:** It supports `numeric_label=True` to show atom indices, which is helpful for debugging which index corresponds to which atom during complex animations. --- ## Bohr Atomic Models For visualizations focusing on subatomic particles rather than molecular structures, the `BohrAtom` class provides a classic planetary model. ### BohrAtom **Parameters:** - `e` (int): Number of electrons. - `p` (int): Number of protons. - `n` (int): Number of neutrons. - `electron_color`, `proton_color`, `neutron_color`: Styling options. **Example Animation:** ```python class AtomScene(Scene): def construct(self): atom = BohrAtom(e=6, p=6, n=6) # Carbon self.add(atom) self.play(Indicate(atom.electrons)) # Electrons is a subgroup ``` --- ## Spatial Positioning & Animation Helpers To create professional animations (like arrows pointing to specific atoms), you must be able to find coordinates within the molecule. Both `MMoleculeObject` and `GraphMolecule` provide these helpers. ### Positioning Methods - **`find_atom_position_by_index(index)`**: Returns the `[x, y, z]` numpy array for a specific atom. - **`find_bond_center_by_index(index)`**: Returns the center point of a specific bond. - **`find_position_along_bond_axis(bond_index, position_buff)`**: - `0` is the center. - `1` and `-1` are the ends of the bond. - Useful for placing "reaction" labels between two atoms. **Example: Highlighting an Atom** ```python class HighlightAtom(Scene): def construct(self): mol = MMoleculeObject.molecule_from_pubchem(name="methane") self.add(mol) # Find position of the first atom (Carbon) c_pos = mol.find_atom_position_by_index(1) # Create an arrow pointing to it arrow = Arrow(start=UP, end=c_pos, color=YELLOW) self.play(Create(arrow)) ``` --- ## Core Data Properties When iterating through a molecule to apply custom logic, the library uses `MCAtom` and `MCBond` abstractions. ### MCAtom Properties - `atom.element`: Access element data like `symbol` or `atomic_number`. - `atom.coords`: The raw position array. ### MCBond Properties - `bond.bond_type`: Integer (1 for single, 2 for double, 3 for triple). - `bond.from_atom` / `bond.to_atom`: References to the connected `MCAtom` objects. ### MCElement Properties - `element.symbol`: e.g., "C", "O", "H". - `element.name`: e.g., "Carbon". - `element.color`: The default hex color associated with the element. ``` ```

Drag to resize

Response not available

Drag to resize

Response not available

Drag to resize
Drag to resize
Drag to resize