Révision f3d1e601
b/modules/screening.py | ||
---|---|---|
1 | 1 |
import logging |
2 |
import numpy as np |
|
3 |
import ase |
|
2 | 4 |
|
3 | 5 |
logger = logging.getLogger('DockOnSurf') |
4 | 6 |
|
5 | 7 |
|
8 |
def get_atom_coords(atoms: ase.Atoms, ctrs_list): |
|
9 |
pass |
|
10 |
|
|
11 |
|
|
12 |
def ads_euler(site, ctr, pts_angle, neigh_ctr): |
|
13 |
pass |
|
14 |
|
|
15 |
|
|
16 |
def ads_chemcat(site, ctr, pts_angle): |
|
17 |
pass |
|
18 |
|
|
19 |
|
|
20 |
def adsorb_confs(conf_list, surf, ads_ctrs, sites, algo, num_pts, neigh_ctrs): |
|
21 |
surf_ads_list = [] |
|
22 |
sites_coords = get_atom_coords(surf, sites) |
|
23 |
for conf in conf_list: |
|
24 |
molec_ctr_coords = get_atom_coords(conf, ads_ctrs) |
|
25 |
molec_neigh_coords = get_atom_coords(conf, neigh_ctrs) |
|
26 |
for site in sites_coords: |
|
27 |
for i, molec_ctr in enumerate(molec_ctr_coords): |
|
28 |
if algo == 'euler': |
|
29 |
surf_ads_list.append(ads_euler(site, molec_ctr, num_pts, |
|
30 |
molec_neigh_coords[i])) |
|
31 |
elif algo == 'chemcat': |
|
32 |
surf_ads_list.append(ads_chemcat(site, molec_ctr, num_pts)) |
|
33 |
return surf_ads_list |
|
34 |
|
|
35 |
|
|
6 | 36 |
def run_screening(inp_vars): |
7 | 37 |
"""Carry out the screening of adsorbate coordinates on a surface |
8 | 38 |
|
... | ... | |
10 | 40 |
""" |
11 | 41 |
import os |
12 | 42 |
import numpy as np |
13 |
from modules.formats import read_coords, read_energies |
|
43 |
from modules.formats import read_coords, read_energies, \ |
|
44 |
rdkit_mol_to_ase_atoms, adapt_format |
|
14 | 45 |
from modules.clustering import get_rmsd, clustering |
15 |
from modules.isolated import get_moments_of_inertia |
|
46 |
from modules.isolated import get_moments_of_inertia, get_neighbors |
|
47 |
from modules.calculation import run_calc |
|
16 | 48 |
|
17 | 49 |
if not os.path.isdir("isolated"): |
18 | 50 |
err = "'isolated' directory not found. It is needed in order to carry " |
... | ... | |
20 | 52 |
logger.error(err) |
21 | 53 |
raise ValueError(err) |
22 | 54 |
|
23 |
ads_list = read_coords(inp_vars['code'], 'isolated', 'rdkit') |
|
24 |
ads_enrgs = read_energies(inp_vars['code'], 'isolated') |
|
25 |
mois = np.array([get_moments_of_inertia(ads)[0] for ads in ads_list]) |
|
26 |
rmsd_mtx = get_rmsd(ads_list) |
|
55 |
conf_list = read_coords(inp_vars['code'], 'isolated', 'rdkit') |
|
56 |
# TODO Implement neighbors algorithm |
|
57 |
# neigh_list = get_neighbors(conf_list[0], inp_vars['molec_ads_ctrs']) |
|
58 |
conf_enrgs = read_energies(inp_vars['code'], 'isolated') |
|
59 |
mois = np.array([get_moments_of_inertia(conf)[0] for conf in conf_list]) |
|
60 |
rmsd_mtx = get_rmsd(conf_list) |
|
27 | 61 |
exemplars = clustering(rmsd_mtx) |
62 |
conf_list = [conf_list[idx] for idx in exemplars] |
|
63 |
conf_list = [rdkit_mol_to_ase_atoms(conf) for conf in conf_list] |
|
64 |
surf = adapt_format('ase', inp_vars['surf_file']) |
|
65 |
surf_ads_list = adsorb_confs(conf_list, surf, inp_vars['molec_ads_ctrs'], |
|
66 |
inp_vars['sites'], inp_vars['ads_algo'], |
|
67 |
inp_vars['sample_points_per_angle'], |
|
68 |
inp_vars['molec_neigh_ctrs']) |
|
69 |
run_calc('screening', inp_vars, surf_ads_list) |
Formats disponibles : Unified diff