objects#
Module defining the main classes used to access orbital data.
Data is organised hierarchically. The top-level Orbitals objects provide access to the FMOs and MOs objects, which provide access to individual FMO and MO objects.
The Orbitals objects serves as the loader of the calculation results.
Typical usage example:
orbs = Orbitals(‘path/to/adf.rkf’)
- class FMO(data, parent)[source]#
Bases:
OrbitalClass holding data specifically for symmetry-adapted fragment orbitals.
Each
FMOholds the following data that can be accessed like attributes.Variable
Type
Description
indexintnamestrThe regular name of this
FMOas it would show up in ADFLevels.symmetrystrThe irreducible representation this
FMObelongs to.symmetry_indexintThe index of this
FMOin the overalFMOsthat belong to the same irreducible representation.fragmentstrThe name of the fragment the
FMObelongs to.fragment_uniquestrIf fragments do not have unique names (i.e. with atomic fragments) this name will be unique for the atom.
fragment_indexintspinstrThe spin of this
FMO, either'A','B'or'AB'energyfloatThe regular energy of the
FMOin \(\text{kcal mol}^{-1}\).approx_effective_energyfloatApproximated diagonal element of the Fock matrix belonging to the
FMOin \(\text{kcal mol}^{-1}\). This is available even if the Fock matrix cannot be read from the calculation.effective_energyfloatThe diagonal element of the Fock matrix belonging to the
FMOin \(\text{kcal mol}^{-1}\) if it could be read from the calculation.effective_energy_SCF0floatThe diagonal element of the Fock matrix after 0 SCF cycles belonging to the
FMOin \(\text{kcal mol}^{-1}\) if it could be read from the calculation.occupationintThe occupation number of this
FMO. Either0,1,2, or a fractional value if the electronic configuration is non-aufbau.occupiedboolWhether the
FMOhas electrons in it.gross_populationfloatThe gross Mulliken population of this
FMO.gross_spinfloatThe gross Mulliken spin population of this
FMO.moleculeplams.MoleculeThe molecule object containing the atoms belonging to the fragment of this
FMO.- coefficient(other)[source]#
Get the coefficient of this
FMOinto anMO.- Parameters:
other (
MO) – the orbital to get the coefficient with.- Return type:
float
- cube_file(gridsize='medium', overwrite=False, cube_file_prefix=None, preambles=[], grid_around_mol=None, gridextend=6)#
Generate a cube-file for this
Orbitalwith a certain grid-size.- Parameters:
gridsize (
str) – the size of the grid to generate the cube-file with.overwrite (
bool) – whether to overwrite the previous calculation if found.cube_file_prefix (
str) – prefix for the cube file path.
See also
Orbital.draw()to draw and open a TCviewer screen showing thisOrbital.Orbital.screenshot()to generate a screenshot of thisOrbital.
- property degenerate_orbitals: List[Orbital]#
Orbitalobjects that are very close in energy to thisOrbital.
- property doubly_occupied: bool#
Whether the orbital is doubly occupied.
- draw(gridsize='medium', isovalue=0.03, overwrite=False, screen=None, transform=None)#
Generate and draw a cube-file for this
Orbitalobject.- Parameters:
gridsize (
str) – the size of the grid to generate the cube-file with.isovalue (
float) – the value with which to generate the isosurface of thisOrbital.overwrite (
bool) – whether to overwrite the previous calculation if found.screen (tcviewer.screen.Screen) – the
tcviewer.screen.Screenobject to use to draw this orbital. If not given we start a new screen.transform (tcmu.geometry.Transform) – the geometrical tranfmormation to use with this orbital.
See also
Orbital.cube_file()to generate and return a cube-file for thisOrbital.Orbital.screenshot()to generate a screenshot of thisOrbital.
- fock(other)[source]#
Get the Fock matrix element between this
FMOand anotherFMO.- Parameters:
other (
FMO) – the orbital to get the Fock matrix element with.- Return type:
float
- property fully_occupied: bool#
Whether the orbital is fully occupied.
- make_name(spin=True, frag_name=True, relative_name=False)[source]#
Generate a name for this
FMOwith several options to modify it.- Parameters:
spin (
bool) – whether to include spin in the name. It will be appended to the end as_{spin}.frag_name (
bool) – whether to include the fragment’s unique name in the name as{fragment_unique}(...).relative_name (
bool) – whether to use the relative name instead of the regular name.
- Return type:
str
Examples
Generate the regular name of this
FMO. This is the default name when printing the object.>>> fmo.make_name() 'NH3(4A1)'
One can also use relative naming.
>>> fmo.make_name(relative_name=True) 'NH3(LUMO)'
One can also only get the name of the orbital by disabling the fragment name.
>>> fmo.make_name(frag_name=False) '4A1'
- mulliken_contribution(other, normalized=False)[source]#
Get the mulliken contribution of this
FMOinto anMO.- Parameters:
other (
MO) – the orbital to get the Mulliken contribution with.- Return type:
float
- overlap(other)[source]#
Get the overlap between this
FMOand anotherFMO.- Parameters:
other (
FMO) – the orbital to get the overlap with.- Return type:
float
Note
The matmul operation
@redirects to this method.
- property partially_occupied: bool#
Whether the orbital is not empty and not fully occupied.
- property relative_name: str#
The relative name of the orbital. E.g. HOMO or HOMO-1
- screenshot(output_path=None, gridsize='medium', isovalue=0.03, overwrite=False, transform=None)#
Generate a screenshot for this
Orbitalobject.- Parameters:
output_path (
str) – the path to save the image to.gridsize (
str) – the size of the grid to generate the cube-file with.isovalue (
float) – the value with which to generate the isosurface of thisOrbital.overwrite (
bool) – whether to overwrite the previous calculation if found.screen – the
tcviewer.screen.Screenobject to use to draw this orbital. If not given we start a new screen.transform (tcmu.geometry.Transform) – the geometrical tranfmormation to use with this orbital.
- Return type:
str
See also
Orbital.cube_file()to generate and return a cube-file for thisOrbital.Orbital.draw()to draw and open a TCviewer screen showing thisOrbital.
- property singly_occupied: bool#
Whether the orbital is singly occupied.
- property spin_total_occupation: int#
The occupation of this orbital plus its spin counterpart if it exists.
E.g. if orbital
5A_Ahas an occupation of 1 and orbitals5A_B``has an occupation of 0 then both orbitals will have the ``spin_total_occupationset to1.
- property subspecies_relative_name: str#
The relative name of the orbital in its irreducible representation. E.g. the overall HOMO-2 could be the HOMO of its irreducible representation.
- property symmetry_relative_name: str#
The relative name of the orbital in its irreducible representation. E.g. the overall HOMO-2 could be the HOMO of its irreducible representation.
- property unoccupied: bool#
Whether the orbital is unoccupied.
- vtk_file(gridsize='medium', overwrite=False, preambles=[], grid_around_mol=None, gridextend=6)#
Generate a cube-file for this
Orbitalwith a certain grid-size.- Parameters:
gridsize (
str) – the size of the grid to generate the cube-file with.overwrite (
bool) – whether to overwrite the previous calculation if found.
See also
Orbital.draw()to draw and open a TCviewer screen showing thisOrbital.Orbital.screenshot()to generate a screenshot of thisOrbital.
- class FMOs(orbitals, parent)[source]#
Bases:
OrbitalSelectorObject storing all
FMOobjects for the given calculation.- decode_key(key)#
Decode a key into the relevant parts. Keys are given in the following format:
{fragname}({orbname}[_{spin}][ {symmetry}])
Where [:fragment_index], [_{spin}], and [ {symmetry}] are optional.
If an FMO is desired you must begin the key with the fragment name and put the rest of the key within parentheses.
- Return type:
dict- Returns:
A dictionary containing
index,fragment,orbname,spin,symmetry.
Examples
Decode a key specifying an MO.
>>> MOs.decode_key('4A1') {'orbname': '4A1'}
One can also use relative naming. Also specify alpha spin.
>>> MOs.decode_key('HOMO-2_A') {'orbname': 'HOMO-2', 'spin': 'A'}
Decode a key for an FMO specifying the fragment, orbname and spin.
>>> FMOs.decode_key('NH3(1E1:1_B)') {'fragment': 'NH3', 'orbname': '1E1:1_B'}
If multiple fragments have the same name (e.g. in a non-fragment analysis with atomic fragments) we can specify the fragment index with the colon.
>>> FMOs.decode_key('C:4(1P:x)') {'fragment': 'C:4', 'orbname': '1P:x'}
- property energy_types: List[str]#
Object storing all
FMOobjects for theOrbitalsobjects.- Returns:
A list potentially containing
energy,effective_energyandeffective_energy_SCF0.
- filter(index=None, global_index=None, symmetry=None, subspecies=None, spin=None, fragment=None, fragment_index=None, orbname=None, occupation=None)#
filter
Orbitalobjects that match the given parameters. If any of the arguments is given as aContainerwe check for membership.- Parameters:
index (
int) – the index of the orbital.global_index (
int) – the global index of the orbital.symmetry (
str) – the symmetry label of the orbital.subspecies (
str) – the subspecies label of the orbital.spin (
str) – the spin label of the orbital, should be one of [A,B,AB].fragment (
str) – the fragment name of the FMO.fragment_index (
int) – the index of the fragment of the FMO.orbname (
str) – the name of the orbital. Can be either the proper name or a relative name, e.g.SOMOorLUMO+5.occupation (
float) – what kind of occupation to allow. Can be a floating point number specifying the occupation or a string from one of [unoccupied,partially_occupied,fully_occupied]. Floating point numbers will be rounded to 2 decimals before comparison.
- Return type:
- Returns:
The
Orbitalobjects that match the provided arguments. If there is only oneOrbitalobject selected, return only that one. Otherwise return alistofOrbitalobjects. ReturnsNoneif no matchingOrbitalobjects were found.
Examples
Select all FMOs of a given fragment.
>>> FMOs.filter(fragment='NH3') [NH3(1A1), NH3(2A1), NH3(3A1), ...]
Select all FMOs from the A2 irrep of the BH3 fragment.
>>> FMOs.filter(symmetry='A2', fragment='BH3') [BH3(1A2), BH3(2A2), BH3(3A2), BH3(4A2)]
Select all MOs that are named ‘1E1:1’ or ‘1E1:2’.
>>> MOs.filter(orbname=('1E1:1', '1E1:2')) [1E1:1, 1E1:2]
Select the HOMO of the NH3 fragment.
>>> FMOs.filter(orbname='HOMO', fragment='NH3') NH3(3A1)
Get 1P orbitals for all carbons
>>> FMOs.filter(orbname=('1P:x', '1P:y', '1P:z'), fragment='C') [C:1(1P:x), C:1(1P:y), C:1(1P:z), C:2(1P:x), C:2(1P:y), C:2(1P:z), C:3(1P:x), C:3(1P:y), C:3(1P:z), C:4(1P:x), C:4(1P:y), C:4(1P:z)]
Get 1P orbitals for the second carbon
>>> FMOs.filter(orbname=('1P:x', '1P:y', '1P:z'), fragment='C:2') [C:2(1P:x), C:2(1P:y), C:2(1P:z)] >>> FMOs.filter(orbname=('1P:x', '1P:y', '1P:z'), fragment='C', fragment_index=2) [C:2(1P:x), C:2(1P:y), C:2(1P:z)]
- property fragments: List[str]#
Return a list of fragment names found in the orbitals.
- get(key)#
Get
Orbitalobjects based on the given key.- Parameters:
key (
int) – a string describing the orbital to be selected or the integer index of the orbital.- Return type:
List[Orbital]- Returns:
A list of
Orbitalobjects that match the given key. If there is only one return a singleOrbitalobject.
Examples
Select the HOMO of the NH3 fragment.
>>> FMOs.get('NH3(HOMO)') NH3(3A1) >>> FMOs['NH3(HOMO)'] NH3(3A1)
Select a specific
MO.>>> MOs.get('6A1') 6A1 >>> MOs['6A1'] 6A1
See also
filter()anddecode_key().Note
The
__getitem__method of this class redirects to this method, allowing you to use indexing notation to obtain orbitals.
- property spins: List[str]#
The spin species that are present in the given orbitals.
- property subspecies: List[str]#
The spin species that are present in the given orbitals.
- property symmetry: List[str]#
The spin species that are present in the given orbitals.
- property unrestricted: bool#
Whether the calculation was performed in an unrestricted manner.
- class MO(data, parent)[source]#
Bases:
OrbitalClass holding data specifically for molecular orbitals.
Each
MOholds the following data that can be accessed like attributes.Variable
Type
Description
indexintnamestrThe regular name of this
MOas it would show up in ADFLevels.symmetrystrThe irreducible representation this
MObelongs to.symmetry_indexintThe index of this
MOin the overalMOsthat belong to the same irreducible representation.spinstrThe spin of this
MO, either'A','B'or'AB'energyfloatThe energy of the
MOin \(\text{kcal mol}^{-1}\).kinetic_energyfloatThe kinetic energy of the
MOin \(\text{kcal mol}^{-1}\) if it could be read from the calculation.occupationintThe occupation number of this
MO. Either0,1or2.occupiedboolWhether the
MOhas electrons in it.- cube_file(gridsize='medium', overwrite=False, cube_file_prefix=None, preambles=[], grid_around_mol=None, gridextend=6)#
Generate a cube-file for this
Orbitalwith a certain grid-size.- Parameters:
gridsize (
str) – the size of the grid to generate the cube-file with.overwrite (
bool) – whether to overwrite the previous calculation if found.cube_file_prefix (
str) – prefix for the cube file path.
See also
Orbital.draw()to draw and open a TCviewer screen showing thisOrbital.Orbital.screenshot()to generate a screenshot of thisOrbital.
- property degenerate_orbitals: List[Orbital]#
Orbitalobjects that are very close in energy to thisOrbital.
- property doubly_occupied: bool#
Whether the orbital is doubly occupied.
- draw(gridsize='medium', isovalue=0.03, overwrite=False, screen=None, transform=None)#
Generate and draw a cube-file for this
Orbitalobject.- Parameters:
gridsize (
str) – the size of the grid to generate the cube-file with.isovalue (
float) – the value with which to generate the isosurface of thisOrbital.overwrite (
bool) – whether to overwrite the previous calculation if found.screen (tcviewer.screen.Screen) – the
tcviewer.screen.Screenobject to use to draw this orbital. If not given we start a new screen.transform (tcmu.geometry.Transform) – the geometrical tranfmormation to use with this orbital.
See also
Orbital.cube_file()to generate and return a cube-file for thisOrbital.Orbital.screenshot()to generate a screenshot of thisOrbital.
- fragment_character(fragment)[source]#
Calculate the total contribution of
FMOobjects from a specific fragment to thisMO. The sum of all fragment characters is always1for eachMO.- Parameters:
fragment (
str) – the fragment to calculate the character for.- Return type:
float
Example
>>> MO.fragment_character('NH3') 0.469475215528633 >>> MO.fragment_character('BH3') 0.530524784471364
- property fully_occupied: bool#
Whether the orbital is fully occupied.
- property partially_occupied: bool#
Whether the orbital is not empty and not fully occupied.
- property relative_name: str#
The relative name of the orbital. E.g. HOMO or HOMO-1
- screenshot(output_path=None, gridsize='medium', isovalue=0.03, overwrite=False, transform=None)#
Generate a screenshot for this
Orbitalobject.- Parameters:
output_path (
str) – the path to save the image to.gridsize (
str) – the size of the grid to generate the cube-file with.isovalue (
float) – the value with which to generate the isosurface of thisOrbital.overwrite (
bool) – whether to overwrite the previous calculation if found.screen – the
tcviewer.screen.Screenobject to use to draw this orbital. If not given we start a new screen.transform (tcmu.geometry.Transform) – the geometrical tranfmormation to use with this orbital.
- Return type:
str
See also
Orbital.cube_file()to generate and return a cube-file for thisOrbital.Orbital.draw()to draw and open a TCviewer screen showing thisOrbital.
- property singly_occupied: bool#
Whether the orbital is singly occupied.
- property spin_total_occupation: int#
The occupation of this orbital plus its spin counterpart if it exists.
E.g. if orbital
5A_Ahas an occupation of 1 and orbitals5A_B``has an occupation of 0 then both orbitals will have the ``spin_total_occupationset to1.
- property symmetry_relative_name: str#
The relative name of the orbital in its irreducible representation. E.g. the overall HOMO-2 could be the HOMO of its irreducible representation.
- property unoccupied: bool#
Whether the orbital is unoccupied.
- vtk_file(gridsize='medium', overwrite=False, preambles=[], grid_around_mol=None, gridextend=6)#
Generate a cube-file for this
Orbitalwith a certain grid-size.- Parameters:
gridsize (
str) – the size of the grid to generate the cube-file with.overwrite (
bool) – whether to overwrite the previous calculation if found.
See also
Orbital.draw()to draw and open a TCviewer screen showing thisOrbital.Orbital.screenshot()to generate a screenshot of thisOrbital.
- class MOs(orbitals, parent)[source]#
Bases:
OrbitalSelectorObject storing all
MOobjects for theOrbitalsobjects.- decode_key(key)#
Decode a key into the relevant parts. Keys are given in the following format:
{fragname}({orbname}[_{spin}][ {symmetry}])
Where [:fragment_index], [_{spin}], and [ {symmetry}] are optional.
If an FMO is desired you must begin the key with the fragment name and put the rest of the key within parentheses.
- Return type:
dict- Returns:
A dictionary containing
index,fragment,orbname,spin,symmetry.
Examples
Decode a key specifying an MO.
>>> MOs.decode_key('4A1') {'orbname': '4A1'}
One can also use relative naming. Also specify alpha spin.
>>> MOs.decode_key('HOMO-2_A') {'orbname': 'HOMO-2', 'spin': 'A'}
Decode a key for an FMO specifying the fragment, orbname and spin.
>>> FMOs.decode_key('NH3(1E1:1_B)') {'fragment': 'NH3', 'orbname': '1E1:1_B'}
If multiple fragments have the same name (e.g. in a non-fragment analysis with atomic fragments) we can specify the fragment index with the colon.
>>> FMOs.decode_key('C:4(1P:x)') {'fragment': 'C:4', 'orbname': '1P:x'}
- filter(index=None, global_index=None, symmetry=None, subspecies=None, spin=None, fragment=None, fragment_index=None, orbname=None, occupation=None)#
filter
Orbitalobjects that match the given parameters. If any of the arguments is given as aContainerwe check for membership.- Parameters:
index (
int) – the index of the orbital.global_index (
int) – the global index of the orbital.symmetry (
str) – the symmetry label of the orbital.subspecies (
str) – the subspecies label of the orbital.spin (
str) – the spin label of the orbital, should be one of [A,B,AB].fragment (
str) – the fragment name of the FMO.fragment_index (
int) – the index of the fragment of the FMO.orbname (
str) – the name of the orbital. Can be either the proper name or a relative name, e.g.SOMOorLUMO+5.occupation (
float) – what kind of occupation to allow. Can be a floating point number specifying the occupation or a string from one of [unoccupied,partially_occupied,fully_occupied]. Floating point numbers will be rounded to 2 decimals before comparison.
- Return type:
- Returns:
The
Orbitalobjects that match the provided arguments. If there is only oneOrbitalobject selected, return only that one. Otherwise return alistofOrbitalobjects. ReturnsNoneif no matchingOrbitalobjects were found.
Examples
Select all FMOs of a given fragment.
>>> FMOs.filter(fragment='NH3') [NH3(1A1), NH3(2A1), NH3(3A1), ...]
Select all FMOs from the A2 irrep of the BH3 fragment.
>>> FMOs.filter(symmetry='A2', fragment='BH3') [BH3(1A2), BH3(2A2), BH3(3A2), BH3(4A2)]
Select all MOs that are named ‘1E1:1’ or ‘1E1:2’.
>>> MOs.filter(orbname=('1E1:1', '1E1:2')) [1E1:1, 1E1:2]
Select the HOMO of the NH3 fragment.
>>> FMOs.filter(orbname='HOMO', fragment='NH3') NH3(3A1)
Get 1P orbitals for all carbons
>>> FMOs.filter(orbname=('1P:x', '1P:y', '1P:z'), fragment='C') [C:1(1P:x), C:1(1P:y), C:1(1P:z), C:2(1P:x), C:2(1P:y), C:2(1P:z), C:3(1P:x), C:3(1P:y), C:3(1P:z), C:4(1P:x), C:4(1P:y), C:4(1P:z)]
Get 1P orbitals for the second carbon
>>> FMOs.filter(orbname=('1P:x', '1P:y', '1P:z'), fragment='C:2') [C:2(1P:x), C:2(1P:y), C:2(1P:z)] >>> FMOs.filter(orbname=('1P:x', '1P:y', '1P:z'), fragment='C', fragment_index=2) [C:2(1P:x), C:2(1P:y), C:2(1P:z)]
- get(key)#
Get
Orbitalobjects based on the given key.- Parameters:
key (
int) – a string describing the orbital to be selected or the integer index of the orbital.- Return type:
List[Orbital]- Returns:
A list of
Orbitalobjects that match the given key. If there is only one return a singleOrbitalobject.
Examples
Select the HOMO of the NH3 fragment.
>>> FMOs.get('NH3(HOMO)') NH3(3A1) >>> FMOs['NH3(HOMO)'] NH3(3A1)
Select a specific
MO.>>> MOs.get('6A1') 6A1 >>> MOs['6A1'] 6A1
See also
filter()anddecode_key().Note
The
__getitem__method of this class redirects to this method, allowing you to use indexing notation to obtain orbitals.
- property spins: List[str]#
The spin species that are present in the given orbitals.
- property symmetry: List[str]#
The spin species that are present in the given orbitals.
- property unrestricted: bool#
Whether the calculation was performed in an unrestricted manner.
- class Orbital(data, parent)[source]#
Bases:
objectMain class holding orbital information for
MOandFMOobjects. This class is used to obtain information about the orbital, generate cube-files, and visualize orbitals.- cube_file(gridsize='medium', overwrite=False, cube_file_prefix=None, preambles=[], grid_around_mol=None, gridextend=6)[source]#
Generate a cube-file for this
Orbitalwith a certain grid-size.- Parameters:
gridsize (
str) – the size of the grid to generate the cube-file with.overwrite (
bool) – whether to overwrite the previous calculation if found.cube_file_prefix (
str) – prefix for the cube file path.
See also
Orbital.draw()to draw and open a TCviewer screen showing thisOrbital.Orbital.screenshot()to generate a screenshot of thisOrbital.
- property degenerate_orbitals: List[Orbital]#
Orbitalobjects that are very close in energy to thisOrbital.
- property doubly_occupied: bool#
Whether the orbital is doubly occupied.
- draw(gridsize='medium', isovalue=0.03, overwrite=False, screen=None, transform=None)[source]#
Generate and draw a cube-file for this
Orbitalobject.- Parameters:
gridsize (
str) – the size of the grid to generate the cube-file with.isovalue (
float) – the value with which to generate the isosurface of thisOrbital.overwrite (
bool) – whether to overwrite the previous calculation if found.screen (tcviewer.screen.Screen) – the
tcviewer.screen.Screenobject to use to draw this orbital. If not given we start a new screen.transform (tcmu.geometry.Transform) – the geometrical tranfmormation to use with this orbital.
See also
Orbital.cube_file()to generate and return a cube-file for thisOrbital.Orbital.screenshot()to generate a screenshot of thisOrbital.
- property fully_occupied: bool#
Whether the orbital is fully occupied.
- property partially_occupied: bool#
Whether the orbital is not empty and not fully occupied.
- property relative_name: str#
The relative name of the orbital. E.g. HOMO or HOMO-1
- screenshot(output_path=None, gridsize='medium', isovalue=0.03, overwrite=False, transform=None)[source]#
Generate a screenshot for this
Orbitalobject.- Parameters:
output_path (
str) – the path to save the image to.gridsize (
str) – the size of the grid to generate the cube-file with.isovalue (
float) – the value with which to generate the isosurface of thisOrbital.overwrite (
bool) – whether to overwrite the previous calculation if found.screen – the
tcviewer.screen.Screenobject to use to draw this orbital. If not given we start a new screen.transform (tcmu.geometry.Transform) – the geometrical tranfmormation to use with this orbital.
- Return type:
str
See also
Orbital.cube_file()to generate and return a cube-file for thisOrbital.Orbital.draw()to draw and open a TCviewer screen showing thisOrbital.
- property singly_occupied: bool#
Whether the orbital is singly occupied.
- property spin_total_occupation: int#
The occupation of this orbital plus its spin counterpart if it exists.
E.g. if orbital
5A_Ahas an occupation of 1 and orbitals5A_B``has an occupation of 0 then both orbitals will have the ``spin_total_occupationset to1.
- property symmetry_relative_name: str#
The relative name of the orbital in its irreducible representation. E.g. the overall HOMO-2 could be the HOMO of its irreducible representation.
- property unoccupied: bool#
Whether the orbital is unoccupied.
- vtk_file(gridsize='medium', overwrite=False, preambles=[], grid_around_mol=None, gridextend=6)[source]#
Generate a cube-file for this
Orbitalwith a certain grid-size.- Parameters:
gridsize (
str) – the size of the grid to generate the cube-file with.overwrite (
bool) – whether to overwrite the previous calculation if found.
See also
Orbital.draw()to draw and open a TCviewer screen showing thisOrbital.Orbital.screenshot()to generate a screenshot of thisOrbital.
- class OrbitalSelector(orbitals, parent)[source]#
Bases:
objectClass used to select
MOsorFMOs. It is responsible for decoding selection keys and filtering orbitals based on the selection key.- Parameters:
- decode_key(key)[source]#
Decode a key into the relevant parts. Keys are given in the following format:
{fragname}({orbname}[_{spin}][ {symmetry}])
Where [:fragment_index], [_{spin}], and [ {symmetry}] are optional.
If an FMO is desired you must begin the key with the fragment name and put the rest of the key within parentheses.
- Return type:
dict- Returns:
A dictionary containing
index,fragment,orbname,spin,symmetry.
Examples
Decode a key specifying an MO.
>>> MOs.decode_key('4A1') {'orbname': '4A1'}
One can also use relative naming. Also specify alpha spin.
>>> MOs.decode_key('HOMO-2_A') {'orbname': 'HOMO-2', 'spin': 'A'}
Decode a key for an FMO specifying the fragment, orbname and spin.
>>> FMOs.decode_key('NH3(1E1:1_B)') {'fragment': 'NH3', 'orbname': '1E1:1_B'}
If multiple fragments have the same name (e.g. in a non-fragment analysis with atomic fragments) we can specify the fragment index with the colon.
>>> FMOs.decode_key('C:4(1P:x)') {'fragment': 'C:4', 'orbname': '1P:x'}
- filter(index=None, global_index=None, symmetry=None, subspecies=None, spin=None, fragment=None, fragment_index=None, orbname=None, occupation=None)[source]#
filter
Orbitalobjects that match the given parameters. If any of the arguments is given as aContainerwe check for membership.- Parameters:
index (
int) – the index of the orbital.global_index (
int) – the global index of the orbital.symmetry (
str) – the symmetry label of the orbital.subspecies (
str) – the subspecies label of the orbital.spin (
str) – the spin label of the orbital, should be one of [A,B,AB].fragment (
str) – the fragment name of the FMO.fragment_index (
int) – the index of the fragment of the FMO.orbname (
str) – the name of the orbital. Can be either the proper name or a relative name, e.g.SOMOorLUMO+5.occupation (
float) – what kind of occupation to allow. Can be a floating point number specifying the occupation or a string from one of [unoccupied,partially_occupied,fully_occupied]. Floating point numbers will be rounded to 2 decimals before comparison.
- Return type:
- Returns:
The
Orbitalobjects that match the provided arguments. If there is only oneOrbitalobject selected, return only that one. Otherwise return alistofOrbitalobjects. ReturnsNoneif no matchingOrbitalobjects were found.
Examples
Select all FMOs of a given fragment.
>>> FMOs.filter(fragment='NH3') [NH3(1A1), NH3(2A1), NH3(3A1), ...]
Select all FMOs from the A2 irrep of the BH3 fragment.
>>> FMOs.filter(symmetry='A2', fragment='BH3') [BH3(1A2), BH3(2A2), BH3(3A2), BH3(4A2)]
Select all MOs that are named ‘1E1:1’ or ‘1E1:2’.
>>> MOs.filter(orbname=('1E1:1', '1E1:2')) [1E1:1, 1E1:2]
Select the HOMO of the NH3 fragment.
>>> FMOs.filter(orbname='HOMO', fragment='NH3') NH3(3A1)
Get 1P orbitals for all carbons
>>> FMOs.filter(orbname=('1P:x', '1P:y', '1P:z'), fragment='C') [C:1(1P:x), C:1(1P:y), C:1(1P:z), C:2(1P:x), C:2(1P:y), C:2(1P:z), C:3(1P:x), C:3(1P:y), C:3(1P:z), C:4(1P:x), C:4(1P:y), C:4(1P:z)]
Get 1P orbitals for the second carbon
>>> FMOs.filter(orbname=('1P:x', '1P:y', '1P:z'), fragment='C:2') [C:2(1P:x), C:2(1P:y), C:2(1P:z)] >>> FMOs.filter(orbname=('1P:x', '1P:y', '1P:z'), fragment='C', fragment_index=2) [C:2(1P:x), C:2(1P:y), C:2(1P:z)]
- get(key)[source]#
Get
Orbitalobjects based on the given key.- Parameters:
key (
int) – a string describing the orbital to be selected or the integer index of the orbital.- Return type:
List[Orbital]- Returns:
A list of
Orbitalobjects that match the given key. If there is only one return a singleOrbitalobject.
Examples
Select the HOMO of the NH3 fragment.
>>> FMOs.get('NH3(HOMO)') NH3(3A1) >>> FMOs['NH3(HOMO)'] NH3(3A1)
Select a specific
MO.>>> MOs.get('6A1') 6A1 >>> MOs['6A1'] 6A1
See also
filter()anddecode_key().Note
The
__getitem__method of this class redirects to this method, allowing you to use indexing notation to obtain orbitals.
- property spins: List[str]#
The spin species that are present in the given orbitals.
- property symmetry: List[str]#
The spin species that are present in the given orbitals.
- property unrestricted: bool#
Whether the calculation was performed in an unrestricted manner.
- class Orbitals(path, path_SCF0=None, path_fragments=None, path_output=None)[source]#
Bases:
objectContainer class that stores information about both
MOsandFMOs.Orbitalscan also be given the paths toadf.rkffiles from related calculations to obtain more information. For example, the path to a calculation with the number of SCF cycles set to 0 populates theeffective_energy_SCF0properties of the FMOs.- Parameters:
path (
str) – the path to anadf.rkffile containing information about the system of interest.path_SCF0 (
str) – the path to anadf.rkffile containing information about a calculation with 0 SCF cycles. This argument is required to populate theFMO.effective_energy_scf0propertypath_fragments (
Dict[str,str]) – dictionary containing fragment name as the key and path to itsadf.rkfas the value.path_output (
str) – the path to an.outfile generated by ADF. This is required to read the kinetic energies for the MOs.
- fmos#
the
FMOsobject storing theFMOobjects associated with this system. Use this to select specificFMOfor further analysis.- Type:
- charges#
a dictionary storing formal charges of the complex and each fragment.
- Type:
Dict[str,int]
- property fmo_energy_types: List[str]#
Get the orbital energy types that are available for the provided system.
See also
This property is a redirection of
FMOs.energy_types.
- property fragments: List[str]#
The names of the fragments defined in the calculation.
- property molecule: Molecule#
The molecule corresponding to the overall system.
- rename_fragment(old, new)[source]#
Rename the
oldfragment tonew.- Parameters:
old (
str) – the name of the fragment to rename.new (
str) – the name to rename the fragment to.
- Raises:
ValueError – if the new name is already in use.
See also
See
Orbitals.fragmentsto obtain a list of fragment names that are currently used.