Skip to content

[BUG]when cutting a dataset of cp2k/aimd, the command of data.sub_system made such a bug. #439

@jiaweiGe472

Description

@jiaweiGe472

import dpdata
i>>> import numpy as np
data = dpdata.LabeledSystem(".",fmt="cp2k/aimd_output")
print('# the data contains %d frames' % len(data))

the data contains 501 frames

index_validation = np.random.choice(500,size=40,replace=False)
index_training = list(set(range(501))-set(index_validation))
data_training = data.sub_system(index_training)
Traceback (most recent call last):
File "", line 1, in
File "/public1/home/sc61116/.conda/envs/sc61116/lib/python3.9/site-packages/dpdata/system.py", line 1193, in sub_system
tmp_sys.data['forces'] = self.data['forces'][f_idx].reshape(-1, self.data['forces'].shape[1], 3)
ValueError: cannot reshape array of size 0 into shape (0,3)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcp2k

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions