一键导入
computational-physics-guide
Computational physics methods, simulations, and research tools
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Computational physics methods, simulations, and research tools
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Route empirical-research requests through the Auto-Empirical Research Skills catalog when this whole repository is installed as one skill in Codex, CodeBuddy, Claude Code, or another IDE. Use to choose and load the right vendored AERS skill for causal inference, econometrics, replication, data acquisition, manuscript writing, peer review and referee responses, citation checking, de-AIGC editing, or full empirical-paper workflows without reading the entire repository at once.
公司金融实证研究的"漏斗式选题查找器"。互动开场先后询问 (1) 研究方向、(2) 候选标题数量 N, 再扫描全球文献(已出版英文学术期刊 + SSRN working paper + 全球高校 department seminar 1 年内日程),基于 Edmans (2024) "1000 Rejections" 红线生成 N 个候选标题,**通过并行 subagent(Agent 工具)批量生成计划书 + 查新;每个 subagent 必须强制调用 Skill 工具加载 econfin-proposal 与 novelty-check 两个预设 skill 完成各自模块**,**只有当 novelty score >= 9 时(即 JF/JFE/RFS 顶刊层次),subagent 才把 proposal + 查新报告合并的 md 写入 F:\Dropbox\CC\选题大全\<研究方向短名>\(以"简短选题名称-分数"命名,子文件夹名由 Step 0 从用户输入的研究方向派生);< 9 分的选题在 subagent 内部直接丢弃,绝不写盘、绝不输出**。当用户说"找选题"、"帮我找选题"、"想做 X 方向"、 "empirical CF idea search"、"批量生成研究计划书"、"100 ideas"、"econfin-idea-finder" 时触发。
Create and compile beautiful Beamer presentations following the Rhetoric of Decks philosophy. Use when making slides, creating decks, or compiling .tex presentation files.
Scaffold a new research project with standard directory structure, CLAUDE.md template, and documented README. Use this at the start of every new project to ensure consistent organization.
Download, split, and deeply read academic PDFs. Use when asked to read, review, or summarize an academic paper. Splits PDFs into 4-page chunks, reads them in small batches, and produces structured reading notes — avoiding context window crashes and shallow comprehension.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
| name | computational-physics-guide |
| description | Computational physics methods, simulations, and research tools |
| metadata | {"openclaw":{"emoji":"⚛️","category":"domains","subcategory":"physics","keywords":["computational physics","quantum mechanics","statistical physics","condensed matter"],"source":"wentor-research-plugins"}} |
Apply computational methods to physics research, including molecular dynamics, Monte Carlo simulations, quantum computing, and numerical methods for solving physical systems.
| Method | Application | Scale | Key Software |
|---|---|---|---|
| Molecular Dynamics (MD) | Atomic-scale dynamics, materials | Atoms-molecules | LAMMPS, GROMACS, NAMD |
| Density Functional Theory (DFT) | Electronic structure, quantum chemistry | Electrons | VASP, Gaussian, Quantum ESPRESSO |
| Monte Carlo (MC) | Statistical mechanics, phase transitions | Configurable | Custom, CASINO |
| Finite Element Method (FEM) | Continuum mechanics, electrostatics | Macroscopic | COMSOL, FEniCS, Abaqus |
| Finite Difference (FDTD) | Electrodynamics, wave propagation | Macroscopic | Meep, Lumerical |
| N-body Simulation | Gravitational dynamics, plasma | Stars/particles | GADGET, REBOUND |
| Lattice QCD | Quantum chromodynamics | Subatomic | MILC, openQCD |
import numpy as np
def lennard_jones(r, epsilon=1.0, sigma=1.0):
"""Lennard-Jones potential and force."""
r6 = (sigma / r) ** 6
r12 = r6 ** 2
potential = 4 * epsilon * (r12 - r6)
force = 24 * epsilon * (2 * r12 - r6) / r
return potential, force
def velocity_verlet(positions, velocities, forces, masses, dt):
"""Velocity Verlet integration step."""
# Half-step velocity update
velocities += 0.5 * forces / masses * dt
# Full-step position update
positions += velocities * dt
# Compute new forces
new_forces = compute_forces(positions)
# Complete velocity update
velocities += 0.5 * new_forces / masses * dt
return positions, velocities, new_forces
def md_simulation(n_atoms, n_steps, dt=0.001, temperature=1.0):
"""Simple NVE molecular dynamics simulation."""
# Initialize positions on a grid
positions = initialize_fcc_lattice(n_atoms, box_size=10.0)
velocities = np.random.randn(n_atoms, 3) * np.sqrt(temperature)
velocities -= velocities.mean(axis=0) # Remove center of mass motion
forces = compute_forces(positions)
trajectory = []
for step in range(n_steps):
positions, velocities, forces = velocity_verlet(
positions, velocities, forces,
masses=np.ones(n_atoms), dt=dt
)
if step % 100 == 0:
ke = 0.5 * np.sum(velocities**2)
pe = compute_potential_energy(positions)
print(f"Step {step}: KE={ke:.4f}, PE={pe:.4f}, Total={ke+pe:.4f}")
trajectory.append(positions.copy())
return trajectory
# LAMMPS input: Lennard-Jones fluid simulation
units lj
atom_style atomic
boundary p p p
# Create simulation box and atoms
lattice fcc 0.8442
region box block 0 10 0 10 0 10
create_box 1 box
create_atoms 1 box
# Set mass and interactions
mass 1 1.0
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5
# Initialize velocities at T=1.0
velocity all create 1.0 87287 dist gaussian
# Thermostat: Nose-Hoover NVT
fix 1 all nvt temp 1.0 1.0 0.1
# Output settings
thermo 100
thermo_style custom step temp pe ke etotal press
dump 1 all custom 1000 trajectory.lammpstrj id x y z vx vy vz
# Run simulation
timestep 0.005
run 100000
import numpy as np
def ising_monte_carlo(L, temperature, n_steps):
"""2D Ising model simulation using Metropolis algorithm."""
# Initialize random spin configuration
spins = np.random.choice([-1, 1], size=(L, L))
beta = 1.0 / temperature
energies = []
magnetizations = []
for step in range(n_steps):
for _ in range(L * L): # One sweep = L^2 single spin flips
# Choose random spin
i, j = np.random.randint(0, L, size=2)
# Calculate energy change for flipping spin (i,j)
neighbors = (
spins[(i+1)%L, j] + spins[(i-1)%L, j] +
spins[i, (j+1)%L] + spins[i, (j-1)%L]
)
delta_E = 2 * spins[i, j] * neighbors
# Metropolis acceptance criterion
if delta_E <= 0 or np.random.random() < np.exp(-beta * delta_E):
spins[i, j] *= -1
# Measure observables
if step % 10 == 0:
E = -np.sum(spins * (np.roll(spins, 1, 0) + np.roll(spins, 1, 1)))
M = np.abs(np.sum(spins))
energies.append(E / L**2)
magnetizations.append(M / L**2)
return energies, magnetizations
# Run near the critical temperature (T_c ≈ 2.269 for 2D Ising)
E, M = ising_monte_carlo(L=32, temperature=2.269, n_steps=10000)
print(f"Mean energy: {np.mean(E[-100:]):.4f}")
print(f"Mean magnetization: {np.mean(M[-100:]):.4f}")
# Step 1: Self-consistent field (SCF) calculation
cat > si_scf.in << 'EOF'
&CONTROL
calculation = 'scf'
prefix = 'silicon'
outdir = './tmp/'
pseudo_dir = './pseudo/'
/
&SYSTEM
ibrav = 2
celldm(1) = 10.26 ! Lattice constant in Bohr
nat = 2
ntyp = 1
ecutwfc = 30.0 ! Kinetic energy cutoff (Ry)
ecutrho = 300.0 ! Charge density cutoff (Ry)
/
&ELECTRONS
conv_thr = 1.0d-8
/
ATOMIC_SPECIES
Si 28.086 Si.pbe-n-rrkjus_psl.1.0.0.UPF
ATOMIC_POSITIONS crystal
Si 0.00 0.00 0.00
Si 0.25 0.25 0.25
K_POINTS automatic
8 8 8 0 0 0
EOF
pw.x < si_scf.in > si_scf.out
# Step 2: Band structure calculation
# (requires nscf + bands post-processing)
from ase.build import bulk
from gpaw import GPAW, PW
# Create silicon crystal structure
si = bulk('Si', 'diamond', a=5.43)
# DFT calculation with GPAW
calc = GPAW(mode=PW(300), # Plane-wave cutoff: 300 eV
kpts=(8, 8, 8), # k-point mesh
xc='PBE', # Exchange-correlation functional
txt='si_gpaw.txt') # Output file
si.calc = calc
energy = si.get_potential_energy()
print(f"Total energy: {energy:.4f} eV")
print(f"Energy per atom: {energy/len(si):.4f} eV")
# Equation of state (find equilibrium lattice constant)
from ase.eos import EquationOfState
volumes, energies = [], []
for a in np.linspace(5.3, 5.6, 10):
si = bulk('Si', 'diamond', a=a)
si.calc = GPAW(mode=PW(300), kpts=(8,8,8), xc='PBE', txt=None)
volumes.append(si.get_volume())
energies.append(si.get_potential_energy())
eos = EquationOfState(volumes, energies)
v0, e0, B = eos.fit()
print(f"Equilibrium volume: {v0:.2f} A^3, Bulk modulus: {B:.1f} GPa")
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
# Example: Damped harmonic oscillator
# m*x'' + gamma*x' + k*x = 0
def damped_oscillator(t, y, gamma=0.1, omega0=1.0):
x, v = y
dxdt = v
dvdt = -2*gamma*v - omega0**2 * x
return [dxdt, dvdt]
sol = solve_ivp(damped_oscillator, [0, 50], [1.0, 0.0],
t_eval=np.linspace(0, 50, 1000),
method='RK45', rtol=1e-10)
plt.plot(sol.t, sol.y[0])
plt.xlabel('Time')
plt.ylabel('Displacement')
plt.title('Damped Harmonic Oscillator')
plt.savefig('oscillator.pdf', dpi=300)
# 2D Heat equation: du/dt = alpha * (d2u/dx2 + d2u/dy2)
def heat_equation_2d(Nx, Ny, Nt, alpha=0.01, dt=0.001):
dx = dy = 1.0 / max(Nx, Ny)
u = np.zeros((Nx, Ny))
u[Nx//4:3*Nx//4, Ny//4:3*Ny//4] = 1.0 # Initial hot region
for t in range(Nt):
u_new = u.copy()
u_new[1:-1, 1:-1] = u[1:-1, 1:-1] + alpha * dt / dx**2 * (
u[2:, 1:-1] + u[:-2, 1:-1] + u[1:-1, 2:] + u[1:-1, :-2]
- 4 * u[1:-1, 1:-1]
)
u = u_new
return u
| Approach | Tool | Best For |
|---|---|---|
| Shared memory (threads) | OpenMP | Multi-core CPU parallelism |
| Distributed memory (MPI) | mpi4py, MPI | Multi-node cluster computing |
| GPU computing | CUDA, CuPy, JAX | Massively parallel computations |
| Workflow management | Snakemake, Nextflow | Complex simulation pipelines |
| Job scheduling | SLURM, PBS | HPC cluster job submission |
| Resource | Description |
|---|---|
| arXiv cond-mat | Condensed matter preprints |
| arXiv hep-lat | Lattice field theory preprints |
| Journal of Computational Physics | Top computational physics journal |
| Physical Review E | Statistical, nonlinear, soft matter |
| Computer Physics Communications | Methods + software papers |
| NIST databases | Physical constants, atomic data |