Skip to content

Commit

Permalink
Merge pull request #270 from wladerer/master
Browse files Browse the repository at this point in the history
Update `pyxtal.io.search_molecules_in_crystal`  to have an option for missing bond lengths
  • Loading branch information
qzhu2017 authored Aug 15, 2024
2 parents 7f07a19 + 598cd8a commit 01f51fe
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pyxtal/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def show(self, overlay=True):
return display_molecules([self.ref_mol, self.molecule])


def search_molecules_in_crystal(struc, tol=0.2, once=False, ignore_HH=True):
def search_molecules_in_crystal(struc, tol=0.2, once=False, ignore_HH=True, max_bond_length=None):
"""
Function to perform to find the molecule in a Pymatgen structure
Expand All @@ -500,6 +500,7 @@ def search_molecules_in_crystal(struc, tol=0.2, once=False, ignore_HH=True):
tol: tolerance value to check the connectivity
once: search only one molecule or all molecules
ignore_HH: whether or not ignore the short H-H in checking molecule
max_bond_length: sets maximum bond length if bond length is missing in bond length database
Returns:
molecules: list of pymatgen molecules
Expand Down Expand Up @@ -539,7 +540,7 @@ def check_one_site(struc, site0, visited, rmax=2.8):
sites_add.append(site1)
ids_add.append(site1.index)
else:
if d < bonds[key]:
if d < bonds.get(key,max_bond_length):
if pbc:
site1.frac_coords += image
sites_add.append(site1)
Expand Down

0 comments on commit 01f51fe

Please sign in to comment.