Module Documentation

Input

Functions to deal with DockOnSurf input files.

List of functions:

Auxiliary functions

str2lst: Converts a string of integers, and groups of them, to a list of lists.

check_expect_val: Checks whether the value of an option has an adequate value.

check_inp_files: Checks if the CP2K/VASP input files are consistent.

Functions to read parameters in the Global section

get_run_type: Gets ‘run_type’ value and checks that its value is acceptable.

get_code: Gets ‘code’ value and checks that its value is acceptable.

get_batch_q_sys: Gets ‘batch_q_sys’ value and checks that its value is acceptable.

get_pbc_cell: Gets ‘pbc_cell’ value and checks that its value is acceptable.

get_subm_script: Gets ‘subm_script’ value and checks that its value is acceptable.

get_project_name: Gets ‘project_name’ value and checks that its value is acceptable.

get_relaunch_err: Gets ‘relaunch_err’ value and checks that its value is acceptable. # WARNING: OPTION NOT IMPLEMENTED

get_max_jobs: Gets ‘max_jobs’ value and checks that its value is acceptable.

get_special_atoms: Gets ‘special_atoms’ value and checks that its value is acceptable.

get_potcar_dir: Gets ‘potcar_dir’ value and checks that its value is acceptable.

Functions to read parameters in the Isolated section

get_isol_inp_file: Gets ‘isol_inp_file’ value and checks that its value is acceptable.

get_molec_file: Gets ‘molec_file’ value and checks that its value is acceptable.

get_num_conformers: Gets ‘num_conformers’ value and checks that its value is acceptable.

get_pre_opt: Gets ‘pre_opt’ value and checks that its value is acceptable.

Functions to read parameters in the Screening section

get_screen_inp_file: Gets ‘screen_inp_file’ value and checks that its value is acceptable.

get_surf_file: Gets ‘surf_file’ value and checks that its value is acceptable.

get_sites: Gets ‘sites’ value and checks that its value is acceptable.

get_surf_ctrs2: Gets ‘surf_ctrs2’ value and checks that its value is acceptable.

get_molec_ctrs: Gets ‘molec_ctrs’ value and checks that its value is acceptable.

get_molec_ctrs2: Gets ‘molec_ctrs2’ value and checks that its value is acceptable.

get_molec_ctrs3: Gets ‘molec_ctrs3’ value and checks that its value is acceptable.

get_max_helic_angle: Gets ‘max_helic_angle’ value and checks that its value is acceptable.

get_select_magns: Gets ‘select_magns’ value and checks that its value is acceptable.

get_confs_per_magn: Gets ‘confs_per_magn’ value and checks that its value is acceptable.

get_surf_norm_vect: Gets ‘surf_norm_vect’ value and checks that its value is acceptable.

get_adsorption_height: Gets ‘adsorption_height’ value and checks that its value is acceptable.

get_set_angles: Gets ‘set_angles’ value and checks that its value is acceptable.

get_pts_per_angle: Gets ‘pts_per_angle’ value and checks that its value is acceptable.

get_max_structures: Gets ‘max_structures’ value and checks that its value is acceptable.

get_coll_thrsld: Gets ‘coll_thrsld’ value and checks that its value is acceptable.

get_min_coll_height: Gets ‘coll_bottom_z’ value and checks that its value is acceptable.

get_exclude_ads_ctr: Gets ‘exclude_ads_ctr’ value and checks that its value is acceptable.

get_H_donor: Gets ‘H_donor’ value and checks that its value is acceptable.

get_H_acceptor: Gets ‘H_acceptor’ value and checks that its value is acceptable.

get_use_molec_file: Gets ‘use_molec_file’ value and checks that its value is acceptable.

Functions to read parameters in the Refinement section

get_refine_inp_file: Gets ‘refine_inp_file’ value and checks that its value is acceptable.

get_energy_cutoff: Gets ‘energy_cutoff’ value and checks that its value is acceptable.

read_input: Directs the reading of the parameters in the input file

dockonsurf.dos_input.check_expect_val(value, expect_vals, err_msg=None)

Checks whether an option lies within its expected values.

