scine_autocas.interfaces

Module to provide the Interface base class, required for each interface.

Each interface is required to inherite from this class, to be able to be used for an autocas calculation.

Classes

Interface(molecules[, settings_dict])

The base class for all Interfaces.

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

The base class for all Interfaces.

An Interface is an interface to a corresponding program, which creates inputs, runs the program, reads outputs and converts these into autoCAS compatible containers.

Attributes

settings

(Settings) handles settings of an interface and defines required settings

dumper

(Union[Dumper, Any]) provides the ability to dump calculation

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

The settings class for all Interfaces.

An instance of Settings controls the input parameters for the underlying electronic structure program.

Notes

The string for method and post_cas_method are stripped from characters, to prevent misspellings. Removed characters are: ” “, “-”, “_”, “/”, “.” Additionally the string are cast to uppercase, to further prevent misspellings.

Attributes

basis_set

(str, default = “cc-pvdz”) basis set for a calculation

spin_multiplicity

(int) the spin multiplicity of the molecule

charge

(int) the total charge of the molecule

dmrg_sweeps

(int) the number of dmrg sweeps

dmrg_bond_dimension

(int) the dmrg bond dimension

xyz_file

(str) path to the xyz file

method

(str) the active space method to use

post_cas_method

(str) the post cas method to use

work_dir

(str) the work dir of the electronic structure program

class Methods(value)[source]

Enum class for all methods.

This class is a base class for CasMethods and PostCasMethods.

classmethod has(key)[source]

Check if method is part of class.

A method is part of a class, if it is defined in the corresponding enum. This function also stripps the input key from some special characters and casts it to uppercase to prevent misspellings.

Parameters
keystr

method string

Returns
str

if method is in enum class, return the key, else an empty string

rtype

str ..

classmethod key_value(key)[source]

Return the value of the method if key exists in enum.

Parameters
keystr

method string

Returns
Union[int, bool]

The value if method is in enum class, False otherwise

rtype

int ..

__doc__ = 'Enum class for all methods.\n\n            This class is a base class for CasMethods and\n            PostCasMethods.\n            '
__module__ = 'scine_autocas.interfaces'
class CasMethods(value)[source]

Stores all possible CAS methods.

Even numbers correspond to methods with orbital optimization, e.g. DMRGSCF and CASSCF and odd numbers to methods without orbital optimization like DMRGCI and CASCI. Numbers lower than 100 correspond to CI methods, e.g. CASCI and CASSCF and higher numbers to DMRG methods like DMRGCI and DMRGSCF.

CASCI = 1
CASSCF = 2
DMRGCI = 101
DMRGSCF = 102
SRDFTLRDMRGCI = 1001
SRDFTLRDMRGSCF = 1002
__doc__ = 'Stores all possible CAS methods.\n\n            Even numbers correspond to methods with orbital\n            optimization, e.g. DMRGSCF and CASSCF and odd numbers to\n            methods without orbital optimization like DMRGCI and CASCI.\n            Numbers lower than 100 correspond to CI methods, e.g. CASCI\n            and CASSCF and higher numbers to DMRG methods like DMRGCI\n            and DMRGSCF.\n            '
__module__ = 'scine_autocas.interfaces'
class PostCasMethods(value)[source]

Store all possible post-CAS methods.

CASPT2 = 1
NEVPT2 = 2
__doc__ = 'Store all possible post-CAS methods.'
__module__ = 'scine_autocas.interfaces'
__slots__ = ('basis_set', 'spin_multiplicity', 'charge', 'dmrg_sweeps', 'dmrg_bond_dimension', 'xyz_file', 'method', 'post_cas_method', 'work_dir', 'n_excited_states')
__init__(molecules, settings_dict=None)[source]

Construct a settings object.

This is just the constructor of the base class. To use it, it needs to be called by super().__init__(molecules=molecules, settings_dict=settings_dict)

Parameters
moleculeMolecule

the molecule object provides all required information of the molecular system.

settings_dictDict[str, Any], optional

a dict, usually provided by the input_handler, which stores attributes and corresponding values

See also

settings_dict

InputHandler

basis_set: str

basis set for the calculation

spin_multiplicity: int

spin multiplicity of the system

charge: int

total charge of the system

dmrg_sweeps: int

number of sweeps in a DMRG calculation

dmrg_bond_dimension: int

maximal bond dimension (m) in a DMRG calculation

xyz_file: str

path to the XYZ file

method: str

defines the method used to evaluate the initial active space

post_cas_method: str

defines post-CAS methods like CASPT2 and NEVPT2

work_dir: str

