Skip to content

Commit

Permalink
Add initial NEB efforts.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgt16-LANL committed Sep 13, 2023
1 parent db82215 commit 33050a1
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
30 changes: 30 additions & 0 deletions architector/io_align_mol.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,36 @@ def mirror_align(tarmol, srcmol, maxiter=1, tol=1e-6):
srcmol_tmp.set_positions(newposits)
rmsd, outr, msrcmol = permute_align(tarmol,srcmol_tmp,maxiter=maxiter,tol=tol)
return rmsd, outr, msrcmol


def neb_align(tarmol, srcmol, maxiter=1, tol=1e-6):
"""neb_align
Align for NEB including mirror images.
Parameters
----------
tarmol : ase.atoms.Atoms
target molecule
srcmol : ase.atoms.Atoms
source molecule
maxiter : int, optional
how many times to try, by default 10
tol : float, optional
tolerance for convergence, by default 1e-2
Returns
-------
out : ase.atoms.Atoms
mirrored rotated version of the molecule.
"""
normal, _, out = permute_align(tarmol, srcmol,
maxiter=maxiter, tol=tol, in_place=False)
mirror, _, out2 = mirror_align(tarmol, srcmol,
maxiter=maxiter, tol=tol)
if mirror < normal:
out = out2

return out


def calc_rmsd(genMol, compareMol, coresize=2, maxiter=1, sample=300, atom_types=None,
Expand Down
27 changes: 27 additions & 0 deletions architector/io_neb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
Routines for performing ASE NEB from two structures generated at different distances
Developed by Michael Taylor
"""

from ase.neb import NEB
from architector.io_align_mol import neb_align
from architector.io_calc import CalcExecutor
from architector.io_molecule import convert_io_molecule

def NEB_setup(initial,final,nimages=8,neb_method='GFN2-xTB',interpolation='idpp',climb=True):
initial_mol = convert_io_molecule(initial)
final_mol = convert_io_molecule(final)
final_mol_ase = neb_align(initial_mol.ase_atoms,final_mol.ase_atoms)
final_mol.ase_atoms = final_mol_ase
images = [initial_mol.ase_atoms]
images += [initial_mol.ase_atoms.copy() for x in range(nimages-2)]
images += [final_mol.ase_atoms]
neb = NEB(images=images,climb=climb)
neb.interpolate(method=interpolation)
neb_images = []
for image in neb.images:
out = CalcExecutor(image,method=neb_method)
neb_images.append(out.mol.ase_atoms)
neb.images = neb_images
return neb

0 comments on commit 33050a1

Please sign in to comment.