aiida_aimall.workchains.calcfunctions#

Calcfunctions used throughout workchains

Module Contents#

Functions#

generate_rotated_structure_aiida(FolderData, ...)

Rotates the fragment to the defined coordinate system

remove_numcharss_from_strlist(in_list)

Remove digits from a list of strings. e.g. ['O1','H2','H3'] -> ['O','H','H']

dict_to_structure(fragment_dict)

Generate a StructureData for Gaussian inputs

calc_multiplicity(mol)

Calculate the multiplicity of a molecule as 2S +1

find_attachment_atoms(mol)

Given molecule object, find the atoms corresponding to a * and the atom to which that is bound

reorder_molecule(h_mol_rw, zero_at, attached_atom)

Reindexes the atoms in a molecule, setting attached_atom to index 0, and zero_at to index 1

get_xyz(reorder_mol)

MMFF optimize the molecule to generate xyz coordiantes

get_substituent_input(→ dict)

For a given smiles, determine xyz structure, charge, and multiplicity

generate_structure_data(smiles_dict)

Take an input xyz string and convert it to StructureData

parameters_with_cm(parameters, smiles_dict)

Add charge and multiplicity keys to Gaussian Input

get_wfxname_from_gaussianinputs(gaussian_parameters)

Find the .wfx filename from gaussian_parameters

create_wfx_from_retrieved(wfxname, retrieved_folder)

Create wavefunction SinglefileData from retrieved folder

validate_shell_code(node, _)

Validate the shell code, ensuring that it is ShellCode or Str

validate_parser(node, _)

Validate the parser, ensuring that the provided value is one of the accepted values.

validate_file_ext(node, _)

Validates that the file extension provided for AIM is wfx, wfn or fchk

get_molecule_str_from_smiles(smiles)

For a given smiles, determine xyz structure, charge, and multiplicity

xyzfile_to_StructureData(xyz_SFD)

Convert the xyz file provided as SinglefileData to StructureData

aiida_aimall.workchains.calcfunctions.generate_rotated_structure_aiida(FolderData, atom_dict, cc_dict)[source]#

Rotates the fragment to the defined coordinate system

Parameters:
  • FolderData (aiida.orm.FolderData) – aim calculation folder

  • atom_dict – AIM atom dict

  • cc_dict – AIM cc_dict

Returns:

Dict with keys ‘atom_symbols’ and ‘geom’ containing atomic symbols and the

the rotated geometry.

aiida_aimall.workchains.calcfunctions.remove_numcharss_from_strlist(in_list)[source]#

Remove digits from a list of strings. e.g. [‘O1’,’H2’,’H3’] -> [‘O’,’H’,’H’]

Parameters:

in_list – input list to remove digits from

Returns:

output list with the numerical digits removed from each element

Note

The intention for this list is to convert numered atomic symbols, e.g. from Gaussian

to just symbols

aiida_aimall.workchains.calcfunctions.dict_to_structure(fragment_dict)[source]#

Generate a StructureData for Gaussian inputs

Parameters:

fragment_dict (aiida.orm.Dict) – AiiDA orm.Dict with keys ‘atom_symbols’ and ‘geom’

Returns:

aiida.orm.StructureData for the molecule

aiida_aimall.workchains.calcfunctions.calc_multiplicity(mol)[source]#

Calculate the multiplicity of a molecule as 2S +1

Loops over the atoms in the molecule and gets number of radical electrons, then converts that number to the multiplicity.

Parameters:

mol – rdkit.Chem molecule object

Returns:

integer number of multiplicity

aiida_aimall.workchains.calcfunctions.find_attachment_atoms(mol)[source]#

Given molecule object, find the atoms corresponding to a * and the atom to which that is bound

Parameters:

mol – rdkit molecule object

Returns:

molecule with added hydrogens, the * atom object, and the atom object to which that is attached

Note

Assumes that only one * is present in the molecule

