cctk.OrcaFile

class cctk.OrcaFile(job_types, ensemble=None, header=None, variables=None, blocks=None)[source]

Bases: File

Generic class for all Orca .inp and .out files.

ensemble

ConformationalEnsemble instance

Type:

ConformationalEnsemble

job_types

list of OrcaJobType instances

Type:

list

header

keyword line or lines

Type:

str

variables

list of variables to specify (e.g. {"maxcore": 2000}).

Type:

dict

blocks

list of blocks to change specific settings In general, the key should be the block name and the value should be a list of desired lines. For instance, configuring a time-dependent DFT job might look like {"tddft": ["maxdim 5", "nroots 50"]}

Type:

dict

successful_terminations

number of successful terminations

Type:

int

elapsed_time

total time for job in seconds

Type:

float

__init__(job_types, ensemble=None, header=None, variables=None, blocks=None)[source]

Methods

__init__(job_types[, ensemble, header, ...])

append_to_file(filename, text)

Appends output text to a file.

check_has_properties()

Checks that the file has all the appropriate properties for its job types, and raises ValueError if not.

get_molecule([num])

Returns the last molecule (from an optimization job or other multi-molecule jobs) or the only molecule (from other jobs).

imaginaries()

Returns the imaginary frequencies, rounded to the nearest integer.

num_imaginaries()

Returns the number of imaginary frequencies.

read_file(filename)

Reads a file and parses into lines.

write_file(filename[, molecule, header, ...])

Write a .inp file, using object attributes.

write_molecule_to_file(filename, molecule, ...)

Write an .inp file using the given molecule.

static append_to_file(filename, text)

Appends output text to a file.

Parameters:
  • filename (str) – path to file, including name (e.g. path/to/input.gjf)

  • text (str) – desired contents of file

Returns:

True if write succeeded, False otherwise

check_has_properties()[source]

Checks that the file has all the appropriate properties for its job types, and raises ValueError if not.

This only checks the last molecule in self.ensemble, for now.

get_molecule(num=None)[source]

Returns the last molecule (from an optimization job or other multi-molecule jobs) or the only molecule (from other jobs).

If num is specified, returns that job (1-indexed for positive numbers). So job.get_molecule(3) will return the 3rd element of job.molecules, not the 4th.

imaginaries()[source]

Returns the imaginary frequencies, rounded to the nearest integer.

num_imaginaries()[source]

Returns the number of imaginary frequencies.

classmethod read_file(filename)[source]

Reads a file and parses into lines.

Parameters:

filename (str) – The path to the file.

Returns:

A list containing all the lines in the file.

write_file(filename, molecule=None, header=None, variables=None, blocks=None)[source]

Write a .inp file, using object attributes. If no header is specified, the object’s header will be used.

Parameters:
  • filename (str) – path to the new file

  • molecule (int) – which molecule to use – passed to self.get_molecule(). Default is -1 (e.g. the last molecule), but positive integers will select from self.ensemble.molecules (0-indexed). A Molecule object can also be passed, in which case that molecule will be written to the file.

  • header (str) – header for new file

classmethod write_molecule_to_file(filename, molecule, header, variables={'maxcore': 2000}, blocks={'pal': ['nproc 16']}, print_symbol=False)[source]

Write an .inp file using the given molecule.

Parameters:
  • filename (str) – path to the new file

  • molecule (Molecule) – which molecule to use – a Molecule object.

  • header (str) – header for new file

  • print_symbol (Bool) – if atomic symbols should be printed instead of atomic numbers