Skip to content

Commit

Permalink
In process
Browse files Browse the repository at this point in the history
  • Loading branch information
dprada committed May 2, 2024
1 parent d5b599e commit 21cb8d2
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1,023 deletions.
4 changes: 1 addition & 3 deletions molsysmt/build/add_missing_bonds.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
@digest()
def add_missing_bonds(molecular_system, threshold='2 angstroms', selection='all',
structure_indices=0, syntax='MolSysMT', engine='MolSysMT',
with_templates=True, with_distances=True, in_place=True,
skip_digestion=False):
in_place=True, skip_digestion=False):
"""
To be written soon...
"""
Expand All @@ -18,7 +17,6 @@ def add_missing_bonds(molecular_system, threshold='2 angstroms', selection='all'

bonds = get_missing_bonds(molecular_system, threshold=threshold, selection=selection,
structure_indices=structure_indices, syntax=syntax,
with_templates=with_templates, with_distances=with_distances,
skip_digestion=True)

return add_bonds(molecular_system, bonds, in_place=in_place, skip_digestion=True)
Expand Down
15 changes: 13 additions & 2 deletions molsysmt/build/get_missing_bonds.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def get_missing_bonds(molecular_system, threshold='2 angstroms', selection='all'
from molsysmt.element.group.small_molecule import get_bonded_atom_pairs as _bonds_in_small_molecule
from molsysmt.element.group.terminal_capping import is_n_terminal_capping, is_c_terminal_capping

old_bonds = get(molecular_system, bonded_atom_pairs=True)

aux_lists = get(molecular_system, element='group', selection=selection, group_name=True,
group_type=True, atom_index=True, atom_name=True,
skip_digestion=True)
Expand Down Expand Up @@ -149,6 +151,15 @@ def get_missing_bonds(molecular_system, threshold='2 angstroms', selection='all'
tmp_bonds += bond
bonds = tmp_bonds


if old_bonds:

tmp_bonds = []
for ii in bonds:
if ii not in old_bonds:
tmp_bonds.append(ii)
bonds = tmp_bonds

elif engine=="pytraj":

from molsysmt.basic import convert, get
Expand Down Expand Up @@ -182,8 +193,8 @@ def get_missing_bonds(molecular_system, threshold='2 angstroms', selection='all'

raise NotImplementedMethodError

#if sorted:
# bonds = _sorted(bonds)
if sorted:
bonds = _sorted(bonds)

return bonds

Expand Down
Loading

0 comments on commit 21cb8d2

Please sign in to comment.