code: def from_file(cls, filename, constant_lattice=True, **kwargs):
          
          # TODO: Support other filetypes
  
          fname = os.path.basename(filename)
          if fnmatch(fname, "*XDATCAR*"):
              structures = Xdatcar(filename).structures
          elif fnmatch(fname, "vasprun*.xml*"):
              structures = Vasprun(filename).structures
          else:
              raise ValueError("Unsupported file")
  
          return cls.from_structures(structures, constant_lattice=constant_lattice, **kwargs)
docs: Convenience constructor to obtain trajectory from XDATCAR or vasprun.xml file
  
          Args:
              filename (str): The filename to read from.
              constant_lattice (bool): Whether the lattice changes during the simulation, such as in an NPT MD
                  simulation. True results in
  
          Returns:
              (Trajectory)