aiida_aimall.workchains.calcfunctions.reorder_molecule(h_mol_rw, zero_at, attached_atom)[source]#

Reindexes the atoms in a molecule, setting attached_atom to index 0, and zero_at to index 1

Parameters:
  • h_mol_rw – RWMol rdkit object with explicit hydrogens

  • zero_at – the placeholder * atom

  • attached_atom – the atom bonded to *

Returns:

molecule with reordered indices

aiida_aimall.workchains.calcfunctions.get_xyz(reorder_mol)[source]#

MMFF optimize the molecule to generate xyz coordiantes

Parameters:

reorder_mol – rdkit.Chem molecule output, output of aiida_aimall.workchains.calcfunctions.reorder_molecule()

Returns:

string of the geometry block of an .xyz file

aiida_aimall.workchains.calcfunctions.get_substituent_input(smiles: str) dict[source]#

For a given smiles, determine xyz structure, charge, and multiplicity

Parameters:

smiles (str) – SMILEs of substituent to run

Returns:

Dict with keys xyz, charge, multiplicity

Raises:

ValueError – if molecule cannot be built from SMILES

aiida_aimall.workchains.calcfunctions.generate_structure_data(smiles_dict)[source]#

Take an input xyz string and convert it to StructureData

Parameters:

smiles_dict – output of aiida_aimall.workchains.calcfunctions.get_substituent_input()

Returns:

StructureData of the molecule

aiida_aimall.workchains.calcfunctions.parameters_with_cm(parameters, smiles_dict)[source]#

Add charge and multiplicity keys to Gaussian Input

Parameters:
  • parameters – dictionary to be provided to GaussianCalculation

  • smiles_dictaiida_aimall.workchains.calcfunctions.get_substituent_input

Returns:

Dict of Gaussian parameters updated with charge and multiplicity

aiida_aimall.workchains.calcfunctions.get_wfxname_from_gaussianinputs(gaussian_parameters)[source]#

Find the .wfx filename from gaussian_parameters

Check if input parameters was provided to gaussian_parameters, and if so, look for .wfx file names supplied. If it was, return the first .wfx filename found

Parameters:

gaussian_parameters – input dictionary to be provided to GaussianCalculation

Returns:

Str of .wfx filename

aiida_aimall.workchains.calcfunctions.create_wfx_from_retrieved(wfxname, retrieved_folder)[source]#

Create wavefunction SinglefileData from retrieved folder

Parameters:
  • wfxname – Str of the name of a .wfx file to get from the retrieved folder

  • retrieved_folder – FolderData of a completed GaussianCalculation

Returns:

SinglefileData of the .wfx file to find in the FolderData

aiida_aimall.workchains.calcfunctions.validate_shell_code(node, _)[source]#

Validate the shell code, ensuring that it is ShellCode or Str

Parameters:

node – input node to check the type for ShellCode or Str

Returns:

None if the type is ShellCode or Str, or error string if node is not

aiida_aimall.workchains.calcfunctions.validate_parser(node, _)[source]#

Validate the parser, ensuring that the provided value is one of the accepted values.

Parameters:

node – input node to check the type for ShellCode or Str

Returns:

None if the value is aimall.base or aimall.group, or an error string if it is not

aiida_aimall.workchains.calcfunctions.validate_file_ext(node, _)[source]#

Validates that the file extension provided for AIM is wfx, wfn or fchk

Parameters:

node – node to check the value of to ensure it is in a supported format

Returns:

None if the type is ShellCode or Str, or error string if node is not

aiida_aimall.workchains.calcfunctions.get_molecule_str_from_smiles(smiles)[source]#

For a given smiles, determine xyz structure, charge, and multiplicity

Parameters:

smiles – SMILEs of substituent to run

Returns:

Dict with keys xyz, charge, multiplicity

aiida_aimall.workchains.calcfunctions.xyzfile_to_StructureData(xyz_SFD)[source]#

Convert the xyz file provided as SinglefileData to StructureData