Skip to content

Conversation

@hanaol
Copy link
Collaborator

@hanaol hanaol commented Dec 16, 2025

The CHGCAR data was initially normalized by the total grid size to recover the total charge. However, to obtain a physically meaningful charge density, normalization by the cell volume is required instead. This approach is also used in the ChargE3Net model, where volume normalization is handled by VaspChargeDensity.

@hanaol hanaol requested a review from forklady42 December 16, 2025 23:44

if self.rho_type == "chgcar":
data = data.data["total"] / np.prod(data.data["total"].shape)
label = label.data["total"] / np.prod(label.data["total"].shape)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that https://github.com/jkitchin/vasp was archived, but is there another vasp library we could use, so that we're not implementing all of the normalization ourself? Does pymatgen have anything for this?

I ask because while this seems fine, it would be nice to have a standard implementation so that if the chgcar file structure changes or there are other improvements, we don't have to reimplement the density calculation ourselves.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn’t find this functionality in pymatgen. @Andrew-S-Rosen do you know of any library that automatically handles cell-volume normalization when loading a chgcar file?

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

Successfully merging this pull request may close these issues.

3 participants