CederGroupHub / chgnet

Pretrained universal neural network potential for charge-informed atomistic modeling https://chgnet.lbl.gov
https://doi.org/10.1038/s42256-023-00716-3
Other
215 stars 55 forks source link

[Feature Request]: add option to disable data shuffle in `chgnet/data/dataset.py` #153

Closed xiaochendu closed 2 months ago

xiaochendu commented 2 months ago

Email (Optional)

dux@outlook.sg

Problem

Right now, StructureData, CIFData, GraphData, and StructureJsonData shuffle the order of data in the constructor. For example, StructureData does random.shuffle(self.keys) in the constructor body. I would like to have an option to disable the shuffling.

Proposed Solution

I would like to add a keyword argument in the constructor, shuffle: bool = True to enable the user to disable shuffling. The resulting code in the constructor body can look like this, again for the example of StructureData:

if shuffle:
    random.shuffle(self.keys)

With the default value of True, it would not affect the default behavior.

Alternatives

No response

Code of Conduct

BowenD-UCB commented 2 months ago

Thanks for reporting! This is implemented in https://github.com/CederGroupHub/chgnet/commit/72f910860869e0595543ad6567503d61dce970ea

BowenD-UCB commented 2 months ago

tests for disabled shuffling implemented in https://github.com/CederGroupHub/chgnet/commit/9e4bd5e6109c2bf70cc85cea0e5ec2e822c4e42b