Keyword arguments: @param value: The variable to check if its value lies within the expected ones @param expect_vals: list, list of values allowed for the present option. @param err_msg: The error message to be prompted in both log and screen. @raise ValueError: if the value is not among the expected ones. @return True if the value is among the expected ones.

dockonsurf.dos_input.check_inp_files(inp_files, code: str, potcar_dir=None)

Checks if the CP2K/VASP input files are consistent.

@param inp_files: List of input files @param code: The code for which the input files are for (VASP or CP2K). @param potcar_dir: The path where POTCARs are found @return: None

dockonsurf.dos_input.read_input(in_file)

Directs the reading of the parameters in the input file.

@param in_file: The path to the DockOnSurf input file. @return inp_vars: Dictionary with the values for every option in the input file.

dockonsurf.dos_input.str2lst(cmplx_str, func=<class 'int'>)

Converts a string of integers/floats, and groups of them, to a list.

Keyword arguments: @param cmplx_str: str, string of integers (or floats) and groups of them enclosed by parentheses-like characters. - Group enclosers: ‘()’ ‘[]’ and ‘{}’. - Separators: ‘,’ ‘;’ and ‘ ‘. - Nested groups are not allowed: ‘3 ((6 7) 8) 4’. @param func: either to use int or float

@return list, list of integers (or floats), or list of integers (or floats) in the case they were grouped. First, the singlets are placed, and then the groups in input order.

eg. ‘128,(135 138;141] 87 {45, 68}’ -> [128, 87, [135, 138, 141], [45, 68]]

ASANN

Python3 implementation of the ASANN algorithm (Anisotropically corrected Solid-Angle based Nearest-Neighbors)

dockonsurf.ASANN.add_periodic_images(coords, cell, mode)

Explicitely add adjacent or surrounding periodic images.

Parameters: coords (2D array): List of atoms coordinates to consider. Important: direct coordinates are expected (torus topology of side 1) if pbc is set to True. Shape expected: (nb_atoms, nb_dim), where nb_atoms is the number of atoms considered, and nb_dim is the dimensionnality of the system.

cell (numpy 2D array): List of cell vectors to consider for periodic boundaries conditions. Shape expected: (nb_dim, nb_dim), where nb_dim is the dimensionnality of the system considered. Exemple: cell_vectors=[[v1_x, v1_y, v1_z], [v2_x, v2_y, v2_z], [v3_x, v3_y, v3_z]]

mode (str): Determines which periodic images should be included. If ‘adjacent’, all adjacent periodic images are included (all periodic images sharing a face), increasing the number of coordinates 9-fold. If ‘full’, all surrounding periodic images are included (all periodic images sharing a face, an edge or a point), increasing the number of coordinates 27-fold.

Returns: (nb_atoms, new_coords) nb_atoms: number of real atom coordinates new_coords: numpy 2D array containing updated coordinates (initial + periodic images) Shape: (nb_coords, nb_dim)

dockonsurf.ASANN.angular_correction(nearest_neighbors, nearest_distances, radius)

Compute the angular correction ang_corr, such that R_i_m = sum(r_ij, j=1..m)/(m-2(1-ang_corr)).

Parameters: nearest_neighbors: numpy 2D array containing the m nearest neighbors vectors from the central atom, sorted by increasing distance with respect to the central atom. Important: The vectors must be in cartesian coordinates.

nearest_distances: numpy 1D array containing the m nearest neighbors distances from the central atom, sorted by increasing distance with respect to the central atom.

radius (float): radius R_i_m of the sphere of coordination.

Returns:

ang_corr (float): angular correction.

Computational details: The angular correction is computed from the distance between the nearest neighbor barycenter and the central atom dist_bary.

Let us define alpha such that: dist_bary = alpha * radius Then, mathematical derivations show that: ang_corr = (alpha + sqrt(alpha**2 + 3*alpha))/3

dockonsurf.ASANN.convert_continuous(list_CN, list_radius, sorted_distances)

Convert integer coordination numbers into continuous decimal values.

Parameters: list_CN: Numpy 1D array containing discretized coordination numbers (i.e. number of neighbors).

