Exemple #1
0
def create_dict_CGFs(path_hdf5: dict,
                     basis_name: str,
                     mol: List,
                     package_name='cp2k',
                     package_config: Dict = None):
    """
    Try to read the basis from the HDF5 otherwise read it from a file and store
    it in the HDF5 file. Finally, it reads the basis Set from HDF5 and
    calculate the CGF for each atom.

    :param path_hdf5: Path to the HDF5 file that contains the
    numerical results.
    type path_hdf5: String
    :param basisname: Name of the Gaussian basis set.
    :type basisname: String
    :param xyz: List of Atoms.
    :type xyz: [nac.common.AtomXYZ]
    """
    functions = {'cp2k': cp2k2hdf5, 'turbomole': turbomole2hdf5}

    basis_location = join(package_name, 'basis')
    with h5py.File(path_hdf5) as f5:
        if basis_location not in f5:
            # Search Path to the file containing the basis set
            pathBasis = package_config["basis"]
            keyBasis = InputKey("basis", [pathBasis])
            # Store the basis sets
            functions[package_name](f5, [keyBasis])

        # CGFs in Cartesian coordinates
        cgfs = create_normalized_CGFs(f5, basis_name, package_name, mol)

    return cgfs
Exemple #2
0
def create_dict_CGFs(f5, packageHDF5, pathBasis, basisname, packageName, xyz):
    """
    If the Cp2k Basis are already stored in the hdf5 file continue,
    otherwise read and store them in the hdf5 file
    """
    keyBasis = InputKey("basis", [pathBasis])
    packageHDF5(f5, [keyBasis])   # Store the basis sets
    return create_normalized_CGFs(f5, basisname, packageName, xyz)
def saveBasis(f5, path_basis, softName):

    keyBasis = InputKey("basis", [path_basis])

    if softName == 'cp2k':
        cp2k2hdf5(f5, [keyBasis])

    elif softName == 'turbomole':
        turbomole2hdf5(f5, [keyBasis])
def test_store_basisSet():
    """
    Check if the turbomole basis set are read
    and store in HDF5 format.
    """
    keyBasis = InputKey("basis", [path_basis])
    with h5py.File(path_hdf5) as f5:
        turbomole2hdf5(f5, [keyBasis])
        if not f5["turbomole/basis"]:
            assert False
def save_basis_to_hdf5(config: dict, package_name: str = "cp2k") -> None:
    """
    Store the specification of the basis set in the HDF5 to compute the integrals
    """
    basis_location = join(package_name, 'basis')
    with h5py.File(config["path_hdf5"]) as f5:
        if basis_location not in f5:
            # Search Path to the file containing the basis set
            path_basis = pkg_resources.resource_filename(
                "nac", "basis/BASIS_MOLOPT")
            keyBasis = InputKey("basis", [path_basis])
            cp2k2hdf5(f5, [keyBasis])
Exemple #6
0
def dump_MOs_coeff(handle_hdf5, packageHDF5, path_MO, pathEs, pathCs,
                   nOrbitals):
    """
    MO coefficients are stored in row-major order, they must be transposed
    to get the standard MO matrix.
    :param files: Files to calculate the MO coefficients
    :type  files: Namedtuple (fileXYZ,fileInput,fileOutput)
    :param job: Output File
    :type  job: String
    """
    key = InputKey('orbitals', [path_MO, nOrbitals, pathEs, pathCs])

    packageHDF5(handle_hdf5, [key])

    return pathEs, pathCs
def dump_MOs_coeff(handle_hdf5, path_es, path_css, number_of_orbs,
                   number_of_orb_funs):
    """
    MO coefficients are stored in row-major order, they must be transposed
    to get the standard MO matrix.
    :param files: Files to calculate the MO coefficients
    :type  files: Namedtuple (fileXYZ,fileInput,fileOutput)
    :param job: Output File
    :type  job: String
    """
    key = InputKey(
        'orbitals',
        [path_MO, number_of_orbs, number_of_orb_funs, path_es, path_css])

    turbomole2hdf5(handle_hdf5, [key])

    return path_es, path_css