# mjw99/jquante architecture

> Architecture diagram of the GitHub repository mjw99/jquante, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mjw99/jquante
- Repository: https://github.com/mjw99/jquante

## Overview

##### Main Components Identification
The system should be represented with the following major components:

a) Core QM Components:
- Basis Set Management
- Integral Calculations
- SCF (Self-Consistent Field) Methods
- Molecular Structure
- Mathematical Utilities

b) Supporting Components:
- Configuration Management
- Resource Management
- Event Handling System

**┌─────────────────────────────────────────────────────────┐**
- Client Layer                        │
- ┘
- ↓
**┌─────────────────────────────────────────────────────────┐**
- Molecule Layer                       │
- (Molecule, Atom, MolecularFormula, Properties)        │
- ┘
- ↓
**┌─────────────────────────────────────────────────────────┐**
- QM Core Layer                       │
- ┬───────────────┬────────────────────────┤
- Basis Sets   │  Integrals   │    SCF Methods         │
- Management   │  Calculation  │    (HF, MP2, etc.)     │
- ┴───────────────┴────────────────────────┘
- ↓
**┌─────────────────────────────────────────────────────────┐**
- Support Layer                         │
- ┬───────────────┬────────────────────────┤
- Configuration  │   Resource    │     Event System       │
- Management   │   Management  │                        │
- ┴───────────────┴────────────────────────┘

##### Component Details

- Rectangles with rounded corners for core QM components (blue)
- Regular rectangles for support systems (gray)
- Hexagons for interfaces (green)
- Diamonds for factories (yellow)

##### Key Relationships

a) QM Core Components:
- BasisSet → IntegralsPackage
- IntegralsPackage → SCFMethod
- SCFMethod → Molecule

b) Support Systems:
- Configuration → All Components
- Event System → Component Communications
- Resource Management → Basis Set Data

##### Important Implementation Details

Classes and their relationships:
- SCFMethodFactory and its relationship to different SCF implementations
- IntegralsPackageFactory and various integral calculation methods
- BasisSetLibrary and its relationship to basis set resources
- Event handling system for SCF and molecule state changes

##### Design Patterns to Highlight

- Factory Pattern (SCFMethodFactory, IntegralsPackageFactory)
- Observer Pattern (Event handling system)
- Strategy Pattern (Different integral calculation methods)

##### Additional Elements

Annotations for:
- XML configuration files locations
- Basis set data files
- Test coverage areas
- External dependencies

- Quantum chemistry components (blue)
- Mathematical utilities (purple)
- Configuration and resource management (gray)
- Interface definitions (green)

