scine_autocas.interfaces.molcas

Provide interface to molcas.

Currently, no Python-Bindings exist to the Molcas electronic structure programe, hence this whole folder exists. Only here implemented functionalities are supported by this interface and “pymolcas” is called via subprocess.

Classes

Molcas(molecules[, settings_dict])

Interface to the electronic structure program Molcas.

class scine_autocas.interfaces.molcas.Molcas(molecules, settings_dict=None)[source]

Interface to the electronic structure program Molcas.

Since there exists no Python interface right now, ‘pymolcas’ is called via subprocess, input files have to be written and hdf5 files have to be parsed and modified.

See also

settings

Interface.Settings

Notes

The settings object is already in the __slots__ of the base interface.

Attributes

settings

(Molcas.Settings) provides all settings for molcas

environment

(Environment) handles molcas environment variables

qc_maquis

(Qcmaquis) handles qcmaquis related files and build entropies

hdf5_utils

(MolcasHdf5Utils) handles molcas hdf5 files

orbital_file

(str) the path of the orbital file

project_name

(str) the molcas project name

dump

(bool) flag to enable dumping

dumper

(Dumper) handles dumping of molcas calculations

input_handler

(InputHandler) handles molcas input files

s1_list

(List[np.ndarray]) stores all s1_entropies from large cas calculations

s2_list

(List[np.ndarra]) stores all s2_entropies from large cas calculations

mutual_information_list

(List[np.ndarray]) stores all mutual information from large cas calculations

caspt2_energies

(List[float]) stores all caspt2 energies

class Settings(molecules, settings_dict=None)[source]

Controll the input parameters and writes input file for Molcas.

Notes

For most attributes defined here, please see also the MOLCAS manual.

Attributes

point_group

(str, default = “C1”) point group of the molecule in molcas notation

cholesky

(bool, default = True) enable cholesky decomposition

uhf

(bool, default = False) enable unrestricted hf

active_electrons

(int) number of active electrons

active_orbitals

(int) number of active orbitals

ci_root_string

(str) root string for excited states

alpha_or_beta_string

(int, default = 1) UNUSED

fiedler

(bool, default = False) enable fiedler ordering for dmrg

ipea

(float, default = 0.00) IPEA shift for CASPT2

initial_orbitals

(bool, default = True) flag to turn off hf calculations for dmrg and final calculations

only_hf

(bool, default = False) stop molcas from doing cas calculations

orbital_localisation

(bool, default = False) flag for orbital localisation

localisation_space

(str, default = “OCCUpied”) the orbital localisation space

localisation_method

(str, default = “PIPEk-Mezet”) the localisation method

n_excited_states

(int, default = 0) number of excited states

ci_size

(List[int]) size of the davidson

weights

(List[float]) weight for each state

roots

(List[int]) molcas nroots

__slots__ = ('point_group', 'cholesky', 'uhf', 'active_electrons', 'active_orbitals', 'ci_root_string', 'alpha_or_beta_string', 'fiedler', 'ipea', 'initial_orbitals', 'only_hf', 'orbital_localisation', 'localisation_space', 'localisation_method', 'ci_size', 'weights', 'roots', 'skip_scf')
__init__(molecules, settings_dict=None)[source]

Construct class.

point_group: str

point group of the molecule in Molcas notation, e.g. “”: C1 “XY”: C2 “X”: Cs “XYZ”: Ci “XY Y”: C2v “XY XYZ”: C2h “XY XZ”: D2 “XY XZ XYZ”: C2h

cholesky: bool

toggle Cholesky decomposition

uhf: bool

enable unrestricted calculation, for an uneven number of electrons it is automatically enabled

active_electrons: int

number of active electrons

active_orbitals: int

number of active orbitals, only used if no orbital file with typeindices is provided

ci_root_string: str

string of the reference determinant

alpha_or_beta_string: int

string of determinants, NOT used

fiedler: bool

enable fiedler ordering

ipea: float

IPEA shift for CASPT2, only used if CASPT2 is in method

initial_orbitals: bool

flag to turn of subsequent HF calculations

ci_size: Optional[int]

size of the davidson

roots: Optional[List[int]]

molcas nroots

weights: Optional[List[int]]

weight for each state

only_hf: bool

stop molcas from doing cas calculations

orbital_localisation: bool

enable orbital localisation

localisation_space: str

localisation space, e.g. OCCUpied, VIRTual

localisation_method: str

