Révision e5faf87a
b/modules/screening.py | ||
---|---|---|
220 | 220 |
for atom in molec: |
221 | 221 |
if atom.index == ctr_idx: |
222 | 222 |
continue |
223 |
if molec.get_distance(ctr_idx, atom) < min_dist: |
|
223 |
if molec.get_distance(ctr_idx, atom.index) < min_dist:
|
|
224 | 224 |
min_dist = molec.get_distance(ctr_idx, atom.index) |
225 | 225 |
min_idx = atom.index |
226 | 226 |
cutoffs[ctr_idx] = min_dist - cutoffs[min_idx] + 0.05 |
... | ... | |
228 | 228 |
self_interaction=False) |
229 | 229 |
neigh_vects = [vects[i] for i, atm in enumerate(refs) if atm == ctr_idx] |
230 | 230 |
target_vect = vect_avg(neigh_vects) |
231 |
# If the target vector is 0 it gets reassigned to the vector pointing |
|
232 |
# towards the nearest atom. |
|
233 |
if target_vect.tolist() == [0, 0, 0]: |
|
234 |
target_vect = np.array([np.inf] * 3) |
|
231 |
# If the target vector is 0 (the center is at the baricenter of its |
|
232 |
# neighbors). Assuming the adsorption center is coplanar or colinear to its |
|
233 |
# neighbors (it would not make a lot of sense to chose a center which is |
|
234 |
# the baricenter of neighbors distributed in 3D), the target_vector is |
|
235 |
# chosen perpendicular to the nearest neighbor. |
|
236 |
if np.allclose(target_vect, 0, rtol=1e-3): |
|
237 |
nn_vect = np.array([np.inf] * 3) |
|
235 | 238 |
for vect in neigh_vects: |
236 |
if np.linalg.norm(vect) < np.linalg.norm(target_vect): |
|
237 |
target_vect = vect |
|
239 |
if np.linalg.norm(vect) < np.linalg.norm(nn_vect): |
|
240 |
nn_vect = vect |
|
241 |
cart_axes = [[1, 0, 0], [0, 1, 0], [0, 0, 1]] |
|
242 |
axis = cart_axes[int(np.argmax([np.linalg.norm(np.cross(ax, nn_vect)) |
|
243 |
for ax in cart_axes]))] |
|
244 |
target_vect = np.cross(axis, nn_vect) |
|
238 | 245 |
|
239 | 246 |
rot_vect = np.cross(target_vect, ref_vect) |
240 | 247 |
if np.allclose(rot_vect, 0): |
... | ... | |
525 | 532 |
""" |
526 | 533 |
from copy import deepcopy |
527 | 534 |
slab_ads_list = [] |
528 |
if np.any([np.allclose(ctr_coord, atom.position, rtol=1e-2) |
|
529 |
for atom in orig_molec]): |
|
530 |
orig_molec = align_molec(orig_molec, ctr_coord, norm_vect) |
|
531 |
else: |
|
532 |
cart_axes = [[1, 0, 0], [0, 1, 0], [0, 0, 1]] |
|
533 |
axis = cart_axes[int(np.argmax([np.linalg.norm(np.cross(ax, norm_vect)) |
|
534 |
for ax in cart_axes]))] |
|
535 |
align_vect = np.cross(axis, norm_vect) |
|
536 |
orig_molec = align_molec(orig_molec, ctr_coord, align_vect) |
|
535 |
orig_molec = align_molec(orig_molec, ctr_coord, norm_vect) |
|
537 | 536 |
# rotation around z |
538 | 537 |
for alpha in np.arange(0, 360, 360 / num_pts): |
539 | 538 |
# rotation around x' |
Formats disponibles : Unified diff