This architecture reflects the scientific nature of the project while maintaining good software engineering practices through proper separation of concerns and modular design.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef client fill:#f9f,stroke:#333,stroke-width:2px
    classDef molecule fill:#afd,stroke:#333,stroke-width:2px
    classDef qmcore fill:#9cf,stroke:#333,stroke-width:2px
    classDef support fill:#ddd,stroke:#333,stroke-width:2px
    classDef factory fill:#ff9,stroke:#333,stroke-width:2px
    classDef math fill:#e6e6fa,stroke:#333,stroke-width:2px

    %% Client Layer
    Client["Client Application"]:::client

    %% Molecule Layer
    subgraph MoleculeLayer["Molecule Layer"]
        Molecule["Molecule"]:::molecule
        Atom["Atom"]:::molecule
        MolForm["Molecular Formula"]:::molecule
    end
    click Molecule "https://github.com/mjw99/jquante/blob/master/src/main/java/name/mjw/jquante/molecule/Molecule.java"
    click Atom "https://github.com/mjw99/jquante/blob/master/src/main/java/name/mjw/jquante/molecule/Atom.java"
    click MolForm "https://github.com/mjw99/jquante/blob/master/src/main/java/name/mjw/jquante/molecule/MolecularFormula.java"

    %% QM Core Layer
    subgraph QMCore["QM Core Layer"]
        BasisSetMgmt["Basis Set Management"]:::qmcore
        IntCalc["Integral Calculations"]:::qmcore
        SCFMethods["SCF Methods"]:::qmcore
        
        BSLib["Basis Set Library"]:::qmcore
        ContGauss["Contracted Gaussian"]:::qmcore
        
        IntPkg["Integrals Package"]:::qmcore
        TwoElecTerm["Two Electron Term"]:::qmcore
        
        RHF["Restricted HF"]:::qmcore
        UHF["Unrestricted HF"]:::qmcore
    end
    click BasisSetMgmt "https://github.com/mjw99/jquante/tree/master/src/main/java/name/mjw/jquante/math/qm/basis/"
    click BSLib "https://github.com/mjw99/jquante/blob/master/src/main/java/name/mjw/jquante/math/qm/basis/BasisSetLibrary.java"
    click ContGauss "https://github.com/mjw99/jquante/blob/master/src/main/java/name/mjw/jquante/math/qm/basis/ContractedGaussian.java"
    click IntCalc "https://github.com/mjw99/jquante/tree/master/src/main/java/name/mjw/jquante/math/qm/integral/"
    click IntPkg "https://github.com/mjw99/jquante/blob/master/src/main/java/name/mjw/jquante/math/qm/integral/IntegralsPackage.java"
    click TwoElecTerm "https://github.com/mjw99/jquante/blob/master/src/main/java/name/mjw/jquante/math/qm/integral/TwoElectronTerm.java"
    click SCFMethods "https://github.com/mjw99/jquante/tree/master/src/main/java/name/mjw/jquante/math/qm/"
    click RHF "https://github.com/mjw99/jquante/blob/master/src/main/java/name/mjw/jquante/math/qm/RestrictedHartreeFockMethod.java"
    click UHF "https://github.com/mjw99/jquante/blob/master/src/main/java/name/mjw/jquante/math/qm/UnrestrictedHartreeFockMethod.java"

    %% Factories
    SCFFactory["SCF Method Factory"]:::factory
    IntFactory["Integrals Package Factory"]:::factory
    click SCFFactory "https://github.com/mjw99/jquante/blob/master/src/main/java/name/mjw/jquante/math/qm/SCFMethodFactory.java"
    click IntFactory "https://github.com/mjw99/jquante/blob/master/src/main/java/name/mjw/jquante/math/qm/integral/IntegralsPackageFactory.java"

    %% Support Layer
    subgraph Support["Support Layer"]
        Config["Configuration Management"]:::support
        Resource["Resource Management"]:::support
        EventSystem["Event Handling System"]:::support
        MathUtils["Mathematical Utilities"]:::math
    end
    click Config "https://github.com/mjw99/jquante/tree/master/src/main/java/name/mjw/jquante/config/"
    click Resource "https://github.com/mjw99/jquante/tree/master/src/main/java/name/mjw/jquante/common/resource/"
    click EventSystem "https://github.com/mjw99/jquante/blob/master/src/main/java/name/mjw/jquante/common/EventListenerList.java"
    click MathUtils "https://github.com/mjw99/jquante/tree/master/src/main/java/name/mjw/jquante/math/"

    %% Relationships
    Client --> Molecule
    Molecule --> Atom
    Molecule --> MolForm
    
    BasisSetMgmt --> BSLib
    BasisSetMgmt --> ContGauss
    
    IntCalc --> IntPkg
    IntCalc --> TwoElecTerm
    
    SCFMethods --> RHF
    SCFMethods --> UHF
    
    SCFFactory --> SCFMethods
    IntFactory --> IntCalc
    
    BasisSetMgmt --> IntCalc
    IntCalc --> SCFMethods
    SCFMethods --> Molecule
    
    Config --> BasisSetMgmt
    Config --> IntCalc
    Config --> SCFMethods
    
    Resource --> BasisSetMgmt
    EventSystem --> SCFMethods
    EventSystem --> Molecule
    
    MathUtils --> IntCalc
    MathUtils --> SCFMethods

    %% Legend
    subgraph Legend
        Client_L["Client"]:::client
        Molecule_L["Molecule Components"]:::molecule
        QM_L["QM Core Components"]:::qmcore
        Support_L["Support Components"]:::support
        Factory_L["Factories"]:::factory
        Math_L["Math Utilities"]:::math
    end
```
