Skip to content

[Bug]: VASP labels Parsing issue #163

@danialWang

Description

@danialWang

Email (Optional)

No response

Version

v0.3.8

Which OS(es) are you using?

  • MacOS
  • Windows
  • Linux

What happened?

I am trying to json data and get the structures, energies and forces as shows in the fine_tuning.ipynb. However, there is an error in reading the json data. The error message shows the list indices was set as a string rather than integers.

Code snippet

dataset_dict = read_json("./my_vasp_calc_dir/chgnet_dataset.json")
structures = [Structure.from_dict(struct) for struct in dataset_dict["structure"]]
energies = dataset_dict["energy_per_atom"]
forces = dataset_dict["force"]

Log output

Traceback (most recent call last):
  File "/kfs3/scratch/dwang19/storage/data/wzy/LGFCBI/chgnet/reading.py", line 33, in <module>
    structures = [Structure.from_dict(struct)]
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dwang19/miniforge/envs/lammps/lib/python3.12/site-packages/pymatgen/core/structure.py", line 2814, in from_dict
    lattice = Lattice.from_dict(dct["lattice"])
                                ~~~^^^^^^^^^^^
  File "/home/dwang19/miniforge/envs/lammps/lib/python3.12/site-packages/pymatgen/core/structure.py", line 218, in __getitem__
    return self.sites[ind]  # type: ignore[return-value]
           ~~~~~~~~~~^^^^^
TypeError: list indices must be integers or slices, not str

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions