Skip to content

Commit 9ecabda

Browse files
authored
Merge pull request #15 from zhaiwenxi/merge-preserve-both
Update DPA adapt input format handling
2 parents d71ae5e + ad757f0 commit 9ecabda

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

doc/dpa_adapt/input_formats.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@
1313

1414
## 1. SMILES Tables (CSV)
1515

16-
**Trigger:** file extension `.csv`/`.xlsx`/`.xls` **and** a SMILES column.
16+
**Trigger:** file extension `.csv` **and** a SMILES column.
1717
By default, the converter reads `SMILES`/`smiles`; use `--smiles-col` for
1818
other column names such as `smi` or `mol`. Or pass `--fmt smiles` explicitly.
1919

2020
| Parameter | Default | Description |
2121
|-----------|---------|-------------|
2222
| `--smiles-col` | `SMILES` | Column name for SMILES strings |
23-
| `--property-col` | `Property` | Input table column to read target values from |
24-
| `--property-name` | `Property` | Output label name written as `set.*/{property_name}.npy` |
23+
| `--property-col` | `Property` | Input table column to read target values from; also used as the output label name |
2524
| `--train-ratio` | `0.9` | Fraction of samples used for training set |
2625
| `--mol-dir` || Directory of pre-generated `.mol`, `.sdf`, `.xyz`, or `.pdb` structure files (skips RDKit 3D conformer generation) |
2726
| `--mol-template` | `id{row}.mol` | Filename template under `--mol-dir`; use `{row}` for the CSV row index |
@@ -31,10 +30,10 @@ other column names such as `smi` or `mol`. Or pass `--fmt smiles` explicitly.
3130
```bash
3231
# Auto-detected via SMILES column
3332
dpa-adapt data convert --input molecules.csv --output ./npy \
34-
--property-col homo --property-name homo
33+
--property-col homo
3534
# Short alias
3635
dpaad data convert --input molecules.csv --output ./npy \
37-
--property-col homo --property-name homo
36+
--property-col homo
3837

3938
# Explicit fmt + custom column names
4039
dpa-adapt data convert --input data.csv --output ./npy --fmt smiles \
@@ -55,21 +54,20 @@ by randomly substituting atoms on the host-element sublattice.
5554
| Parameter | Default | Description |
5655
|-----------|---------|-------------|
5756
| `--poscar` | *(required)* | Template POSCAR file for the host lattice |
58-
| `--formula-col` | `formula` | Input CSV column or 0-based column index to read composition formulas from |
57+
| `--formula-col` | `formula` | Input CSV column name to read composition formulas from |
5958
| `--base-element` | auto | Host element to substitute. Inferred as the most frequent non-O/H element in the template if omitted. |
6059
| `--sets` | `1` | Number of random structures generated per formula row |
61-
| `--property-col` | `Property` | Input CSV column or 0-based column index to read target values from |
62-
| `--property-name` | `Property` | Output label name written as `set.*/{property_name}.npy` |
60+
| `--property-col` | `Property` | Input CSV column name to read target values from; also used as the output label name |
6361
| `--seed` | `42` | Random seed for selecting substituted host-atom sites |
6462

6563
```bash
6664
dpa-adapt data convert --input compositions.csv --output ./npy --fmt formula \
6765
--poscar template.POSCAR --sets 3 \
68-
--formula-col formula --property-col bandgap --property-name bandgap
66+
--formula-col formula --property-col bandgap
6967
# Short alias
7068
dpaad data convert --input compositions.csv --output ./npy --fmt formula \
7169
--poscar template.POSCAR --sets 3 \
72-
--formula-col formula --property-col bandgap --property-name bandgap
70+
--formula-col formula --property-col bandgap
7371
```
7472

7573
## 3. Structure Files via dpdata

dpa_adapt/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def _cmd_data_convert(args: argparse.Namespace) -> int:
275275
output_dir=args.output,
276276
fmt=args.fmt,
277277
type_map=type_map,
278-
property_name=args.property_name,
278+
property_name=args.property_name or args.property_col,
279279
property_col=args.property_col,
280280
train_ratio=args.train_ratio,
281281
smiles_col=args.smiles_col,
@@ -629,7 +629,7 @@ def get_parser() -> argparse.ArgumentParser:
629629
"--no-validate", dest="validate", action="store_false"
630630
)
631631
parser_data_convert.add_argument("--strict", action="store_true")
632-
parser_data_convert.add_argument("--property-name", default="Property")
632+
parser_data_convert.add_argument("--property-name", default=None)
633633
parser_data_convert.add_argument("--property-col", default="Property")
634634
parser_data_convert.add_argument("--smiles-col", default="SMILES")
635635
parser_data_convert.add_argument("--mol-dir", default=None)

0 commit comments

Comments
 (0)