Révision 5f3f4b69
b/modules/screening.py | ||
---|---|---|
130 | 130 |
slab.extend(ads) |
131 | 131 |
|
132 | 132 |
|
133 |
def check_collision(slab_molec, slab_num_atoms, min_height, vect, nn_slab, |
|
134 |
nn_molec, coll_coeff): |
|
135 |
"""Checks whether a slab and a molecule collide or not. |
|
136 |
|
|
137 |
@param slab_molec: The system of adsorbate-slab for which to detect if there |
|
138 |
are collisions. |
|
139 |
@param nn_slab: Number of neigbors in the surface. |
|
140 |
@param nn_molec: Number of neighbors in the molecule. |
|
141 |
@param coll_coeff: The coefficient that multiplies the covalent radius of |
|
142 |
atoms resulting in a distance that two atoms being closer to that is |
|
143 |
considered as atomic collision. |
|
144 |
@param slab_num_atoms: Number of atoms of the bare slab. |
|
145 |
@param min_height: The minimum height atoms can have to not be considered as |
|
146 |
colliding. |
|
147 |
@param vect: The vector perpendicular to the slab. |
|
148 |
@return: bool, whether the surface and the molecule collide. |
|
149 |
""" |
|
150 |
from ase.neighborlist import natural_cutoffs, neighbor_list |
|
151 |
if (vect == np.array([1.0, 0.0, 0.0])).all \ |
|
152 |
or (vect == np.array([0.0, 1.0, 0.0])).all \ |
|
153 |
or (vect == np.array([0.0, 0.0, 1.0])).all: |
|
154 |
for atom in slab_molec[slab_num_atoms:]: |
|
155 |
if np.linalg.norm(atom.position * vect) < min_height: |
|
156 |
return True |
|
157 |
slab_molec_cutoffs = natural_cutoffs(slab_molec, mult=coll_coeff) |
|
158 |
slab_molec_nghbs = len(neighbor_list("i", slab_molec, slab_molec_cutoffs)) |
|
159 |
if slab_molec_nghbs > nn_slab + nn_molec: |
|
160 |
return True |
|
161 |
else: |
|
162 |
return False |
|
163 |
|
|
164 |
|
|
133 | 165 |
|
134 | 166 |
def ads_euler(orig_molec, slab, ctr_coord, site_coord, num_pts, |
135 | 167 |
coll_bttm, coll_coeff, norm_vect, slab_nghbs, molec_nghbs): |
Formats disponibles : Unified diff