Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

ase

Agent Skill

ase 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

599

周安装

24

GitHub Stars

9

下载量

194
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:ase(酶)
来源仓库:https://github.com/tondevrel/scientific-agent-skills
仓库路径:skills/ase
安装命令:
npx skills add https://github.com/tondevrel/scientific-agent-skills --skill ase
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/tondevrel/scientific-agent-skills --skill ase

简介

ase 是原子模拟环境工具包,用于构建与运行分子、晶体及纳米结构的计算任务。

  • 它支持几何优化、分子动力学与过渡态搜索,提供统一接口对接外部计算引擎。
  • 适用于材料科学、化学与物理研究,需配置 Atoms 对象与 Calculator。
  • 安装来自 GitHub,注意 Python 环境与依赖库,避免版本冲突。
  • ase 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

ASE - Atomic Simulation Environment

ASE is built around the Atoms object, which represents a collection of atoms with positions, atomic numbers, and a unit cell. It provides a common interface for interacting with various "Calculators" (external codes that compute energies and forces).

When to Use

  • Building complex atomic structures: molecules, crystals, surfaces, and nanoparticles.
  • Running geometry optimizations (finding the minimum energy structure).
  • Performing Molecular Dynamics (MD) simulations in various ensembles.
  • Calculating Potential Energy Surfaces (PES) and transition states (NEB method).
  • Converting between atomic file formats (CIF, XYZ, POSCAR, PDB, etc.).
  • Calculating electronic properties like Density of States (DOS) and Band Structures.
  • Automating simulation workflows involving multiple software packages.

Reference Documentation

Official docs: https://wiki.fysik.dtu.dk/ase/ List of Calculators: https://wiki.fysik.dtu.dk/ase/ase/calculators/calculators.html Search patterns: ase.Atoms, ase.build, ase.optimize, ase.io.read, ase.calculators

Core Principles

The Atoms Object

The heart of ASE. It stores:

  • positions: Cartesian coordinates in Angstroms (Nx3 array).
  • symbols: Chemical elements (e.g., 'H', 'Fe').
  • cell: Unit cell vectors (3x3 matrix or 3/6 lengths/angles).
  • pbc: Periodic Boundary Conditions (boolean for each axis).

Calculators

ASE does not calculate energy itself. You attach a Calculator (e.g., GPAW, VASP, EMT, Lennard-Jones) to the Atoms object. When you call atoms.get_potential_energy(), ASE asks the calculator to perform the computation.

Units

Crucial Rule: ASE uses eV (electron-volts) for energy and Angstroms for distance. Time is in ASE units (often converted to fs).

Quick Reference

Installation

pip install ase

Standard Imports

from ase import Atoms
from ase.build import molecule, bulk, surface
from ase.io import read, write
from ase.optimize import BFGS
from ase.visualize import view

Basic Pattern - Creating and Optimizing a Molecule

from ase.build import molecule
from ase.optimize import BFGS
from ase.calculators.emt import EMT # Simple effective medium theory calculator

# 1. Build structure
atoms = molecule('H2O')

# 2. Attach a calculator
atoms.calc = EMT()

# 3. Optimize geometry
opt = BFGS(atoms, trajectory='opt.traj')
opt.run(fmax=0.05) # Converge until forces are < 0.05 eV/Ang

print(f"Final Energy: {atoms.get_potential_energy():.3f} eV")

Critical Rules

✅ DO

  • Specify Periodic Boundary Conditions - Set pbc=[True, True, True] for crystals and False for isolated molecules.
  • Use Vectorized NumPy access - Manipulate atoms.positions or atoms.get_positions() directly with NumPy.
  • Check convergence - Always verify that your optimizer reached the desired fmax.
  • Set the unit cell correctly - For periodic systems, the cell must be large enough to prevent self-interaction.
  • Use ase.build - Leverage built-in functions for complex tasks like creating slabs (surface) or nanotubes.
  • Monitor trajectories - Use .traj files to inspect the optimization or MD progress in ASE-GUI.

❌ DON'T

  • Manually loop over atoms - Avoid Python loops for moving atoms; use atoms.positions += displacement.
  • Forget ASE units - Don't mix kcal/mol or Hartrees without explicit conversion (from ase.units import Hartree, kcal, mol).
  • Assume vacuum is infinite - For non-periodic directions in a slab, ensure enough vacuum padding (e.g., 10-15 Å).
  • Hardcode atomic numbers - Use chemical symbols ('Au') instead of 79 for readability.

Anti-Patterns (NEVER)

# ❌ BAD: Moving atoms in a Python loop
for atom in atoms:
    atom.position += [0.1, 0, 0]

# ✅ GOOD: Vectorized movement
atoms.positions += [0.1, 0, 0]

# ❌ BAD: Not defining a cell for a "bulk" system
iron = Atoms('Fe', positions=[[0, 0, 0]]) # No cell = not a crystal!

# ✅ GOOD: Use the bulk constructor
from ase.build import bulk
iron = bulk('Fe', 'bcc', a=2.87)

# ❌ BAD: Ignoring forces after optimization
energy = atoms.get_potential_energy() # Optimization might have failed!

# ✅ GOOD: Check forces
forces = atoms.get_forces()
max_force = (forces**2).sum(axis=1).max()**0.5
if max_force > 0.05:
    print("Warning: Structure not converged!")

