Note: if I try to remove the “r” before the directory path, it just gives me a unicode error.
EDIT: I made it a “Molecule.from_file” and I am not getting the error anymore. However, I am still struggling because I need to make it a Structure for rdfpy.
Hi @mcb19, xyz files aren’t typically used to represent materials with periodic boundary conditions because they lack information about the crystal lattice (direct lattice vectors). They’re more-often used to represent molecules. Pymatgen’s Structure won’t parse xyz files, but its Molecule will.
To make a structure, you’d need to do something like the following:
from pymatgen.core import Structure, Molecule, Lattice
mol = Molecule.from_file("C:/Users/bnzmi/OneDrive\ -\ Northeastern University/Lustig Lab/RDF Attempts/hybrid7-pos-1.xyz")
a = 15
b = 15.1
c = 15.2
structure = Structure(
Lattice([[a, 0., 0.], [0., b, 0.], [0., 0., c]]),
species=mol.species,
coords=mol.cart_coords,
coords_are_cartesian=True
)
In that example, the molecule is placed into a large orthorhombic box to reduce the influence of periodic images of the molecule when calculating things like the RDF or electronic structure.
The unicode errors are probably because of issues with parsing space and hyphen characters in the path. If you cd into that local directory and run the same python script without any of the leading path, it might work OK.