molbuilder 1.0.0__py3-none-any.whl → 1.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- molbuilder/__init__.py +1 -1
- molbuilder/cli/demos.py +73 -1
- molbuilder/cli/menu.py +2 -0
- molbuilder/dynamics/__init__.py +49 -0
- molbuilder/dynamics/forcefield.py +607 -0
- molbuilder/dynamics/integrator.py +275 -0
- molbuilder/dynamics/mechanism_choreography.py +216 -0
- molbuilder/dynamics/mechanisms.py +552 -0
- molbuilder/dynamics/simulation.py +209 -0
- molbuilder/dynamics/trajectory.py +215 -0
- molbuilder/gui/app.py +114 -0
- molbuilder/visualization/__init__.py +2 -1
- molbuilder/visualization/electron_density_viz.py +246 -0
- molbuilder/visualization/interaction_controls.py +211 -0
- molbuilder/visualization/interaction_viz.py +615 -0
- molbuilder/visualization/theme.py +7 -0
- {molbuilder-1.0.0.dist-info → molbuilder-1.1.0.dist-info}/METADATA +1 -1
- {molbuilder-1.0.0.dist-info → molbuilder-1.1.0.dist-info}/RECORD +22 -12
- {molbuilder-1.0.0.dist-info → molbuilder-1.1.0.dist-info}/WHEEL +0 -0
- {molbuilder-1.0.0.dist-info → molbuilder-1.1.0.dist-info}/entry_points.txt +0 -0
- {molbuilder-1.0.0.dist-info → molbuilder-1.1.0.dist-info}/licenses/LICENSE +0 -0
- {molbuilder-1.0.0.dist-info → molbuilder-1.1.0.dist-info}/top_level.txt +0 -0
molbuilder/__init__.py
CHANGED
molbuilder/cli/demos.py
CHANGED
|
@@ -465,7 +465,7 @@ def demo_visualization():
|
|
|
465
465
|
print(f" Rendering gallery of {len(mols)} molecules...")
|
|
466
466
|
visualize_gallery(mols)
|
|
467
467
|
else:
|
|
468
|
-
print(" Skipped.")
|
|
468
|
+
print(" Skipped visualization.")
|
|
469
469
|
print()
|
|
470
470
|
|
|
471
471
|
|
|
@@ -514,3 +514,75 @@ def demo_quantum_visualization():
|
|
|
514
514
|
else:
|
|
515
515
|
print(" Skipped.")
|
|
516
516
|
print()
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
def demo_slowmo_interaction():
|
|
520
|
+
"""Extreme slow-motion atomic interaction visualization."""
|
|
521
|
+
try:
|
|
522
|
+
import matplotlib
|
|
523
|
+
except ImportError:
|
|
524
|
+
print(" matplotlib is not installed. Skipping visualization.")
|
|
525
|
+
return
|
|
526
|
+
|
|
527
|
+
print("=" * 60)
|
|
528
|
+
print(" EXTREME SLOW-MOTION ATOMIC INTERACTIONS")
|
|
529
|
+
print("=" * 60)
|
|
530
|
+
print()
|
|
531
|
+
|
|
532
|
+
print(" This demo visualizes atomic interactions at sub-femtosecond")
|
|
533
|
+
print(" time resolution using molecular dynamics simulation.")
|
|
534
|
+
print()
|
|
535
|
+
|
|
536
|
+
choice = input(
|
|
537
|
+
" Show: [1] Ethane MD vibration [2] SN2 mechanism\n"
|
|
538
|
+
" [3] Bond formation [4] Skip: ").strip()
|
|
539
|
+
|
|
540
|
+
if choice == "1":
|
|
541
|
+
from molbuilder.molecule.builders import build_ethane
|
|
542
|
+
from molbuilder.visualization.interaction_viz import (
|
|
543
|
+
visualize_md_trajectory, PlaybackConfig,
|
|
544
|
+
)
|
|
545
|
+
print(" Building ethane and running MD at 300 K...")
|
|
546
|
+
mol = build_ethane(60.0)
|
|
547
|
+
config = PlaybackConfig(
|
|
548
|
+
show_electron_density=False,
|
|
549
|
+
slowmo_factor=1e15,
|
|
550
|
+
)
|
|
551
|
+
visualize_md_trajectory(mol, n_steps=500, config=config)
|
|
552
|
+
|
|
553
|
+
elif choice == "2":
|
|
554
|
+
from molbuilder.molecule.builders import build_ethane
|
|
555
|
+
from molbuilder.dynamics.mechanisms import sn2_mechanism
|
|
556
|
+
from molbuilder.visualization.interaction_viz import (
|
|
557
|
+
visualize_reaction, PlaybackConfig,
|
|
558
|
+
)
|
|
559
|
+
print(" Setting up SN2 mechanism demonstration...")
|
|
560
|
+
mol = build_ethane(60.0)
|
|
561
|
+
mechanism = sn2_mechanism(
|
|
562
|
+
substrate_C=0, nucleophile=1, leaving_group=2)
|
|
563
|
+
config = PlaybackConfig(
|
|
564
|
+
show_electron_density=True,
|
|
565
|
+
show_electron_flows=True,
|
|
566
|
+
)
|
|
567
|
+
visualize_reaction(
|
|
568
|
+
mol, mechanism,
|
|
569
|
+
n_steps_per_stage=150, config=config)
|
|
570
|
+
|
|
571
|
+
elif choice == "3":
|
|
572
|
+
from molbuilder.molecule.graph import Molecule, Hybridization
|
|
573
|
+
from molbuilder.visualization.interaction_viz import (
|
|
574
|
+
visualize_bond_formation, PlaybackConfig,
|
|
575
|
+
)
|
|
576
|
+
print(" Setting up bond formation between two carbon atoms...")
|
|
577
|
+
mol = Molecule("C...C bond formation")
|
|
578
|
+
c0 = mol.add_atom("C", [0.0, 0.0, 0.0], Hybridization.SP3)
|
|
579
|
+
c1 = mol.add_atom("C", [3.0, 0.0, 0.0], Hybridization.SP3)
|
|
580
|
+
config = PlaybackConfig(
|
|
581
|
+
show_electron_density=True,
|
|
582
|
+
show_electron_flows=True,
|
|
583
|
+
)
|
|
584
|
+
visualize_bond_formation(mol, c0, c1, config=config)
|
|
585
|
+
|
|
586
|
+
else:
|
|
587
|
+
print(" Skipped.")
|
|
588
|
+
print()
|
molbuilder/cli/menu.py
CHANGED
|
@@ -19,6 +19,7 @@ from molbuilder.cli.demos import (
|
|
|
19
19
|
demo_amino_acids,
|
|
20
20
|
demo_visualization,
|
|
21
21
|
demo_quantum_visualization,
|
|
22
|
+
demo_slowmo_interaction,
|
|
22
23
|
)
|
|
23
24
|
from molbuilder.cli.wizard import wizard_main
|
|
24
25
|
|
|
@@ -38,6 +39,7 @@ DEMOS = [
|
|
|
38
39
|
("Amino Acids & Functional Groups", demo_amino_acids),
|
|
39
40
|
("3D Molecule Visualization", demo_visualization),
|
|
40
41
|
("Quantum Orbital Visualization", demo_quantum_visualization),
|
|
42
|
+
("Slow-Motion Atomic Interactions", demo_slowmo_interaction),
|
|
41
43
|
("Molecule Builder Wizard", wizard_main),
|
|
42
44
|
]
|
|
43
45
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Molecular dynamics engine for atomic interaction visualization.
|
|
2
|
+
|
|
3
|
+
Provides a force field, Velocity Verlet integrator, trajectory storage
|
|
4
|
+
with sub-femtosecond interpolation, reaction mechanism templates, and
|
|
5
|
+
steered-MD choreography for animating bond formation/breaking events.
|
|
6
|
+
|
|
7
|
+
Public API
|
|
8
|
+
----------
|
|
9
|
+
ForceField, ForceFieldParams, ForceResult
|
|
10
|
+
Vectorized force computation (LJ + Coulomb + harmonic bond/angle +
|
|
11
|
+
OPLS-AA torsion).
|
|
12
|
+
|
|
13
|
+
VelocityVerletIntegrator, IntegratorState, BerendsenThermostat
|
|
14
|
+
Symplectic integration and temperature control.
|
|
15
|
+
|
|
16
|
+
Trajectory, TrajectoryFrame
|
|
17
|
+
Frame storage with CubicSpline interpolation for sub-fs resolution.
|
|
18
|
+
|
|
19
|
+
MDSimulation
|
|
20
|
+
High-level orchestrator: build from a ``Molecule``, run plain or
|
|
21
|
+
steered MD, and record trajectories.
|
|
22
|
+
|
|
23
|
+
MechanismType, ReactionMechanism, MechanismStage, ElectronFlow
|
|
24
|
+
Reaction mechanism data model and predefined templates.
|
|
25
|
+
|
|
26
|
+
MechanismChoreographer
|
|
27
|
+
Converts mechanism stages into time-varying restraint forces.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
from molbuilder.dynamics.forcefield import ForceField, ForceFieldParams, ForceResult
|
|
31
|
+
from molbuilder.dynamics.integrator import (
|
|
32
|
+
VelocityVerletIntegrator,
|
|
33
|
+
IntegratorState,
|
|
34
|
+
BerendsenThermostat,
|
|
35
|
+
)
|
|
36
|
+
from molbuilder.dynamics.trajectory import Trajectory, TrajectoryFrame
|
|
37
|
+
from molbuilder.dynamics.simulation import MDSimulation
|
|
38
|
+
from molbuilder.dynamics.mechanisms import (
|
|
39
|
+
MechanismType,
|
|
40
|
+
ReactionMechanism,
|
|
41
|
+
MechanismStage,
|
|
42
|
+
ElectronFlow,
|
|
43
|
+
FlowType,
|
|
44
|
+
sn2_mechanism,
|
|
45
|
+
e2_mechanism,
|
|
46
|
+
radical_substitution_mechanism,
|
|
47
|
+
nucleophilic_addition_mechanism,
|
|
48
|
+
)
|
|
49
|
+
from molbuilder.dynamics.mechanism_choreography import MechanismChoreographer
|