Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DML: High-Performance Delta Machine Learning for PES Construction

DML is a highly optimized Fortran-based tool designed to automate the selection of molecular configurations for high-precision Potential Energy Surface (PES) construction.

It implements a rigorous Active Learning strategy to select the most informative data points from a large pool of low-level (e.g., DFT) calculations to be computed at a high level (e.g., CCSD(T)). This code significantly reduces the computational cost of developing full-dimensional PESs by avoiding redundant high-level calculations.

🚀 Key Features

  • Advanced Active Learning Strategy: Implements the scoring metric from the CQPES methodology (Chemistry 2025, 7, 201):
    • $$Score = F_1 \times F_2 \times F_3$$
    • $F_1$ (Uncertainty): Variance of predictions from a committee of Neural Networks.
    • $F_2$ (Sparsity): Euclidean distance to the existing training set (in bond length space).
    • $F_3$ (Energy Preference): Boltzmann-like weighting ($\exp(-\beta \Delta E)$) to favor physically relevant low-energy regions.
  • Rigorous Permutation Invariance: Calculates Euclidean distances by minimizing over all possible permutations of identical atoms ($N!$), ensuring strict physical symmetry adherence.
  • HPC Optimization:
    • OpenMP Parallelization: Massive speedup for scoring and distance calculations.
    • 3D Bond Pool: Pre-computes and stores bond vectors for all permutations in memory (nbond × nperm × ndata), eliminating redundant geometry calculations during the selection phase.
    • Index Mapping: Automatically identifies and skips candidate points that already exist in the training set to prevent duplication.
  • Robust Diversity Check: Includes a dynamic diversity filter during selection to ensure no two newly selected points are geometrically similar.

📂 Repository Structure

  • src/DML.f90: The main source code.
  • src/pipnn_a5b2c-5.f90: (Required dependency) Module defining system parameters (natom, nbond, nperm, etc.) and NN subroutines. [Note: User must provide this based on their specific molecule]
  • src/bemsa521_5.f: PIPs for the A5B2C system [Note: User must provide this based on their specific molecule]

Important Note on Subroutine Interfaces:

The gradient-related code has been commented out in src/pipnn_a5b2c-5.f90. The subroutine interfaces have been simplified:

  • evvdvdx(xcart, v, vpes): Computes potential energy only. Gradient parameters have been removed.
  • pot3a(x, vpot3): Computes neural network potential energy. Gradient parameters have been removed.

When integrating this module with your main program, ensure the subroutine calls match these simplified interfaces.

🛠️ Prerequisites

  • Fortran Compiler: gfortran (GNU) or ifort/ifx (Intel).
  • OpenMP: Required for parallel acceleration.
  • Memory: $\approx$ 8 GB RAM is required for a dataset of ~140,000 points due to the 3D Bond Pool optimization.

🔧 Compilation

Ensure you have your nnparam module compiled or linked.

Using GFortran:

gfortran -fopenmp -O3 -march=native -o dml_opt.exe src/pipnn_a5b2c-5.f90 src/DML.f90 src/bemsa521_5.f -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl

Using Intel Fortran (ifort): (Recommend)

ifort -qopenmp -Ofast -qmkl=sequential -march=haswell -o dml.exe src/pipnn_a5b2c-5.f90 src/DML.f90 src/bemsa521_5.f

Using Makefile (Recommended)

A Makefile is provided for easier compilation. The Makefile supports both gfortran and ifort compilers and automatically handles MKL library linking.

Basic usage:

# Compile using the default compiler (ifort)
make

# Compile using gfortran
make FC=gfortran

# Clean build artifacts
make clean

# Rebuild from scratch
make rebuild

# Show compilation configuration
make info

Note: The Makefile compiles source files into object files (.o) first, then links them to create the executable. MKL sequential library is automatically linked (mainly required by pipnn_a5b2c-5.f90).

📥 Input Files

The program expects the following files in the working directory (filenames are hardcoded but can be modified in DML_Final):

  1. High-Level Training Set (e.g., avtz-2593): Existing high-precision data, including all stationary points, transition states, and structures from IRC.
    • Format: XYZ-like format with Energy/Gradient info.
  2. Low-Level Candidate Set (e.g., point-137120): Large pool of candidate geometries (e.g., DFT sampling).

📤 Output

  1. new-add.xyz: The top-ranked geometries selected for high-level calculation.
    • Contains the coordinates, Low-level Energy, and the Calculated Score.
  2. results.txt: Summary log.
  3. Console Output: Detailed progress steps, memory usage, and debugging info.

⚙️ Parameters & Tuning

You can adjust the following parameters in the DML_Final program block to fit your specific molecular system:

Parameter Type Default Description
nselect Integer 500 Number of new points to select per iteration.
beta Real 0.5 Decay factor for energy preference ($e^{-\beta \Delta E}$). Lower $\beta$ allows higher energy points.
dist_tol Real 0.5 Diversity threshold ($\AA$). Points closer than this to newly selected points are skipped.
large_energy_cutoff Real 6.0 Energy cutoff (eV). Points above min_E + cutoff are ignored.

🚀 Workflow Logic

  1. Initialization: Read datasets and generate the global permutation symmetry map.
  2. Index Mapping: Compare coordinates between Training Set and Candidate Set to flag existing points (avoids re-calculation).
  3. Parallel Scoring (OpenMP):
    • Calculate $F_1$ (Uncertainty via NN ensemble).
    • Calculate $F_3$ (Energy weight).
    • Generate and store Bond Vectors for all permutations into the global memory pool.
    • Calculate $F_2$ (Distance to Training Set) using the best permutation match.
    • Compute final $Score = F_1 \times F_2 \times F_3$.
  4. Selection:
    • Sort candidates by Score (Descending).
    • Iterate through sorted list:
      • Check against Batch (points selected in the current run) using the pre-computed 3D Pool.
    • Write unique high-scoring points to new-add.xyz.

📜 References

If you use this code or the methodology, please cite:

  1. CQPES Framework: Chemistry 2025, 7, 201. [DOI: 10.3390/chemistry7060201]
  2. Original PIP-NN Method: J. Chem. Phys. 2013, 139, 054112.

📄 License

This project is open-source. Please refer to the LICENSE file for details.


Author: Dr. Kaisheng Song
Modified: December 2025

About

High-Performance Delta Machine Learning for PES Construction

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages