Chemistry data files (chemistry_files.chemistry_datafile)

Internal format for the storage of data.

exception qcip_tools.chemistry_files.chemistry_datafile.BadChemistryDataFile
class qcip_tools.chemistry_files.chemistry_datafile.ChemistryDataFile

A file to save quantum chemistry data: geometry and derivatives.

  • self.molecule: the molecule (qcip_tools.molecule.Molecule)

  • self.spacial_dof: spacial degree of freedom = 3N (int)

  • self.trans_plus_rot_dof: either 5 or 6 (int)

  • self.title: the title (str)

  • self.derivatives: derivatives of the energy (dict): the key is a representation of the derivative, the value is either a Tensor, or a dict in case of electrical derivatives. This new dict is subdivided into the different frequencies.

    + "F"
        + "static" : ElectricDipole
    + "FF":
        + "static" : PolarizabilityTensor
    + "FD":
        + "0.042" : PolarizabilityTensor
        + ...
    + "FDD":
        + "static" : FirstHyperpolarizabilityTensor
        + ...
    + "G": BaseGeometricalDerivativeTensor
    + "GG": BaseGeometricalDerivativeTensor
    + ...
    

Internally, use a h5py.File, with:

  • /title (str) to store the title

  • /molecule/charge_and_multiplicity (2 int), /molecule/atoms (5xn array of floats: Z number, mass, position),

  • /derivatives with a derivatives_available attribute (str, comma separated list), and /derivatives/XXXX (array of floats, one for each derivatives), with a frequencies attribute to give the frequencies if required.

classmethod attempt_identification(f)

it is an h5 file, and some specific datasets

file_type = 'QCIP_CDF'

The identifier

classmethod from_molecule(molecule, title='', *args, **kwargs)

Create an object out of a molecule

Parameters:

molecule (qcip_tools.molecule.Molecule) – the molecule

Return type:

WithMoleculeMixin

classmethod possible_file_extensions()

Return the common extention of this kind of files

Return type:

list

read(f)
Parameters:

f (file) – File

static read_derivative_from_dataset(dataset, derivative)

Read a derivative from a dataset

Parameters:
Return type:

numpy.ndarray

static read_derivatives_from_group(group, spacial_dof)

Read all the derivatives from a given group

Parameters:
  • group (h5py.Group) – the group

  • spacial_dof (int) – the DOF

Return type:

dict

static write_derivative_in_dataset(group, dataset_name, derivative, value)

Write a given derivative in a dataset (sadly, a dataset cannot be simply resized when created, so the dataset name is given)

Parameters:
  • group (h5py.Group) – the group

  • dataset_name (str) – dataset name

  • derivative (derivatives.Derivative) – the derivative

  • value – tensor

Type:

numpy.ndarray

static write_derivatives_in_group(group, derivatives_, spacial_dof)

Write all the derivatives in a given group

Parameters:
  • group (h5py.Group) – the group

  • derivatives (dict) – the derivatives to write

  • spacial_dof (int) – the DOF

qcip_tools.chemistry_files.chemistry_datafile.chemistry_datafile__property__electrical_derivatives(obj, *args, **kwargs)

Get electrical derivatives. Returns a dictionary of dictionaries:

+ "F"
    + static : ElectricDipole
+ "FF":
    + static : PolarizabilityTensor
+ "FD":
    + 0.042 : PolarizabilityTensor
    + ...
+ "FDD":
    + static : FirstHyperpolarizabilityTensor
    + ...
+ ...
Parameters:

obj (qcip_tools.chemistry_files.chemistry_datafile.ChemistryDataFile) – object

Return type:

dict

qcip_tools.chemistry_files.chemistry_datafile.chemistry_datafile__property__geometrical_derivatives(obj, *args, **kwargs)

Get geometrical derivatives. Returns a dictionary of dictionaries:

+ "G": BaseGeometricalDerivativeTensor
+ "GG": BaseGeometricalDerivativeTensor
Parameters:

obj (qcip_tools.chemistry_files.chemistry_datafile.ChemistryDataFile) – object

Return type:

dict