원클릭으로
molecular-orbital-analysis
Complete workflow for molecular orbital analysis using PySCF, Multiwfn, and PyMOL
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Complete workflow for molecular orbital analysis using PySCF, Multiwfn, and PyMOL
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
PySCF (Python-based Simulations of Chemistry Framework) — modular pure-Python quantum chemistry library. Supports HF, DFT, MP2, CCSD, CCSD(T), CASSCF, TDDFT, geometry optimization, PES scanning, and spectroscopy. Based on pyscf.org documentation.
Gaussian 16 quantum chemistry software. Electronic structure calculations, geometry optimization, frequency analysis, TDDFT excited states, and more. Based on official Gaussian.com documentation.
RDKit molecular analysis and visualization. Use for molecular conformer generation, force field optimization, charge calculation, molecular descriptors, and non-covalent interaction analysis.
Run xTB (GFN-FF / GFN2-xTB) molecular dynamics for organic molecular clusters (e.g., anthracene/benzene), starting from random packed geometries; then generate animated GIFs (full trajectory, COM view, local clustered subset, bond-emphasized). Use when asked to simulate many-molecule stacking/aggregation dynamics, low-temperature “freezing/condensation” behavior, or to visualize xTB MD trajectories as animations.
Publication-quality molecular graphics. Render molecular structures as SVG, PNG, PDF, and animated GIF from XYZ, mol/SDF, MOL2, PDB, SMILES, CIF, cube files, or quantum chemistry output.
Sample monomers and multi-molecule complexes from Gaussian ONIOM or XYZ files. Extract all monomers, then sample dimers/trimers/tetramers/pentamers using distance-sorted nearest neighbors.
| name | molecular-orbital-analysis |
| version | 1.0.0 |
| description | Complete workflow for molecular orbital analysis using PySCF, Multiwfn, and PyMOL |
| homepage | https://github.com/STOKES-DOT |
| metadata | {"category":"quantum-chemistry","tools":["pyscf","multiwfn","pymol"],"requirements":["PySCF (quantum chemistry)","Multiwfn (wavefunction analysis)","PyMOL (molecular visualization)"]} |
This skill provides a complete workflow for analyzing molecular orbitals using quantum chemistry calculations and visualization.
The workflow consists of three main steps:
# Python packages
pip install pyscf numpy matplotlib
# Multiwfn (via Homebrew)
brew tap digital-chemistry-laboratory/multiwfn
brew install --HEAD digital-chemistry-laboratory/multiwfn/multiwfn
# PyMOL
brew install pymol
# Add to ~/.zshrc or ~/.bashrc
export OMP_STACKSIZE=64000000
Create an XYZ file with molecular coordinates:
<n_atoms>
<molecule_name>
<element> <x> <y> <z>
...
Example - Water:
3
Water molecule
O 0.000000 0.000000 0.117489
H 0.000000 0.757210 -0.469957
H 0.000000 -0.757210 -0.469957
Use the template script:
#!/usr/bin/env python3
from pyscf import gto, scf
from pyscf.tools import molden
# Create molecule
mol = gto.M(
atom='<xyz_coordinates_or_file>',
basis='6-31G*', # or 'cc-pVDZ', 'def2-TZVP', etc.
charge=0,
spin=0, # 0 for closed-shell
verbose=3
)
# Perform calculation
mf = scf.RHF(mol) # or RKS for DFT
mf.kernel()
# Output results
print(f"Total energy: {mf.e_tot:.8f} Hartree")
nocc = mol.nelectron // 2
print(f"HOMO energy: {mf.mo_energy[nocc-1]*27.2114:.3f} eV")
print(f"LUMO energy: {mf.mo_energy[nocc]*27.2114:.3f} eV")
# Generate molden file
molden.from_mo(mol, 'molecule.molden', mf.mo_coeff)
Create input file for Multiwfn:
cat > multiwfn_input.txt << 'EOF'
molecule.molden
200
3
<orbital_index>
2
1
0
q
EOF
OMP_STACKSIZE=64000000 multiwfn < multiwfn_input.txt
Finding orbital indices:
nelectron // 2Output: orb<index>.cub file containing 3D orbital data
Create PyMOL script:
import pymol
from pymol import cmd
pymol.finish_launching(['pymol', '-cq'])
# Load molecule
cmd.load('molecule.xyz', 'mol')
cmd.show('spheres', 'mol')
cmd.show('sticks', 'mol')
cmd.color('red', 'elem O')
cmd.color('white', 'elem H')
cmd.set('sphere_scale', 0.3)
# Load orbital
cmd.load('orbital.cub', 'orbital')
cmd.isosurface('surf_pos', 'orbital', level=0.05)
cmd.isosurface('surf_neg', 'orbital', level=-0.05)
cmd.color('blue', 'surf_pos')
cmd.color('red', 'surf_neg')
cmd.set('transparency', 0.4, 'surf_pos')
cmd.set('transparency', 0.4, 'surf_neg')
# Render
cmd.bg_color('white')
cmd.zoom(complete=1)
cmd.png('orbital.png', width=1400, height=1050, dpi=150, ray=1)
cmd.quit()
Use this complete automation script:
#!/usr/bin/env python3
"""
Complete molecular orbital analysis pipeline
Usage: python analyze_molecule.py molecule.xyz
"""
import sys
import subprocess
from pathlib import Path
from pyscf import gto, scf
from pyscf.tools import molden
import pymol
from pymol import cmd
def analyze_molecule(xyz_file, basis='6-31G*', homo_only=False):
"""Complete molecular orbital analysis"""
# Step 1: Quantum chemistry calculation
print("=" * 60)
print("Step 1: Quantum Chemistry Calculation")
print("=" * 60)
mol = gto.M(atom=xyz_file, basis=basis, charge=0, spin=0, verbose=3)
mf = scf.RHF(mol)
mf.kernel()
# Generate molden file
molden_file = Path(xyz_file).stem + '.molden'
molden.from_mo(mol, molden_file, mf.mo_coeff)
# Step 2: Generate cube files with Multiwfn
print("\n" + "=" * 60)
print("Step 2: Generating Orbital Data")
print("=" * 60)
nocc = mol.nelectron // 2
orbitals = [nocc, nocc+1] if not homo_only else [nocc]
for orb_idx in orbitals:
print(f"Generating cube file for orbital {orb_idx}...")
# Multiwfn input
# ... (automation code)
# Step 3: Visualization with PyMOL
print("\n" + "=" * 60)
print("Step 3: Visualization")
print("=" * 60)
# PyMOL visualization code
# ... (automation code)
print("\n✅ Analysis complete!")
if __name__ == '__main__':
if len(sys.argv) < 2:
print("Usage: python analyze_molecule.py molecule.xyz")
sys.exit(1)
analyze_molecule(sys.argv[1])
Colors:
Zoom level:
cmd.zoom(complete=1): Fit entire moleculecmd.move('z', -5): Zoom incmd.move('z', 5): Zoom outTypical output structure:
<molecule>/
├── molecule.xyz # Input structure
├── molecule.molden # Wavefunction file
├── molecule_HOMO.cub # HOMO 3D data
├── molecule_LUMO.cub # LUMO 3D data
├── molecule_homo.png # HOMO visualization
└── molecule_lumo.png # LUMO visualization
ray=0 instead of ray=1If using this workflow for publications, cite:
PySCF: Q. Sun et al., PySCF: the Python‐based simulations of chemistry framework, Wiley Interdiscip. Rev. Comput. Mol. Sci. 8, e1340 (2018)
Multiwfn: T. Lu, F. Chen, J. Comput. Chem. 33, 580 (2012) and T. Lu, J. Chem. Phys. 161, 082503 (2024)
PyMOL: The PyMOL Molecular Graphics System, Version 3.1 Schrödinger, LLC.