[yt-users] Import of crystallographic charge density data

Matthew Horton mkhorton at lbl.gov
Mon Mar 27 15:50:41 PDT 2017

Hello all,

I’m a new user to yt looking for some general guidance.

1. I have files describing the charge density in a crystal (CHGCAR files for any DFT/VASP users on the mailing list). I can import these with yt as generic (periodic) unigrid data, however the axes are not always orthogonal… In cubic crystals, `yt.load_uniform_grid` works perfectly, but in some crystals this would give a distorted visualization. What would be the best way to import this kind of data?

2. Regarding units, the units in my file are nominally fractional electrons per grid cell volume, e/Angstrom^3 … importing into yt as a density field, what units should I use? Would be good to keep the data in its natural units, rather than converting to SI/cgs, because they’d be very very small floats otherwise.

I tried 'unit_system = yt.UnitSystem('custom', 'Angstrom', 'g', 's’)' and this works as expected for the length units in my plots, but how do I set the custom Charge unit? What ‘units’ string would I then use for the density field? It doesn’t seem to want to accept ‘Angstrom’, ‘C’ etc.

Many thanks for any help!

Best regards,


More information about the yt-users mailing list