localisation method, e.g. PIPEk-Mezey, BOYS, EDMIston-Ruedenberg, CHOLesky, PAO

skip_scf

If true, only one SCF iteration is performed.

__doc__ = 'Controll the input parameters and writes input file for Molcas.\n\n        Attributes\n        ----------\n        point_group : str, default = "C1"\n            point group of the molecule in molcas notation\n        cholesky : bool, default = True\n            enable cholesky decomposition\n        uhf : bool, default = False\n            enable unrestricted hf\n        active_electrons : int\n            number of active electrons\n        active_orbitals : int\n            number of active orbitals\n        ci_root_string : str\n            root string for excited states\n        alpha_or_beta_string : int, default = 1\n            UNUSED\n        fiedler : bool, default = False\n            enable fiedler ordering for dmrg\n        ipea : float, default = 0.00\n            IPEA shift for CASPT2\n        initial_orbitals : bool, default = True\n            flag to turn off hf calculations for dmrg and final calculations\n        only_hf : bool, default = False\n            stop molcas from doing cas calculations\n        orbital_localisation : bool, default = False\n            flag for orbital localisation\n        localisation_space : str, default = "OCCUpied"\n            the orbital localisation space\n        localisation_method : str, default = "PIPEk-Mezet"\n            the localisation method\n        n_excited_states : int, default = 0\n            number of excited states\n        ci_size : List[int]\n            size of the davidson\n        weights : List[float]\n            weight for each state\n        roots : List[int]\n            molcas nroots\n\n        Notes\n        -----\n        For most attributes defined here, please see also the MOLCAS manual.\n        '
__module__ = 'scine_autocas.interfaces.molcas'
__slots__ = ('environment', 'qc_maquis', 'hdf5_utils', 'orbital_file', 'project_name', 'dump', 'dumper', 'input_handler', 's1_list', 's2_list', 'mutual_information_listcaspt2_energies')
__init__(molecules, settings_dict=None)[source]

Construct a molcas interface.

Parameters
moleculeMolecule

contains molecular information

settings_dictDict[str, Any], optional

holds all settings provided by a yaml input

See also

settings_dict

InputHandler

settings: scine_autocas.interfaces.Interface.Settings

provides all settings for molcas

qc_maquis: scine_autocas.interfaces.qcmaquis.Qcmaquis

builds s1, s2 and Ipq from QCMaquis HDF5 files

hdf5_utils: scine_autocas.interfaces.molcas.molcas_hdf5_utils.MolcasHdf5Utils

handles Molcas HDF5 files

mutual_information_listcaspt2_energies
__doc__ = "Interface to the electronic structure program Molcas.\n\n    Since there exists no Python interface right now, 'pymolcas' is\n    called via subprocess, input files have to be written and hdf5 files\n    have to be parsed and modified.\n\n    Attributes\n    ----------\n    settings : Molcas.Settings\n        provides all settings for molcas\n    environment : Environment\n        handles molcas environment variables\n    qc_maquis : Qcmaquis\n        handles qcmaquis related files and build entropies\n    hdf5_utils : MolcasHdf5Utils\n        handles molcas hdf5 files\n    orbital_file : str\n        the path of the orbital file\n    project_name : str\n        the molcas project name\n    dump : bool\n        flag to enable dumping\n    dumper : Dumper\n        handles dumping of molcas calculations\n    input_handler : InputHandler\n        handles molcas input files\n    s1_list : List[np.ndarray]\n        stores all s1_entropies from large cas calculations\n    s2_list : List[np.ndarra]\n        stores all s2_entropies from large cas calculations\n    mutual_information_list : List[np.ndarray]\n        stores all mutual information from large cas calculations\n    caspt2_energies : List[float]\n        stores all caspt2 energies\n\n    Notes\n    -----\n    The settings object is already in the __slots__ of the base interface.\n\n    See Also\n    --------\n    settings : Interface.Settings\n    "
__module__ = 'scine_autocas.interfaces.molcas'
orbital_file: str

name of the orbital file, which has to be modified to enable Molcas “Typeindex”

project_name: str

name of the project

dump: bool

allows to dump all calculations in a separate directory

dumper: Optional[Any]

controls the dumping of calculations by creating a directory structure

input_handler: scine_autocas.interfaces.molcas.input_handler.InputHandler

handles molcas input files

s1_list: List[numpy.ndarray]

stores all s1_entropies from large cas calculations