defines the working directory where produced data is stored

__doc__ = 'The settings class for all Interfaces.\n\n        An instance of Settings controls the input parameters for the\n        underlying electronic structure program.\n\n        Attributes\n        ----------\n        basis_set : str, default = "cc-pvdz"\n            basis set for a calculation\n        spin_multiplicity : int\n            the spin multiplicity of the molecule\n        charge : int\n            the total charge of the molecule\n        dmrg_sweeps : int\n            the number of dmrg sweeps\n        dmrg_bond_dimension : int\n            the dmrg bond dimension\n        xyz_file : str\n            path to the xyz file\n        method : str\n            the active space method to use\n        post_cas_method : str\n            the post cas method to use\n        work_dir : str\n            the work dir of the electronic structure program\n\n        Notes\n        -----\n        The string for method and post_cas_method are stripped from characters,\n        to prevent misspellings. Removed characters are:\n        " ", "-", "_", "/", "."\n        Additionally the string are cast to uppercase, to further prevent misspellings.\n        '
__module__ = 'scine_autocas.interfaces'
n_excited_states: int

the number of excited states to calculate

apply_settings(settings)[source]

Apply settings from a dict.

The dict can come from an Inputhandler instance.

Parameters
settings: Dict[str, Any]

stores class attributes as string and the corresponding values

__dict__ = mappingproxy({'__module__': 'scine_autocas.interfaces', '__doc__': 'The base class for all Interfaces.\n\n    An Interface is an interface to a corresponding program, which\n    creates inputs, runs the program, reads outputs and converts these\n    into autoCAS compatible containers.\n\n    Attributes\n    ----------\n    settings : Settings\n        handles settings of an interface and defines required settings\n    dumper : Union[Dumper, Any]\n        provides the ability to dump calculation\n    ', 'Settings': <class 'scine_autocas.interfaces.Interface.Settings'>, '__init__': <function Interface.__init__>, 'calculate': <function Interface.calculate>, 'resource_estimate': <function Interface.resource_estimate>, 'get_orbital_map': <function Interface.get_orbital_map>, '__dict__': <attribute '__dict__' of 'Interface' objects>, '__weakref__': <attribute '__weakref__' of 'Interface' objects>, '__annotations__': {'dumper': 'Optional[Any]', 'settings': 'Interface.Settings'}})
__doc__ = 'The base class for all Interfaces.\n\n    An Interface is an interface to a corresponding program, which\n    creates inputs, runs the program, reads outputs and converts these\n    into autoCAS compatible containers.\n\n    Attributes\n    ----------\n    settings : Settings\n        handles settings of an interface and defines required settings\n    dumper : Union[Dumper, Any]\n        provides the ability to dump calculation\n    '
__module__ = 'scine_autocas.interfaces'
__weakref__

list of weak references to the object (if defined)

__init__(molecules, settings_dict=None)[source]

Construct Interface from a molecule.

This is just the constructor of the base class. To use it, it needs to be called by super().__init__(molecules=molecules, settings_dict=settings_dict)

Parameters
dumper: Dumper, optional

if a dumper is provided in the main class it can be used

settings: Settings

the settings of the interface.

dumper: Optional[Any]

if a dumper is provided in the main class it can be used

settings: scine_autocas.interfaces.Interface.Settings

contains information on the input of the electronic structure program

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

DMRG calculations including orbitals corresponding to cas_indices and electrons corresponding to occupations.

Parameters
cas_occupations: List[int], optional

contains the occupation for each spatial orbital. 2: doubly occupied, 1: singly occupied, 0: virtual

cas_indices: List[int], optional

contains the indices of the orbitals for the CAS calculation

Notes

Either cas_occupations and cas_indices is provided and a CAS calculation is started, or if none are provided a plain HF calculation is started. This function must be implemented by the corresponding interface.

Return type

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

resource_estimate()[source]

Estimate resources for the calculation.

get_orbital_map()[source]

Getter for an orbital map in terms of orbital groups, e.g, [

[[3, 4, 5], [3, 4, 6]], [[6], [5]], [[7], [7]], …

] This list means that the orbitals 3, 4, and 5 of the first system are mapped to the orbitals 3, 4, and 6 of the second system. The orbital 6 of system 1 is mapped to orbital 5 of system 2, and the orbital 7 of system 1 is mapped to the orbital 7 of system 2.

Modules

scine_autocas.interfaces.molcas

Provide interface to molcas.

scine_autocas.interfaces.qcmaquis

Module to handle qcmaquis output files.

scine_autocas.interfaces.serenity

Provide interface to Serenity.