[ase-users] Read only atom positions from CHGCAR file

Tristan Maxson tgmaxson at gmail.com
Tue May 16 04:25:19 CEST 2017


​​​While this is a somewhat strange request initially (If you can make a
CHGCAR you probably have the POSCAR which would be far easier to use), the
solution is actually fairly trivial.​  Thankfully VASP follows the same
file format for CHGCAR and POSCAR and ASE happens to gracefully ignore the
rest of the file.

Can you try to do the following?

from ase.io import read
atoms = read("CHGCAR", format="vasp")

Thank you,
Tristan Maxson



On Mon, May 15, 2017 at 8:36 AM, fabian via ase-users <
ase-users at listserv.fysik.dtu.dk> wrote:

> Dear all
>
> Ist it possible to directly only read the atomic positions from a CHGCAR
> file?
>
>
> from ase.calculators.vasp import VaspChargeDensityfrom ase.io import read, writefrom ase.atoms import Atoms
>
> CHGDATA = VaspChargeDensity('CHGCAR')
> atoms = CHGDATA.atoms
>
> does work but
>
>
> atoms = VaspChargeDensity.atoms('CHGCAR')
>
>
> does not work obviously. I would like to avoid to read the complete and large CHGCAR file for
> a small script i am working on.
>
> All the best
>
> Fabian
>
>
>
>
>
>
>
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20170515/4d2d8544/attachment.html>


More information about the ase-users mailing list