@@ -39,7 +39,7 @@ model.fit(train_data="/data/train", target_key="homo")
3939model = DPAFineTuner(
4040 pretrained = " DPA-3.1-3M" , strategy = " frozen_head" , property_name = " homo"
4141)
42- model.fit(train_data = " /data/train" , valid_data = " /data/valid" , target_key = " homo " )
42+ model.fit(train_data = " /data/train" , valid_data = " /data/valid" )
4343
4444# mft — downstream property head + auxiliary force-field head jointly
4545model = DPAFineTuner(
@@ -53,41 +53,98 @@ model.fit(train_data="/data/qm9", aux_data="/data/spice2")
5353
5454## Data preparation
5555
56- Your data must be in ` deepmd/npy ` format. ` auto_convert ` detects the input format automatically:
56+ DPA-ADAPT trains on ` deepmd/npy ` data. Use ` dpa-adapt data convert ` (or the Python
57+ ` auto_convert ` helper) to route common inputs into the right conversion pipeline:
58+
59+ - ** SMILES CSV** : a ` .csv ` file with a ` SMILES ` /` smiles ` column. RDKit generates 3D
60+ conformers, or existing ` .mol ` /` .sdf ` /` .xyz ` /` .pdb ` files can be supplied with
61+ ` mol_dir ` .
62+ - ** Formula CSV + POSCAR template** : pass ` fmt="formula" ` and ` poscar=... ` to create
63+ doped structures by random substitution on the host-element sublattice.
64+ - ** Structure files / trajectories** : POSCAR, OUTCAR, ` *.xyz ` , ` vasprun.xml ` , ABACUS,
65+ CP2K, Gaussian, LAMMPS, ASE, ` deepmd/raw ` , ` deepmd/npy ` , LMDB, and other dpdata
66+ formats. Omit ` fmt ` when dpdata can infer it; set ` fmt ` explicitly for ambiguous
67+ inputs.
5768
5869``` python
5970from dpa_adapt import auto_convert
6071
61- # Structure file → dpdata (POSCAR, OUTCAR, extxyz, cif, …)
72+ # Structure file / trajectory → dpdata → deepmd/npy
6273auto_convert(" POSCAR" , " ./npy" )
63- auto_convert(" calcs/**/OUTCAR" , " ./npy" , fmt = " vasp/outcar" ) # glob → batch
74+ auto_convert(" OUTCAR" , " ./npy" , fmt = " vasp/outcar" )
75+ auto_convert(" traj.extxyz" , " ./npy" , fmt = " extxyz" )
76+
77+ # Glob patterns: one match is converted as one system; multiple matches are batched.
78+ auto_convert(" calcs/**/OUTCAR" , " ./npy_root" , fmt = " vasp/outcar" )
79+
80+ # CSV with a SMILES column → RDKit 3D conformers → deepmd/npy.
81+ # property_col names the input target column and output label name.
82+ auto_convert(
83+ " molecules.csv" ,
84+ " ./npy" ,
85+ fmt = " smiles" , # optional when a SMILES/smiles column is present
86+ smiles_col = " SMILES" ,
87+ property_col = " HOMO" ,
88+ train_ratio = 0.9 ,
89+ )
6490
65- # CSV with SMILES column → RDKit 3D conformers → deepmd/npy
66- auto_convert(" data.csv" , " ./npy" , property_name = " homo" , property_col = " HOMO" )
91+ # CSV + pre-generated molecular structures: skip RDKit conformer generation.
92+ auto_convert(
93+ " molecules.csv" ,
94+ " ./npy" ,
95+ fmt = " smiles" ,
96+ smiles_col = " SMILES" ,
97+ property_col = " GAP" ,
98+ mol_dir = " ./mol_files" ,
99+ mol_template = " id{row} .sdf" ,
100+ )
67101
68- # Composition formula CSV + template POSCAR → random atomic substitution → deepmd/npy
69- # CSV: two columns, formula and property value (header optional)
70- # e.g. Ni0.65Gd0.15Fe0.10Co0.05Yb0.05O2H1 291.9
102+ # Composition formula CSV + template POSCAR → random atomic substitution → deepmd/npy.
103+ # CSV: header required; defaults are formula_col="formula" and property_col="Property".
104+ # e.g. formula,Property
105+ # Ni0.65Gd0.15Fe0.10Co0.05Yb0.05O2H1,291.9
71106auto_convert(
72107 " compositions.csv" ,
73108 " ./npy" ,
74109 fmt = " formula" ,
75110 poscar = " template.POSCAR" ,
76- property_name = " overpotential" ,
77- sets = 3 , # random doped structures per composition (default: 1)
111+ formula_col = " formula" ,
112+ property_col = " bandgap" ,
113+ sets = 3 , # random doped structures per composition row (default: 1)
114+ seed = 42 ,
78115)
79116```
80117
118+ CLI equivalents:
119+
120+ ``` bash
121+ # SMILES table
122+ dpa-adapt data convert --input molecules.csv --output ./npy \
123+ --fmt smiles --smiles-col SMILES --property-col HOMO --train-ratio 0.9
124+
125+ # Formula table + POSCAR template
126+ dpa-adapt data convert --input compositions.csv --output ./npy --fmt formula \
127+ --poscar template.POSCAR --formula-col formula --property-col bandgap --sets 3
128+
129+ # Structure file or glob of calculation outputs
130+ dpa-adapt data convert --input POSCAR --output ./npy
131+ dpa-adapt data convert --input " calcs/**/OUTCAR" --output ./npy_root --fmt vasp/outcar
132+ ```
133+
81134Lower-level helpers:
82135
83136``` python
84- from dpa_adapt import convert, attach_labels, check_data
137+ from dpa_adapt import convert, batch_convert, attach_labels, check_data
85138
86- convert(" calcs/**/OUTCAR" , " ./npy" , fmt = " vasp/outcar" )
139+ convert(" OUTCAR" , " ./npy" , fmt = " vasp/outcar" )
140+ batch_convert(" calcs/**/OUTCAR" , " ./npy_root" , fmt = " vasp/outcar" )
87141attach_labels(system, head = " bandgap" , values = np.array([1.0 , 2.0 , 3.0 ]))
88142check_data(" /data/system" ) # → list[Issue]
89143```
90144
145+ For the full option list and supported dpdata formats, see
146+ [ ` input_formats.md ` ] ( input_formats.md ) .
147+
91148### Context features (fparam)
92149
93150fparam lets you condition the model on system-level context such as temperature, pressure, or experimental conditions.
@@ -161,7 +218,7 @@ from dpa_adapt import (
161218 train_test_split, # formula-grouped splitting
162219 auto_convert, # format-sniffing data conversion
163220 smiles_to_npy, # CSV+SMILES → deepmd/npy
164- formula_csv_to_npy , # composition formula CSV + POSCAR → deepmd/npy
221+ formula_to_npy , # composition formula CSV + POSCAR → deepmd/npy
165222 convert, # structure file → deepmd/npy
166223 batch_convert, # glob-based batch conversion
167224 check_data, # data sanity checks
@@ -196,10 +253,16 @@ X = extract_descriptors(
196253
197254``` bash
198255# Data conversion
256+ # Structure file
199257dpa-adapt data convert --input POSCAR --output ./npy
200- dpaad data convert --input data.csv --output ./npy --property-name homo
201- dpa-adapt data convert --input comps.csv --output ./npy \
202- --fmt formula --poscar template.POSCAR --sets 3
258+
259+ # SMILES CSV: --property-col names the input target column and output label name.
260+ dpaad data convert --input data.csv --output ./npy --fmt smiles \
261+ --property-col homo
262+
263+ # Formula CSV + POSCAR template
264+ dpa-adapt data convert --input comps.csv --output ./npy --fmt formula \
265+ --poscar template.POSCAR --formula-col formula --property-col bandgap --sets 3
203266
204267# Fine-tune
205268dpa-adapt fit --train-data ./npy/train --pretrained DPA-3.1-3M \
@@ -210,7 +273,7 @@ dpaad fit --train-data /data/qm9 --aux-data /data/spice2 \
210273 --pretrained /path/to/DPA-3.1-3M.pt --strategy mft --target-key homo
211274
212275# Predict / evaluate
213- dpa-adapt predict --model model.pth --data ./npy/test
276+ dpa-adapt predict --model model.pth --data ./npy/test --output pred.npy
214277dpa-adapt evaluate --model model.pth --data ./npy/test
215278```
216279
0 commit comments