Skip to content

generic ReadFile method #6

@corinwagen

Description

@corinwagen

Right now if you want to write a script that reads in a variety of file types (e.g. Gaussian, Orca, etc), you have to do so in a loop:

mol = None
if filename.endswith(".inp"):
    mol = cctk.OrcaFile.read_file(filename).get_molecule()
elif filename.endswith(".gjf"):
    mol = cctk.GaussianFile.read_file(filename).get_molecule()
elif condition
    ...

It might be nice to write a function which simply takes in a file, tries all the methods (semi-intelligently), and then returns an object. Maybe you could choose between a method which always returns a File object and a method which always returns a Molecule object, reusing the same internals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions