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.
-
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.
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.
-
Fortran Compiler:
gfortran(GNU) orifort/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.
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 -ldlUsing 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.fUsing 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 infoNote: 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).
The program expects the following files in the working directory (filenames are hardcoded but can be modified in DML_Final):
- 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.
- Low-Level Candidate Set (e.g.,
point-137120): Large pool of candidate geometries (e.g., DFT sampling).
new-add.xyz: The top-ranked geometries selected for high-level calculation.- Contains the coordinates, Low-level Energy, and the Calculated Score.
results.txt: Summary log.- Console Output: Detailed progress steps, memory usage, and debugging info.
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 ( |
dist_tol |
Real |
0.5 |
Diversity threshold ( |
large_energy_cutoff |
Real |
6.0 |
Energy cutoff (eV). Points above min_E + cutoff are ignored. |
- Initialization: Read datasets and generate the global permutation symmetry map.
- Index Mapping: Compare coordinates between Training Set and Candidate Set to flag existing points (avoids re-calculation).
-
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$ .
- Calculate
-
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.
If you use this code or the methodology, please cite:
- CQPES Framework: Chemistry 2025, 7, 201. [DOI: 10.3390/chemistry7060201]
- Original PIP-NN Method: J. Chem. Phys. 2013, 139, 054112.
This project is open-source. Please refer to the LICENSE file for details.
Author: Dr. Kaisheng Song
Modified: December 2025