pele.utils.xyz#

Module source

tools for reading from and writing to .xyz files

pele.utils.xyz.read_xyz()[source]

Source

def read_xyz(fin):

read a xyz file from file handle

Parameters:
finfile handle

file to read from

Returns:
finopen file
xyznamedtuple

returns a named tuple with coords, title and list of atomtypes.

See also

write_xyz
pele.utils.xyz.write_xyz()[source]

Source

def write_xyz(fout, coords, title="", atomtypes=("A",)):

write a xyz file from file handle

Writes coordinates in xyz format. It uses atomtypes as names. The list is cycled if it contains less entries than there are coordinates,

One can also directly write xyz data which was generated with read_xyz.

>>> xx = read_xyz("in.xyz")
>>> write_xyz(open("out.xyz", "w"), *xx)
Parameters:
foutan open file
coordsnp.array

array of coordinates

titletitle section, optional

title for xyz file

atomtypesiteratable

list of atomtypes.

See also

read_xyz