s2_list: List[numpy.ndarray]

stores all s2_entropies from large cas calculations

mutual_information_list: List[numpy.ndarray]

stores all mutual information from large cas calculations

caspt2_energies: Optional[List[float]]

stores all caspt2 energies

environment: scine_autocas.interfaces.molcas.environment.Environment

coltrols the enviroment for Molcas

make_ci_root(n_roots=None, ci_size=None, roots=None, weights=None)[source]

Make the ci root string for excited state calculations.

Parameters
n_rootsint

number of roots

ci_sizeList[int]

size of ci matrix in davidson

rootsList[int]

roots to use for calculation

weightsList[float]

weight of each root

Returns
root_stringstr

The full ci_root string, required for excited state calculations

check_calculate_input(cas_occupation=None, cas_indices=None)[source]

Check the input for the calculate function.

Parameters
cas_occupation:List[int], optional

a list which contains the occupation of each orbital in the active space

cas_indices:List[int], optional

a list which contains the indice of each orbital in the active space

Returns
cas_occupation:List[int]

a list which contains the occupation of each orbital in the active space

cas_indices:List[int]

a list which contains the indice of each orbital in the active space

Raises
ValueError

if different number of occupations and indices

rtype

Tuple[List[int], List[int]] ..

set_cas_variables(cas_occupation)[source]

Set spin_multiplicity, active_electrons, active_orbitals.

Parameters
cas_occupationList[int]

a list which contains the occupation of each orbital in the active space

run_molcas()[source]

Run molcas, from current state.

The function calls the molcas binary through a subprocess

reorder_indices_from_symmetry(cas_indices)[source]

Reorder cas indices based on mo energies.

Molcas changes the index order for calculations exploiting point group symmetry. Hence, these indices have to be reordered to fit entropies and other variables.

Parameters
cas_indicesList[int], optional

a list which contains the indice of each orbital in the active space

Returns
cas_indices_symList[int], optional

a list which contains the indice of each orbital in the active space

Raises
ValueError

if no MO energies can be read by the MolcasHdf5Utils instance

rtype

List[int] ..

run_initial_orbitals()[source]

Generate initial orbitals.

reorder_measurements_for_symmetry(cas_indices)[source]

Reorder dmrg measurements with respect to cas indices.

If point group symmetry is used, the measurements usually are in an different order than the indices. Hence, this function is used to reorder them.

Parameters
cas_indicesList[int], optional

a list which contains the indice of each orbital in the active space

calculate(cas_occupation=None, cas_indices=None)[source]

Calculate a system with the correpsonding setting.

If symmetry is enabled the cas_occupation and cas_indices are still expected to be ordered symmetry independent. Also the s1, s2 and mutual information matrices are reordered to be symmetry indipenedent.

Parameters
cas_occupationList[int], optional

a list which contains the occupation of each orbital in the active space

cas_indicesList[int], optional

a list which contains the indice of each orbital in the active space

Returns
energyUnion[float, np.ndarray]

energy, or enery for each state

s1Union[np.ndarray, List[np.ndarray]]

single orbital entropy, or s1 for each state

s2Union[np.ndarray, List[np.ndarray]]

two orbital entropy, or s2 for each state

mutual_informationUnion[np.ndarray, List[np.ndarray]]

mutual information, or mutual information for each state

rtype

Tuple[Union[float, ndarray], Union[ndarray, List[ndarray]], Union[ndarray, List[ndarray]], Union[ndarray, List[ndarray]]] ..

make_dmrg_measurements()[source]

Build all entropies from QCMaquis HDF5 file.

_convert_type_indices(type_indices)[source]
get_caspt2_from_log(file_name)[source]

Get energy from molcas log.

Currently used for CASPT2.

analyze(qcmaquis_result_file=None, molcas_hdf5_file=None)[source]

Analyze output files.

Return type

Union[Tuple[ndarray, ndarray, ndarray, List[int], List[int]], Tuple[List[int], List[int]], Tuple[ndarray, ndarray, ndarray]]

resource_estimate()[source]

Estimate if DMRG is feasible.

Modules

scine_autocas.interfaces.molcas.dumper

Takes care of dumping molcas related data.

scine_autocas.interfaces.molcas.environment

The Molcas environment.

scine_autocas.interfaces.molcas.input_handler

Handle molcas input.

scine_autocas.interfaces.molcas.molcas_hdf5_utils

Modify Molcas Hdf5 files.