Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CalibrationMetrics does not work for datasets with varying numbers of atoms #341

Open
lkkmpn opened this issue Sep 20, 2024 · 0 comments
Open

Comments

@lkkmpn
Copy link

lkkmpn commented Sep 20, 2024

When lists of Atoms objects with varying numbers of atoms are passed to CalibrationMetrics, the analysis fails. In get_data, converting the lists of forces into arrays will raise an error about the inhomogeneous shape:

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (197,) + inhomogeneous part.

(197 is the number of Atoms objects in the dataset.)

PredictionMetrics works around this by using np.concatenate() instead of np.array(), which is fine because afterwards the arrays get flattened anyway:

true_forces = [x.get_forces() for x in self.x]
true_forces = np.concatenate(true_forces, axis=0) * 1000
self.content["forces_true"] = np.reshape(true_forces, (-1,))

This can be implemented into CalibrationMetrics without an issue, but in preparing the ensemble force data reshaping is done based on the number of atoms in the dataset, and such the above change does not apply there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant