Skip to content

Commit

Permalink
Added a random offset for the x-y coords of adsorbates before they ar…
Browse files Browse the repository at this point in the history
…e placed on the slab.
  • Loading branch information
tdprice-858 committed Oct 10, 2023
1 parent ed98fc2 commit c4a43f4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pynta/mol.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from rdkit import Chem
from copy import deepcopy
import numpy as np
import random

def get_desorbed_with_map(mol):
molcopy = mol.copy(deep=True)
Expand Down Expand Up @@ -302,6 +303,13 @@ def add_adsorbate_to_site(atoms, adsorbate, surf_ind, site, height=None,
a.position = rm_n @ a.position

ads.translate(pos - bondpos)
# Randomly offsetting atoms to avoid highly symmetric structures
for atom in ads:
x_trans = random.choice([-0.05, 0.05])
y_trans = random.choice([-0.05, 0.05])
atom.position[0] += x_trans
atom.position[1] += y_trans

atoms += ads
if ads.get_chemical_formula() == 'H2':
shift = (atoms.positions[-2] - atoms.positions[-1]) / 2
Expand Down

0 comments on commit c4a43f4

Please sign in to comment.