geant4-project

Generate and modify Geant4 simulation projects with geometry, particle sources, and physics lists.

Updated May 5, 2026
One-click install
npx skills add https://github.com/bangx3363-bot/geant4-skill --skill geant4-project
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: geant4-project
Source: https://github.com/bangx3363-bot/geant4-skill/tree/main/geant4-project
Command: npx skills add https://github.com/bangx3363-bot/geant4-skill --skill geant4-project

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Helps you create, modify, and debug complete Geant4 particle simulation projects (geometry, primary generator, physics list, and runnable build setup) instead of assembling boilerplate code manually.

Core Features & Use Cases

  • End-to-end project scaffolding: Generates a standard Geant4 project layout with CMakeLists.txt, main entry point, detector geometry, and action initialization structure for a compile-ready workflow.
  • Particle source setup: Provides a PrimaryGeneratorAction pattern to simulate specific particles (e.g., neutrons at a chosen energy) and guide you in extending it to other sources.
  • Physics list guidance: Recommends appropriate built-in physics lists (notably FTFP_BERT for general purpose) and explains when to switch for energy ranges and particle types.
  • Data collection and analysis patterns: Supports adding ROOT output using RunAction, EventAction, and SteppingAction with correct per-event aggregation flow.
  • Modular geometry and iteration: Offers best practices for geometry naming, overlap checking, materials, and how to make minimal changes when updating existing projects.
  • Optional visualization macro: Includes an init_vis.mac starter for OpenGL-based visualization so you can validate geometry and trajectories quickly.

Quick Start

Use the geant4-project skill to generate a complete Geant4 project that compiles and runs a simulation of 10 MeV neutrons striking an aluminum target.

Frequently Asked Questions about geant4-project

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up a Geant4 detector simulation project from scratch?

To set up a Geant4 detector simulation, you need a standard project layout with CMakeLists.txt, a main entry point, detector geometry, and action initialization. Generating a compile-ready codebase lets you run beam and target simulations without manually assembling boilerplate code.

What physics list should I use for my Geant4 particle transport simulation?

For general-purpose Geant4 particle transport, the FTFP_BERT physics list is recommended. You should switch to alternative built-in physics lists based on your specific energy ranges and particle types to ensure accurate physics modeling.

How do I add ROOT output to record energy deposition in a Geant4 simulation?

To add ROOT output for energy deposition, implement data collection using RunAction, EventAction, and SteppingAction. This pattern ensures correct per-event aggregation flow, allowing you to record hits and positions accurately for later analysis.

Can I use OpenGL visualization to check detector geometry and particle trajectories in Geant4?

Yes, you can use OpenGL visualization to check detector geometry and particle trajectories in Geant4. By running an init_vis.mac starter macro, you can quickly validate your geometry setup and visualize particle paths during simulation debugging.

What are the best practices for debugging Geant4 detector geometry overlaps and materials?

Debugging Geant4 detector geometry requires best practices like overlap checking, unit validation, and proper material definitions. Making modular geometry changes and using consistent naming conventions helps identify issues quickly when updating existing simulation projects.

How do I configure a primary generator action for a neutron beam in Geant4?

To configure a primary generator action for a neutron beam in Geant4, use the PrimaryGeneratorAction pattern to define the particle type and energy. This setup allows you to simulate specific particles like 10 MeV neutrons striking a target.