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

Suggestion for read and transform trajectory #10

Open
JianxingHuang opened this issue Jun 4, 2020 · 0 comments
Open

Suggestion for read and transform trajectory #10

JianxingHuang opened this issue Jun 4, 2020 · 0 comments

Comments

@JianxingHuang
Copy link

It takes quite a long time to read and transfrom the 'trajectory.xyz' file. I would suggest to use the method provided by pymatgen/ase, which is faster. The code example is shown below:

from ase.io import read, write  
import numpy as np
from pymatgen.io.ase import AseAtomsAdaptor
from ase import Atoms
from pymatgen.io.lammps.outputs import parse_lammps_dumps
confs = parse_lammps_dumps('trajectory.xyz') # this is a generator
symbols = ['La'] *24 +['Zr'] * 16 + ['O'] *96 + ['Li']*56
ats = [Atoms(symbols=symbols, positions=conf.data.values[:, :3],
             cell=conf.box.to_lattice().matrix, pbc=True) for conf in confs]
write('LLZO.xyz', ats)
ats = read('LLZO.xyz', ':100')

Besides, I suggest to rename the 'trajectory.xyz' as 'dump.trajectory'. For it is more like a lammps-dump output rather than '.xyz' type file. Because '.xyz' hints the user to use ase.io.read to load the data.

@JianxingHuang JianxingHuang changed the title Suggestion for read and transform trajectory Suggestion for read and transform trajectory ~enhancement Jun 4, 2020
@JianxingHuang JianxingHuang changed the title Suggestion for read and transform trajectory ~enhancement Suggestion for read and transform trajectory \ Jun 4, 2020
@JianxingHuang JianxingHuang changed the title Suggestion for read and transform trajectory \ Suggestion for read and transform trajectory Jun 4, 2020
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