list_radius: Numpy 1D array containing coordination radius (i.e. radius of the coordination spheres).

sorted_distances: Numpy 2D array containing pairwise distances between coordinates, where each i-th row is sorted by increasing distance with respect to the i-th coordinates.

Returns: list_continuous_CN: Numpy 1D array containing continuous coordination numbers.

list_weights: 2D array containing the distance-related weights to apply to each neighbors of each atom.

Computational details: In the discretized version, each neighbor is comptabilized exactly once. In the continuous version, the contribution of each neighbor is scaled by the following weight : SA/SA_max (where SA is the solid angle associated with the corresponding neighbor, and SA_max is the maximum solid angle (i.e. the solid angle associated with the nearest neighbor)).

The continuous coordination number is then the sum of all weights.

dockonsurf.ASANN.coordination_numbers(list_coords, pbc=True, cell_vectors=numpy.eye, continuous=False, generalized=False, edges=True, correction='ASANN', parallel=False, reduce_mode=None)

Computes coordination numbers according to the CASANN algorithm.

Parameters:

list_coords (2D array): List of atoms coordinates to consider. Important: direct coordinates are expected (torus topology of side 1), unless pbc is set to False. Note: This will be converted into a numpy.ndarray. Shape expected: (nb_atoms, nb_dim), where nb_atoms is the number of atoms considered, and nb_dim is the dimensionnality of the system.

pbc (bool or str, optional): Determines if periodic boundaries conditions should be applied. Default to True. If True, coordinates are interpreted as direct coordinates and the distance between points is computed as the minimum euclidian distance between all duplicates (due to periodic boundaries conditions) of these points. If False, coordinates are interpreted as cartesian coordinates and the metric used is simply the euclidian distance. To explicitely include all adjacent periodic images (not only the minimum image convention) set pbc to ‘adjacent’. This mode is particularly pertinent for small enough cells, but increases 9-fold the number of atoms. To explicitely include all surrounding periodic images set pbc to ‘full’. This mode is particularly pertinent for very small cells, but increases 27-fold the number of atoms. Note: This option implies the use of cell vectors (see cell parameter) for the computation of distance. Default: True.

cell_vectors (2D array, optional): List of cell vectors to consider when periodic boundaries conditions are considered. Note: This will be converted into a numpy.ndarray. Shape expected: (nb_dim, nb_dim), where nb_dim is the dimensionnality of the system considered. Important: For this parameter to be taken into account, pbc must be set to True. Exemple: cell_vectors=[[v1_x, v1_y, v1_z], [v2_x, v2_y, v2_z], [v3_x, v3_y, v3_z]] Default: numpy.eye(3) (i.e. a cubic cell of side 1).

continuous (bool, optional): If True, computes continuous coordination numbers. If False, computes discretized coordination numbers. Default to True. In the discretized version, the coordination number is equal to the number of detected neighbors. In the continuous version, each neighbors’ contribution to the coordination number is 1 weighted by SA/SA_max, where SA is the solid angle corresponding to this neighbor and SA_max is the solid angle corresponding to the nearest neighbor (i.e. the maximum solid angle amongs all neighbors detected). Default: False.

generalized (bool, optional): If True, computes generalized coordination numbers, where each neighbor is weighted by its own coordination number Default: False.

edges (bool, optional): If True, computes edges of the connectivity graph defined by the discretized coordination numbers computed. Default: True.

correction (str, optional): Determines if a correction term should be used. Default to ‘ASANN’. The SANN algorithm suffers overdetermination of the coordination numbers at interfaces (i.e. high density gradient) basically because neighbors are always expected to fill the whole neighboring space (i.e. the sum of solid angles must be 4π), but at interfaces, neighbors are only expected to fill a portion of that space depending on the geometry of the interface. Possible values: - ‘ASANN’: If correction is set to ‘ASANN’, the total sum of solid angles is rescaled by the ASANN angular correction term. - ‘SC-ASANN’: If correction is set to ‘SC-ASANN’, the total sum of solid angles is rescaled by the ASANN angular correction term, computed in a self-consistent manner. Arguably better CNs, but more time consuming and less regularized continuous CNs. - None (or anything else): No correction term applied. This is equivalent to the SANN algorithm.

