A TensorFlow implementation of Multi-fidelity Physics-Informed Neural Networks for molecular dynamics simulations.
-
Clone the repository
-
Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install the package and dependencies:
pip install -e .
- Create the data directories if they don't exist:
mkdir -p examples/data-one-component-system
mkdir -p examples/data-benchmark-system
- Place your molecular dynamics data files in the appropriate directories:
examples/data-one-component-system/
├── high_fidelity/
│ ├── energy.txt
│ ├── pressure.txt
│ └── diffusion.txt
└── low_fidelity/
├── energy.txt
├── pressure.txt
└── diffusion.txt
Data files should be in space-separated format with:
- First column: Temperature
- Second column: Density
- Third column: Feature value (energy/pressure/diffusion)
- Create a results directory:
mkdir results
mkdir results/checkpoints
- Modify the training script (
examples/train_mpinn_with_config.py
) to match your data:
def create_config():
return MPINNConfig(
# Data configuration
data_dir=Path("examples/data-one-component-system"),
input_features=['temperature', 'density'],
output_features=['energy', 'pressure', 'diffusion'],
hf_fractions=[0.1, 0.2, 0.3, 0.4, 0.5, 1.0],
# Model architecture (optional)
hidden_layers_lf=[20, 20, 20, 20],
hidden_layers_hf=[20, 20],
activation='tanh',
# Training parameters (optional)
batch_size=32,
lf_epochs=1000,
hf_epochs=500,
# Save directory
save_dir=Path("results")
)
- Run the training script:
python examples/train_mpinn_with_config.py
The training process consists of two phases:
- Low-fidelity network training
- Progressive high-fidelity training with increasing data fractions
Training results will be saved in the results
directory:
- Model checkpoints:
results/checkpoints/
- Visualization plots:
results/plots/
- Prediction vs actual plots
- Error distributions
- Training progress
- Feature contour plots
- Computational savings analysis
The training process automatically generates several types of plots:
- Training metrics (loss, alpha parameter)
- Prediction accuracy for each feature
- Error distributions
- Contour plots of predictions
- Input space sampling distribution
- Computational savings analysis
All plots are saved in results/plots/
with appropriate timestamps and labels. Results are overwritten when new training is run.