Skip to content

Commit 3f41e8c

Browse files
committed
fix: make json file for cgcnn example and fix cgcnn example
1 parent 013e014 commit 3f41e8c

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ python examples/wren-example.py --train --evaluate --data-path examples/inputs/e
4848
```
4949

5050
```sh
51-
python examples/cgcnn-example.py --train --evaluate --data-path examples/inputs/examples.csv --targets E_f --tasks regression --losses L1 --robust --epoch 10
51+
python examples/cgcnn-example.py --train --evaluate --data-path examples/inputs/examples.json --targets E_f --tasks regression --losses L1 --robust --epoch 10
5252
```
5353

5454
Please note that for speed/demonstration purposes this example runs on only ~68 materials for 10 epochs - running all these examples should take < 30s. These examples do not have sufficient data or training to make accurate predictions, however, the same scripts have been used for all experiments conducted.

examples/inputs/examples.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

examples/inputs/poscar_to_df.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,12 @@ def get_formation_energy(comp: str, energy: float, el_refs: dict[str, float]) ->
149149

150150
fields = ["material_id", "composition", "E_f", "wyckoff"] # , "lattice", "sites"]
151151

152-
df_wyk[fields].to_csv(final_dir + "/examples.csv", index=False)
152+
df_wyk[["material_id", "composition", "E_f", "wyckoff"]].to_csv(
153+
final_dir + "/examples.csv", index=False
154+
)
155+
156+
df_wyk["structure"] = df_wyk["final_structure"].map(lambda x: x.as_dict())
157+
158+
df_wyk[["material_id", "composition", "E_f", "wyckoff", "structure"]].to_json(
159+
final_dir + "/examples.json"
160+
)

0 commit comments

Comments
 (0)