reduce_mode: Edges counting mode. The ASANN/SANN algorithm can only find directed edges (e.g. find i->j but not j->i). This parameter defines the conversion mode from directed to undirected edges. Possible values: - ‘both’: An undirected edge (i,j) is present only if both related directed edges (i->j and j->i) are found. - ‘any’: An undirected edge (i,j) is present if any related directed edge (i->j or j->i) is found. - None: All directed edges are given, no reduction is performed. Default: None.

Returns: (asann_CNs, asann_radius, asann_edges) asann_CNs (numpy array): list of coordination numbers computed. The order is the same as provided in list_coords. asann_radius (numpy array): list of coordination radii computed. The order is the same as provided in list_coords. asann_edges ( list of tuples): list of edges found. Each edge is represented as a tuple (i,j), meaning that j was found as a neighbor of i. Note: if edges is set to False, asann_edges is set to None.

Computational details:

Correction:

The SANN algorithm computes the coordination number (i.e. CN) m of atom i, as the minimum integer m>=3 satisfying R_i_m = sum(r_ij, j=1..m)/(m-2) < r_i(m+1) (assuming r_ij are sorted: r_i(j-1) <= r_ij <= r_i(j+1))

This formula is equivalent to determining a sphere of radius R_i_m, such that the sum of all solid angles of inner atoms is 4π. The solid angle of atom j with respect to atom i, is the solid angle of the spherical cap of height r_ij on the sphere of radius R_i_m (i.e. SA_ij = 2π(1-r_ij/R_i_m)). However, at interfaces, it is expected that neighbors do not fill the whole space (i.e. the sum of solid angles should not be 4π)

Hence we propose here an angular correction which is exact in the case of infinitely evenly distributed neighbors along a spherical cap. Indeed, assuming that a normal vector can be meaningfully defined at the interface, a correction is needed when the neighbors barycenter is far from the central atom.

Therefore, the neighbors barycenter is computed. From this barycenter, one deduces the corresponding spherical cap on the sphere of radius R_i_m. Its solid angle is then taken instead of 4π.

Consequently, this angular correction assumes a spherical cap-like distribution of the nearest neighbors.

Continuous:

The continuous coordination number algorithm scales the contributions of each neighbor by the following weight : SA/SA_max (where SA is the solid angle associated with the corresponding neighbor, and SA_max is the maximum solid angle ( i.e. the solid angle associated with the nearest neighbor)) The continuous coordination number is then the sum of all weights.

Generalized:

The generalized coordination number algorithm scales the contributions of each neighbor by the following weight : CN/CN_max (where CN is the coordination number associated with the corresponding neighbor, and CN_max is the maximum coordination number (i.e. the coordination number associated with the most coordinated neighbor)) The generalized coordination number is then the sum of all weights (weighted futhermore, or not, by the continuous algorithm).

dockonsurf.ASANN.dist_to_barycenter(nearest_neighbors, nearest_distances, radius)

Compute the distance from the central atom to the barycenter of nearest neighbors.

Parameters: nearest_neighbors: numpy 2D array containing nearest neighbors vectors from the central atom, sorted by increasing distance with respect to the central atom. Important: The vectors must be in cartesian coordinates.

nearest_distances: numpy 1D array containing nearest neighbors distances from the central atom, sorted by increasing distance with respect to the central atom.

radius (float): radius R_i_m of the sphere of coordination.

Returns: dist_bary (float): distance from the central atom to the barycenter of nearest neighbors, weighted by relative solid angles

Computational details: The barycenter is computed using a solid angle weight (i.e. the solid angle associated with the corresponding neighbor).

dockonsurf.ASANN.get_ASANN(sorted_distances, sorted_vectors, sann_CNs, sann_radii)

Update ASANN-based coordination numbers using an angular correction term.

