Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinp0 committed Sep 26, 2024
1 parent a0e38f4 commit 7a69a37
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
22 changes: 9 additions & 13 deletions arc/job/adapters/ts/heuristics.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,8 @@ def h_abstraction(arc_reaction: 'ARCReaction',
rmg_product_mol = rmg_reaction.products[int(not products_reversed)].molecule[0]
h1 = rmg_reactant_mol.atoms.index([atom for atom in rmg_reactant_mol.atoms if atom.label == '*2'][0])
h2 = rmg_product_mol.atoms.index([atom for atom in rmg_product_mol.atoms if atom.label == '*2'][0])

a = rmg_reactant_mol.atoms.index(list(rmg_reactant_mol.atoms[h1].edges.keys())[0])
b = rmg_product_mol.atoms.index(list(rmg_product_mol.atoms[h2].edges.keys())[0])
c = find_distant_neighbor(rmg_mol=rmg_reactant_mol, start=h1)
d = find_distant_neighbor(rmg_mol=rmg_product_mol, start=h2)

Expand Down Expand Up @@ -1052,18 +1053,11 @@ def h_abstraction(arc_reaction: 'ARCReaction',
# TODO: What happens if the result is decimal? For example, 1 + 4 = 2.5, round up

# Get the first ATOM A - H - B for constraints
# The A atom will be the heavy atom closest to the H atom in the TS guess, so go reverse from H to find it and then see its index
a_atom = None
for i in range(h_atom - 1, -1, -1):
if not xyz_guesses[0]['symbols'][i] == 'H':
a_atom = int(i)
break
# Find B atom, the heavy atom closest to the H atom in the TS guess forward
b_atom = None
for i in range(h_atom + 1, len(xyz_guesses[0]['symbols'])):
if not xyz_guesses[0]['symbols'][i] == 'H':
b_atom = int(i)
break
# We know that the two atoms are being joined, so firstly for b atom, it will be the molecule first in the combined list
# So we take b
b_atom = b
# For A atom, we know its of mol 2 which is added onto mol 1, so we should get the total of mol 1 and then add onto a
a_atom = a + len(arc_reactant.get_xyz()['symbols'])
xyz_guess = crest_ts_conformer_search(xyz_guesses_crest, a_atom, h_atom, b_atom, path=path)
if xyz_guess is not None:
logger.info('Successfully completed crest conformer search:'
Expand All @@ -1085,6 +1079,8 @@ def crest_ts_conformer_search(xyz_guess: dict, a_atom: int, h_atom: int, b_atom:
"""
path = os.path.join(path, 'crest')
if not os.path.exists(path):
os.makedirs(path)

# Write coords to coords.ref file
symbols = xyz_guess['symbols']
Expand Down
10 changes: 5 additions & 5 deletions arc/settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,13 @@
# check if using micromamba, mambaforge, anaconda3, miniconda3, or .conda
if 'micromamba' in crest_path:
# CREST_ENV_PATH = "source ~/micromamba/etc/profile.d/micromamba.sh && micromamba activate crest_env"
CREST_ENV_PATH = "source ~/micromamba/etc/profile.d/micromamba.sh && micromamba activate crest_env"
CREST_ENV_PATH = "source ~/.bashrc && micromamba activate crest_env"
elif 'mambaforge' in crest_path:
CREST_ENV_PATH = "source ~/mambaforge/etc/profile.d/mamba.sh && mamba activate crest_env"
CREST_ENV_PATH = "source ~/.bashrc && mamba activate crest_env"
elif 'anaconda3' in crest_path:
CREST_ENV_PATH = "source ~/anaconda3/etc/profile.d/conda.sh && conda activate crest_env"
CREST_ENV_PATH = "source ~/.bashrc && conda activate crest_env"
elif 'miniconda3' in crest_path:
CREST_ENV_PATH = "source ~/miniconda3/etc/profile.d/conda.sh && conda activate crest_env"
CREST_ENV_PATH = "source ~/.bashrc && conda activate crest_env"
elif '.conda' in crest_path:
CREST_ENV_PATH = "source ~/.conda/etc/profile.d/conda.sh && conda activate crest_env"
CREST_ENV_PATH = "source ~/.bashrc && conda activate crest_env"
break
2 changes: 1 addition & 1 deletion devtools/install_crest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fi

# create the environment
echo "Creating the Crest environment..."
$COMMAND_PKG create -n crest_env -c conda-forge python=3.10 crest -y
$COMMAND_PKG create -n crest_env -c conda-forge python=3.10 crest=2.12 -y
# Activate the environment
if [ "$COMMAND_PKG" == "micromamba" ]; then
micromamba activate crest_env
Expand Down

0 comments on commit 7a69a37

Please sign in to comment.