6 |
6 |
|
7 |
7 |
|
8 |
8 |
def vect_avg(vects):
|
9 |
|
"""Computes the average of a set of vectors
|
|
9 |
"""Computes the element-wise mean of a set of vectors.
|
10 |
10 |
|
11 |
11 |
@param vects: np.ndarray with shape (num_vectors, length_vector).
|
12 |
|
@return: vector average computed doing the element-wise average.
|
|
12 |
@return: vector average computed doing the element-wise mean.
|
13 |
13 |
"""
|
14 |
14 |
from utilities import try_command
|
15 |
15 |
err = "vect_avg parameter vects must be a list-like, able to be converted" \
|
... | ... | |
23 |
23 |
|
24 |
24 |
|
25 |
25 |
def get_atom_coords(atoms: ase.Atoms, ctrs_list):
|
|
26 |
"""Gets the coordinates of the specified atoms from a ase.Atoms object.
|
|
27 |
|
|
28 |
Given an ase.Atoms object and a list of atom indices specified in ctrs_list
|
|
29 |
it gets the coordinates of the specified atoms. If the element in the
|
|
30 |
ctrs_list is not an index but yet a list of indices, it computes the
|
|
31 |
element-wise mean of the coordinates of the atoms specified in the inner
|
|
32 |
list.
|
|
33 |
@param atoms: ase.Atoms object for which to obtain the coordinates of.
|
|
34 |
@param ctrs_list: list of (indices/list of indices) of the atoms for which
|
|
35 |
the coordinates should be extracted.
|
|
36 |
@return: np.ndarray of atomic coordinates.
|
|
37 |
"""
|
26 |
38 |
coords = []
|
27 |
39 |
for i, elem in enumerate(ctrs_list):
|
28 |
40 |
if isinstance(elem, list):
|
... | ... | |
42 |
54 |
|
43 |
55 |
|
44 |
56 |
def ads_chemcat(site, ctr, pts_angle):
|
45 |
|
pass
|
|
57 |
return "TO IMPLEMENT"
|
46 |
58 |
|
47 |
59 |
|
48 |
60 |
def adsorb_confs(conf_list, surf, ads_ctrs, sites, algo, num_pts, neigh_ctrs):
|
|
61 |
"""Generates a number of adsorbate-surface structure coordinates.
|
|
62 |
|
|
63 |
Given a list of conformers, a surface, a list of atom indices (or list of
|
|
64 |
list of indices) of both the surface and the adsorbate, it generates a
|
|
65 |
number of adsorbate-surface structures for every possible combination of
|
|
66 |
them at different orientations.
|
|
67 |
@param conf_list: list of ase.Atoms of the different conformers
|
|
68 |
@param surf: the ase.Atoms object of the surface
|
|
69 |
@param ads_ctrs: the list atom indices of the adsorbate.
|
|
70 |
@param sites: the list of atom indices of the surface.
|
|
71 |
@param algo: the algorithm to use for the generation of adsorbates.
|
|
72 |
@param num_pts: the number of points per angle orientation to sample
|
|
73 |
@param neigh_ctrs: the indices of the neighboring atoms to the adsorption
|
|
74 |
atoms.
|
|
75 |
@return: list of ase.Atoms for the adsorbate-surface structures
|
|
76 |
"""
|
49 |
77 |
surf_ads_list = []
|
50 |
78 |
sites_coords = get_atom_coords(surf, sites)
|
51 |
79 |
for conf in conf_list:
|
... | ... | |
67 |
95 |
@param inp_vars: Calculation parameters from input file.
|
68 |
96 |
"""
|
69 |
97 |
import os
|
70 |
|
import numpy as np
|
71 |
98 |
from modules.formats import read_coords, read_energies, \
|
72 |
99 |
rdkit_mol_to_ase_atoms, adapt_format
|
73 |
100 |
from modules.clustering import get_rmsd, clustering
|
74 |
|
from modules.isolated import get_moments_of_inertia, get_neighbors
|
|
101 |
from modules.isolated import get_moments_of_inertia
|
75 |
102 |
from modules.calculation import run_calc
|
76 |
103 |
|
77 |
104 |
if not os.path.isdir("isolated"):
|