Parameters: sorted_vectors: numpy 3D array containing pairwise vectors from coords, where each i-th row is sorted by increasing distance with respect to the i-th coordinates. Important: The vectors must be in cartesian coordinates. sorted_vectors[i,j] = (v_ij_x, v_ij_y, v_ij_z) = ( r_j_x - r_i_x, r_j_y - r_i_y, r_j_z - r_i_z) Shape : (nb_atoms, nb_coords, nb_dim)

sorted_distances: numpy 2D array containing pairwise distances from coords, where each i-th row is sorted by increasing distance with respect to the i-th coordinates. Important: Cartesian euclidian distance is used here. sorted_distances[i,j-1] <= sorted_distances[i, j] <= sorted_distances[i,j+1] Shape : (nb_atoms, nb_coords)

sann_CNs: Numpy 1D array containing SANN-based coordination numbers ( i.e. number of neighbors).

sann_radii: Numpy 1D array containing SANN-based coordination radius (i.e. radius of the coordination spheres).

Returns: list_asann_CN : Numpy 1D array containing ASANN-based coordination numbers (i.e. number of neighbors, with an angular correction term).

list_asann_radius : Numpy 1D array containing ASANN-based coordination radius (i.e. coordination sphere radius).

Computational details: ASANN-based coordination number is defined as the maximum coordination number m’ such that forall m>=m’, R_ang_i_m = sum( r_ij, j=1..m)/(m-2(1-ang_corr)) < r_i(m+1)

It is easy to show that R_ang_i_m <= R_i_m, and therefore, m’<=m. Consequently, the ASANN algorithm is sure to converge.

Unlike SC-ASANN algorithm, the angular correction is solely computed using the SANN radius (instead of a self-coherent approach, where the angular term is defined by (and defines) the ASANN radius itself)

dockonsurf.ASANN.get_SANN(all_distances)

Computes coordination numbers according to the SANN algorithm, from all pairwise distances.

Parameters: all_distances: numpy 2D array containing pairwise distances from coords, where each i-th row is sorted by increasing distance with respect to the i-th coordinates. Important: Cartesian euclidian distance is used here. sorted_distances[i,j-1] <= sorted_distances[i, j] <= sorted_distances[i,j+1] Shape : (nb_atoms, nb_coords)

Returns: list_sann_CN : Numpy 1D array containing SANN-based coordination numbers (i.e. number of neighbors).

list_sann_radius : Numpy 1D array containing SANN-based coordination radius (i.e. coordination sphere radius).

dockonsurf.ASANN.get_edges(list_CN, sorted_indexes, reduce_mode=None, nb_atoms=None)

Compute all edges corresponding with the connectivity graph of the given structure, based on discretized coordination numbers.

Parameters: list_CN: Numpy 1D array containing the discretized coordination numbers (i.e. number of neighbors).

sorted_indexes: Numpy 2D array containing for each row the distances-sorted indexes of neighbors. In other words, the atom indexed sorted_indexes[i,j] is the j-th nearest neighbor of atom i. Shape: (nb_atoms, nb_coords)

reduce_mode: Edges counting mode. The ASANN/SANN algorithm can only find directed edges (i.e. find i->j but not j->i). This parameter defines the conversion mode from directed to undirected edges. Possible values: None: All directed edges are given, no reduction is performed. ‘both’: An undirected edge (i,j) is present only if both related directed edges (i->j and j->i) are found. ‘any’: An undirected edge (i,j) is present if any related directed edge (i->j or j->i) is found.

nb_atoms (int, optional): Number of real atoms coordinates (i.e. for which distances must be computed). This is particularly useful for excluding periodic images coordinates as central atoms. If None, all coordinates are considered. Default: None

Returns:
list_edges: List containing all edges of the connectivity graph.

The edges are in the form of a couple (index_node_i, index_node_j) Shape: (nb_bonds_found, 2)

dockonsurf.ASANN.get_generalized(list_CN, list_weights, sorted_indexes, max_CN=None)

Convert coordination numbers into generalized coordination numbers.

Parameters:

list_CN: Numpy 1D array containing the coordination numbers.

list_weights: 2D list containing the distance-related weights to apply to each neighbors of each atom. Note: In the case of discretized version, each weight is equal to 1.

