0

提取原子坐标列表的语法是什么,[[x1, y1, z1], [x2, y2, z2], ...] 和原子种类列表,例如。[1,1,1,1,...] 来自 pymatgen 结构对象?

4

2 回答 2

1

这是一个很老的问题,但如果您(或其他人)需要答案,请按如下方式进行:

from pymatgen.core.structure import Structure, Lattice

structure = Structure(lattice, atoms, coords)#some structure

coordinates = []
species = []

for s in structure:
        coordinates.append(s.coords) #cartesian coordinates
        #coordinates.append(s.frac_coords) #would give fractional coordinates instead
        species.append(s.specie.Z)
        #species.append(s.specie) #would give strings (e.g. "Fe") instead of atomic number

print(coordinates)
print(species)
于 2019-10-16T00:30:52.673 回答
0

从 pymatgen 导入结构对象

from pymatgen import Structure

从 .cif 文件中读取 cif 结构

structure_from_cif = Structure.from_file('mp-773116La20S29O.cif')

获取坐标

cartesian_coords = structure_from_cif.cart_coords

要获得物种,您可以执行以下操作

for i in structure_from_cif.species:
    print(i)
于 2019-10-22T19:22:25.280 回答