How anish9435/fmo-cc works
Project Type and Purpose
• This is a Python-based CLI application and library for high-accuracy quantum chemical calculations using the Fragment Molecular Orbital (FMO) framework with Coupled Cluster (CC) and MP2 methods.
• It is a modular, pipeline-oriented scientific tool that (a) parses GAMESS output files, (b) builds fragments and configures calculations, (c) executes energy computations (RHF, MP2, CC), and (d) handles parallelization and logging.
File Structure
• Entry Points / Scripts (Scripts/run_fmo_cc.py, __main__.py)
• Core Package (src/fmocc/):
• fmo_config.py – loads JSON input and sets up parameters
• fmo_extractor.py – reads GAMESS output (.dat, _2eint.dat)
• fmo_processor.py – orchestrates per-fragment workflow
• fmo_calculator.py – computes fragment energies (RHF, CC)
• MP2.py – specialized MP2 routines
• main_parallel.py – manages multiprocessing of CC tasks
• utils.py – logging, caching, helpers
• Support Files: input.json (example config), setup.sh, pyproject.toml, wrapper scripts for GAMESS.
README for Insights
• Emphasis on configurability via JSON, multiprocess parallelism, modular design, and GAMESS integration.
• No GUI or front-end—pure back-end computational pipeline.
Main Components and Their Relationships
A. User/CLI Layer
• run_fmo_cc.py or python -m fmocc
↓
B. Configuration Loader (fmo_config.py)
• Reads input.json or custom JSON
• Validates parameters (method, basis_set, fragment definitions)
↓
C. Data Extraction Layer (fmo_extractor.py)
• Parses GAMESS output files for integrals, MO coefficients, energies
↓
D. Workflow Orchestrator (fmo_processor.py)
• Divides the molecule into fragments (FMO1/FMO2)
• Calls the calculator or dispatches to parallel manager
↓
E. Computation Engines
• Serial / MP2 Engine (MP2.py)
↓
F. Parallelization Manager (main_parallel.py)
• Spawns worker processes, collects partial energies
↓
G. Result Aggregation & Logging (utils.py)
• Merges energies, writes rotating log files, outputs final results
External Service: GAMESS (invoked via run_gamess.sh)
Storage: File system (input .dat files, intermediate caches, final energy reports)
Architectural Patterns and Design Principles
• Modular Pipeline: clear separation of concerns across extraction, configuration, processing, computation, and logging.
• Adapter Pattern: for GAMESS outputs to internal data structures.
• Worker Pool / Fork–Join: for parallel CC/MP2 computations.
• Configuration-Driven: all run parameters flow from JSON into fmo_config.
Technologies, Frameworks, and Libraries
• Python 3.8+
• Standard Library: multiprocessing, logging, json
• External Tool: GAMESS (via shell wrapper scripts)
• Packaging: pyproject.toml (PEP 621)
• Shell scripts: run_gamess.sh, twoeint_process.sh
Essential Details to Capture
• The order of steps in the FMO-CC pipeline.
• The multiprocessing boundary in main_parallel.py.
• The two external interactions: (a) reading GAMESS outputs, (b) writing logs/results.
• The module-to-module dependencies within src/fmocc.