sorted_indexes: Numpy 2D array containing for each row the distances-sorted indexes of neighbors. In other words, the atom indexed sorted_indexes[i,j] is the j-th nearest neighbor of atom i. Shape = (nb_atoms, nb_coords)

max_CN (int, optional): Value to use for the maximum coordination number, i.e. bulk coordination. If None, the maximum/bulk coordination number will be guessed. Default: None

Returns: list_generalized_CN: Numpy 1D array containing generalized coordination numbers.

Computational details: The generalized coordination number algorithm scales the contributions of each neighbor by the following weight : CN/CN_max (where CN is the coordination number associated with the corresponding neighbor, and CN_max is the maximum coordination achievable (i.e. bulk coordination)) The generalized coordination number is then the sum of all weights (GCN = sum(CN/max_CN, neighbors))

This sum can be weighted futhermore (GCN = sum(CN/max_CN*SA/max_SA, neighbors)), using the continuous algorithm if requested (see help( convert_continuous) for more details on this algorithm).

dockonsurf.ASANN.get_pbc_vectors(coords, pbc, nb_atoms=None)

Compute pairwise vectors with or without periodic boundaries conditions.

Parameters:

coords (numpy 2D array): List of atoms coordinates to consider. Important: direct coordinates are expected (torus topology of side 1) if pbc is set to True. Shape expected: (nb_coords, nb_dim), where nb_coords is the number of coordinates considered, and nb_dim is the dimensionnality of the system.

pbc (bool): Determines if periodic boundaries conditions should be applied. Default to True. If True, coordinates are interpreted as direct coordinates and the distance between points is computed as the minimum euclidian distance between all duplicates (due to periodic boundaries conditions) of these points. If false, coordinates are interpreted as cartesian coordinates and the metric used is simply the euclidian distance. Note: the minimum image convention is not applied if periodic images are already explicitely included.

nb_atoms (int, optional): Number of real atoms coordinates (i.e. for which distances must be computed). This is particularly useful for excluding periodic images coordinates as central atoms. The real atoms coordinates are supposed to be the first coordinates in coords

Returns: numpy 2D array containing pairwise vectors from coords. Important: if coords are direct coordinates (i.e. pbc is set to True), the vectors are in direct coordinates. If coords are in cartesian coordinates (i.e. pbc is set to False), the vectors are in cartesian coordinates. vectors[i,j] = (v_ij_x, v_ij_y, v_ij_z) = (r_j_x - r_i_x, r_j_y - r_i_y, r_j_z - r_i_z) Shape : (nb_atoms, nb_coords, nb_dim)

dockonsurf.ASANN.get_self_consistent_ASANN(sorted_distances, sorted_vectors, sann_CNs, radius_eps=0.01)

Update ASANN-based coordination numbers using an angular correction term computed in a self-consistent manner.

Parameters: sorted_vectors: numpy 3D array containing pairwise vectors from coords, where each i-th row is sorted by increasing distance with respect to the i-th coordinates. Important: The vectors must be in cartesian coordinates. sorted_vectors[i,j] = (v_ij_x, v_ij_y, v_ij_z) = ( r_j_x - r_i_x, r_j_y - r_i_y, r_j_z - r_i_z) Shape: (nb_atoms, nb_atoms, nb_dim)

sorted_distances: numpy 2D array containing pairwise distances from coords, where each i-th row is sorted by increasing distance with respect to the i-th coordinates. Important: Cartesian euclidian distance is used here. sorted_distances[i,j-1] <= sorted_distances[i, j] <= sorted_distances[i,j+1] Shape: (nb_atoms, nb_atoms)

sann_CNs: Numpy 1D array containing SANN-based coordination numbers ( i.e. number of neighbors).

radius_eps: Convergence threshold used for stopping the self-consistent radius computation. Default: 1e-2

Returns: list_asann_CN : Numpy 1D array containing ASANN-based coordination numbers (i.e. number of neighbors, with an angular correction term).

list_asann_radius : Numpy 1D array containing ASANN-based coordination radius (i.e. coordination sphere radius).