Building Structures (ase.build)

Molecules, Crystals, and Surfaces

from ase.build import molecule, bulk, surface, add_adsorbate

# Molecule from database
h2o = molecule('H2O')

# Bulk crystal (Copper fcc)
cu = bulk('Cu', 'fcc', a=3.6)

# Surface slab (Al 111 surface, 3 layers)
slab = surface('Al', (1, 1, 1), layers=3)
slab.center(vacuum=10, axis=2) # Add 10A vacuum on Z axis

# Adding an adsorbate (CO on a surface)
co = molecule('CO')
add_adsorbate(slab, co, height=2.0, position='ontop')

Optimization and Dynamics (ase.optimize, ase.md)

Geometry Minimization

from ase.optimize import QuasiNewton

# BFGS, LBFGS, GPMin, QuasiNewton are common choices
opt = QuasiNewton(atoms, trajectory='relax.traj', logfile='relax.log')
opt.run(fmax=0.01)

Molecular Dynamics

from ase.md.langevin import Langevin
from ase import units

# MD at 300K with Langevin thermostat
dyn = Langevin(atoms,
               timestep=1.0 * units.fs,
               temperature_K=300,
               friction=0.01)

# Run for 1000 steps
dyn.run(1000)

File I/O (ase.io)

Reading and Writing

from ase.io import read, write

# Read from XYZ or CIF
atoms = read('structure.cif')

# Read multiple frames from a trajectory
frames = read('simulation.traj', index=':') # All frames
last_5 = read('simulation.traj', index='-5:') # Last 5 frames

# Write to different formats
write('output.poscar', atoms, format='vasp')
write('movie.gif', frames, rotation='10x,10y,10z') # Create animated gif

Advanced: Transition States (NEB)

Nudged Elastic Band

from ase.mep import NEB
from ase.optimize import BFGS

# Initial and Final states (must have same atoms/order)
initial = read('initial.traj')
final = read('final.traj')

# Create 5 images between initial and final
images = [initial]
for i in range(5):
    images.append(initial.copy())
images.append(final)

# Interpolate positions
neb = NEB(images)
neb.interpolate()

# Run optimization on all images
opt = BFGS(neb, trajectory='neb.traj')
opt.run(fmax=0.05)

Practical Workflows

1. Lattice Parameter Scan (Equation of State)

import numpy as np
from ase.build import bulk
from ase.calculators.emt import EMT

def find_opt_lattice():
    volumes = []
    energies = []
    for a in np.linspace(3.5, 3.7, 5):
        atoms = bulk('Cu', 'fcc', a=a)
        atoms.calc = EMT()
        volumes.append(atoms.get_volume())
        energies.append(atoms.get_potential_energy())

    # You can then fit these to Birch-Murnaghan EOS
    return volumes, energies

2. Vibrational Analysis (Thermodynamics)

from ase.vibrations import Vibrations

# Calculate vibrations (requires a calculator)
vib = Vibrations(atoms)
vib.run()
vib.summary()

# Get Helmholtz free energy at 300K
from ase.thermochemistry import IdealGasThermo
thermo = IdealGasThermo(vib_energies=vib.get_frequencies(),
                        geometry='nonlinear',
                        potentialenergy=atoms.get_potential_energy())
F = thermo.get_helmholtz_free_energy(temperature=300)

3. Integration with PySCF (Quantum Chemistry)

from ase.calculators.pyscf_calc import PySCF
from ase.build import molecule

atoms = molecule('H2')
# Define PySCF calculator
atoms.calc = PySCF(mol_options={'basis': '6-31g', 'spin': 0},
                   method='RKS.xc = "b3lyp"')

energy = atoms.get_potential_energy()

Performance Optimization

Using Symmetry

If building large crystals, using the spglib integration within ASE can help identify symmetry, though ASE's core structures don't automatically enforce it during optimization unless specific constraints are added.

Constraints

Fixing atoms (e.g., bottom layers of a slab) speeds up relaxation significantly.

from ase.constraints import FixAtoms

# Fix all atoms with Z-coordinate < 5.0
c = FixAtoms(mask=[atom.position[2] < 5.0 for atom in atoms])
atoms.set_constraint(c)

Common Pitfalls and Solutions

The "Missing Calculator" Error

# ❌ Problem: atoms.get_potential_energy() fails
# ✅ Solution: Ensure .calc is set and external code is in PATH
import os
os.environ['VASP_COMMAND'] = 'mpirun vasp_std' # Example for VASP

Cell Vector Sign Convention

ASE typically uses a right-handed coordinate system. Be careful when importing from old codes that might use different conventions.

Purity of the Atoms Object

If you delete atoms from the list, the indices change.

# ❌ Problem: Deleting atoms in a loop by index
# ✅ Solution: Use a mask or the .pop() method carefully
del atoms[[0, 5, 10]] # Bulk delete by index list

ASE is the standard "glue" of the atomistic simulation world. It allows you to switch from a simple empirical potential to an expensive DFT calculation by changing just one line of code (atoms.calc), making it indispensable for high-throughput computational materials science.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.55%
按下载量换算69

Claude

31.05%
按下载量换算60

Cursor

18.81%
按下载量换算36

Gemini CLI

10.39%
按下载量换算20

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills