epc_ml_data / 2_training /forces /train.yaml
Koulb's picture
Add files using upload-large-folder tool
e9e349d verified
# NequIP training config for diamond ML interatomic potential
# Trained on 50 displaced 2x2x2 FCC diamond supercells (QE PBE, ecutwfc=60 Ry)
run: [train, test]
cutoff_radius: 5.0 # Angstrom — covers ~5 neighbor shells in diamond
num_layers: 4
l_max: 2 # l=2 for better angular accuracy (diamond has sp3 bonding)
num_features: 32 # 32 is safe for 6GB GPU with l_max=2
model_type_names: [C]
chemical_species: ${model_type_names}
monitored_metric: val0_epoch/weighted_sum
data:
_target_: nequip.data.datamodule.ASEDataModule
seed: 42
split_dataset:
file_path: ${hydra:runtime.cwd}/dataset.xyz
train: 0.8 # 40 train
val: 0.1 # 5 val
test: 0.1 # 5 test
transforms:
- _target_: nequip.data.transforms.ChemicalSpeciesToAtomTypeMapper
model_type_names: ${model_type_names}
- _target_: nequip.data.transforms.NeighborListTransform
r_max: ${cutoff_radius}
train_dataloader:
_target_: torch.utils.data.DataLoader
batch_size: 2
num_workers: 4
shuffle: true
val_dataloader:
_target_: torch.utils.data.DataLoader
batch_size: 10
num_workers: ${data.train_dataloader.num_workers}
test_dataloader: ${data.val_dataloader}
stats_manager:
_target_: nequip.data.CommonDataStatisticsManager
dataloader_kwargs:
batch_size: 10
type_names: ${model_type_names}
trainer:
_target_: lightning.Trainer
accelerator: gpu
enable_checkpointing: true
max_epochs: 2000
log_every_n_steps: 10
logger:
_target_: lightning.pytorch.loggers.CSVLogger
save_dir: ${hydra:runtime.output_dir}
name: nequip_diamond
callbacks:
- _target_: lightning.pytorch.callbacks.EarlyStopping
monitor: ${monitored_metric}
min_delta: 1e-4
patience: 50
- _target_: lightning.pytorch.callbacks.ModelCheckpoint
monitor: ${monitored_metric}
dirpath: ${hydra:runtime.output_dir}
filename: best
save_last: true
- _target_: lightning.pytorch.callbacks.LearningRateMonitor
logging_interval: epoch
training_module:
_target_: nequip.train.EMALightningModule
ema_decay: 0.999
loss:
_target_: nequip.train.EnergyForceLoss
per_atom_energy: true
coeffs:
total_energy: 1.0
forces: 1.0
val_metrics:
_target_: nequip.train.EnergyForceMetrics
coeffs:
total_energy_mae: 1.0
forces_mae: 1.0
train_metrics: ${training_module.val_metrics}
test_metrics: ${training_module.val_metrics}
optimizer:
_target_: torch.optim.Adam
lr: 0.005
lr_scheduler:
scheduler:
_target_: torch.optim.lr_scheduler.ReduceLROnPlateau
factor: 0.5
patience: 20
threshold: 0.01
min_lr: 1e-6
monitor: ${monitored_metric}
interval: epoch
frequency: 1
model:
_target_: nequip.model.NequIPGNNModel
seed: 42
model_dtype: float32
type_names: ${model_type_names}
r_max: ${cutoff_radius}
num_bessels: 8
bessel_trainable: false
polynomial_cutoff_p: 6
num_layers: ${num_layers}
l_max: ${l_max}
parity: true
num_features: ${num_features}
radial_mlp_depth: 2
radial_mlp_width: 64
avg_num_neighbors: ${training_data_stats:num_neighbors_mean}
per_type_energy_scales: ${training_data_stats:per_type_forces_rms}
per_type_energy_shifts: ${training_data_stats:per_atom_energy_mean}
per_type_energy_scales_trainable: false
per_type_energy_shifts_trainable: false