Computational details: SC-ASANN-based coordination number is defined as the maximum coordination number m’ such that forall m>=m’, R_ang_i_m = sum(r_ij, j=1..m)/(m-2(1-ang_corr)) < r_i(m+1)

Note that the angular correction term is computed here using the ASANN radius (defined itself from the angular correction term). In this approach, the angular correction term is computed in a self-consistent fashion.

dockonsurf.ASANN.get_sorted_distances(coords, pbc, nb_atoms=None, cell=numpy.eye)

Compute distances-sorted pairwise distances and vectors with or without periodic boundaries conditions.

Parameters: coords (numpy 2D array): List of atoms coordinates to consider. Important: direct coordinates are expected (torus topology of side 1) if pbc is set to True. Shape expected: (nb_atoms, nb_dim), where nb_atoms is the number of atoms considered, and nb_dim is the dimensionnality of the system.

pbc (bool): Determines if periodic boundaries conditions should be applied. Default to True. If True, coordinates are interpreted as direct coordinates and the distance between points is computed as the minimum euclidian distance between all duplicates (due to periodic boundaries conditions) of these points. If false, coordinates are interpreted as cartesian coordinates and the metric used is simply the euclidian distance.

nb_atoms (int, optional): Number of real atoms coordinates (i.e. for which distances must be computed). This is particularly useful for excluding periodic images coordinates as central atoms. If None, all coords coordinates are considered. Default: None

cell (2D array, optional): List of cell vectors to consider when periodic boundaries conditions are considered. Shape expected: ( nb_dim, nb_dim), where nb_dim is the dimensionnality of the system considered. Important: For this parameter to be taken into account, pbc must be set to True. Exemple: cell_vectors=[[v1_x, v1_y, v1_z], [v2_x, v2_y, v2_z], [v3_x, v3_y, v3_z]] Default: numpy.eye(3) (i.e. a cubic cell of side 1).

Returns: (sorted_distances, sorted_vectors, sorted_indexes) sorted_vectors: numpy 3D array containing pairwise vectors from coords, where each i-th row is sorted by increasing distance with respect to the i-th coordinates. Important: The vectors are in cartesian coordinates. sorted_vectors[i,j] = (v_ij_x, v_ij_y, v_ij_z) = (r_j_x - r_i_x, r_j_y - r_i_y, r_j_z - r_i_z) Shape : (nb_atoms, nb_coords, nb_dim) sorted_distances: numpy 2D array containing pairwise distances from coords, where each i-th row is sorted by increasing distance with respect to the i-th coordinates. Important: Cartesian euclidian distance is used here. sorted_distances[i,j-1] <= sorted_distances[i, j] <= sorted_distances[i,j+1] Shape : (nb_atoms, nb_coords) sorted_indexes: numpy 2D array containing for each row the distances-sorted indexes of neighbors. In other words, the atom indexed sorted_indexes[i,j] is the j-th nearest neighbor of atom i. Shape : ( nb_atoms, nb_coords)

Calculation

Functions

check_finished_calcs: Checks if the calculations finished normally or not.

prep_cp2k: Prepares the directories to run calculations with CP2K.

prep_vasp: Prepares the directories to run calculations with VASP.

get_jobs_status: Returns a list of job status for a list of job ids.

submit_jobs: Submits jobs to a custom queuing system with the provided script

run_calc: Directs calculation run/submission

dockonsurf.calculation.check_finished_calcs(run_type, code)

Checks if the calculations finished normally or not.

@param run_type: The type of calculation to check. @param code: The code used for the specified job. @return finished_calcs: List of calculation directories that have finished normally. @return unfinished_calcs: List of calculation directories that have finished abnormally.

dockonsurf.calculation.get_jobs_status(job_ids, stat_cmd, stat_dict)

Returns a list of job status for a list of job ids.

@param job_ids: list of all jobs to be checked their status. @param stat_cmd: Command to check job status. @param stat_dict: Dictionary with pairs of job status (r, p, f) and the

pattern it matches in the output of the stat_cmd.

@return: list of status for every job.

dockonsurf.calculation.prep_cp2k(inp_file: str, run_type: str, atms_list: list, proj_name: str)

Prepares the directories to run calculations with CP2K.

@param inp_file: CP2K Input file to run the calculations with. @param run_type: Type of calculation. ‘isolated’, ‘screening’ or

‘refinement’

@param atms_list: list of ase.Atoms objects to run the calculation of. @param proj_name: name of the project @return: None

dockonsurf.calculation.prep_vasp(inp_files, run_type, atms_list, proj_name, cell, potcar_dir)

Prepares the directories to run calculations with VASP.

@param inp_files: VASP Input files to run the calculations with. @param run_type: Type of calculation. ‘isolated’, ‘screening’ or

‘refinement’

@param atms_list: list of ase.Atoms objects to run the calculation of. @param proj_name: name of the project. @param cell: Cell for the Periodic Boundary Conditions. @param potcar_dir: Directory to find POTCARs for each element. @return: None

dockonsurf.calculation.run_calc(run_type, inp_vars, atms_list)

Directs the calculation run/submission.

@param run_type: Type of calculation. ‘isolated’, ‘screening’ or ‘refinement’ @param inp_vars: Calculation parameters from input file. @param atms_list: List of ase.Atoms objects containing the sets of atoms aimed to run the calculations of.

dockonsurf.calculation.submit_jobs(run_type, sub_cmd, sub_script, stat_cmd, stat_dict, max_jobs, name)

Submits jobs to a custom queuing system with the provided script

@param run_type: Type of calculation. ‘isolated’, ‘screening’, ‘refinement’ @param sub_cmd: Bash command used to submit jobs. @param sub_script: script for the job submission. @param stat_cmd: Bash command to check job status. @param stat_dict: Dictionary with pairs of job status: r, p, f (ie. running

pending and finished) and the pattern it matches in the output of the stat_cmd.

@param max_jobs: dict: Contains the maximum number of jobs to be both

running, pending/queued and pending+running. When the relevant maximum is reached no jobs more are submitted.

@param name: name of the project.

Internal Angles

dockonsurf.internal_rotate.internal_rotate(molecule, surf, ctr1_mol, ctr2_mol, ctr3_mol, ctr1_surf, ctr2_surf, bond_vector, bond_angle_target, dihedral_angle_target=None, mol_dihedral_angle_target=None)

Performs translation and rotation of an adsorbate defined by an adsorption bond length, direction, angle and dihedral angle

Carles modification of chemcat’s transform_adsorbate to work with coordinates instead of ase.Atom Parameters:

molecule (ase.Atoms): The molecule to adsorb.

surf (ase.Atoms): The surface ontop of which to adsorb.

ctr1_mol (int/list): The position of the adsorption center in the molecule that will be bound to the surface.

ctr2_mol (int/list): The position of a second center of the adsorbate used to define the adsorption bond angle, and the dihedral adsorption angle.

ctr3_mol (int/list): The position of a third center in the adsorbate used to define the adsorbate dihedral angle.

ctr1_surf (int/list): The position of the site on the surface that will be bound to the molecule.

ctr2_surf (int/list): The position of a second center of the surface used to define the dihedral adsorption angle.

bond_vector (numpy.ndarray): The adsorption bond desired.

Details: offset = vect(atom1_surf, atom1_mol)

bond_angle_target (float or int): The adsorption bond angle desired (in

degrees). Details: bond_angle_target = angle(atom1_surf, atom1_mol, atom2_mol)

dihedral_angle_target (float or int): The dihedral adsorption angle

desired (in degrees). Details: dihedral_angle_target = dihedral(atom2_surf, atom1_surf, atom1_mol, atom2_mol)

The rotation vector is facing the adsorbate from the surface (i.e. counterclockwise rotation when facing the surface (i.e. view from top))

mol_dihedral_angle_target (float or int): The adsorbate dihedral angle

desired (in degrees). Details: mol_dihedral_angle_target = dihedral(atom1_surf, atom1_mol, atom2_mol, atom3_mol)

The rotation vector is facing atom2_mol from atom1_mol

Returns:

None (the molecule object is modified in-place)