Skip to content

Commit

Permalink
In process
Browse files Browse the repository at this point in the history
  • Loading branch information
dprada committed Apr 17, 2024
1 parent 8189f27 commit b81a218
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 394 deletions.
17 changes: 17 additions & 0 deletions molsysmt/_private/digestion/argument/attribute_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from ...exceptions import ArgumentError
from ...variables import is_all

def digest_attribute_type(attribute_type, caller=None):

if caller=='molsysmt.basic.compare.compare':

if attribute_type is None:
return None
elif is_all(attribute_type):
return 'all'
elif isinstance(attribute_type, str):
if attribute_type.lower() in ['topological', 'structural', 'mechanical']:
return attribute_type.lower()

raise ArgumentError('attribute_type', value=attribute_type, caller=caller, message=None)

17 changes: 0 additions & 17 deletions molsysmt/_private/digestion/argument/attributes_type.py

This file was deleted.

14 changes: 7 additions & 7 deletions molsysmt/basic/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@digest()
def compare(molecular_system, molecular_system_2, selection='all', structure_indices='all',
selection_2='all', structure_indices_2='all', syntax='MolSysMT', rule='equal',
output_type='boolean', attributes_type=None, **kwargs):
output_type='boolean', attribute_type=None, **kwargs):
"""
Comparing molecular systems.
Expand Down Expand Up @@ -67,7 +67,7 @@ def compare(molecular_system, molecular_system_2, selection='all', structure_ind
* 'dictionary': a dictionary is returned with the input attribute names as keys, and the corresponding booleans (True
or False) as values.
attribute_types : {'topological', 'structural', 'mecanichal', None}, default None
attribute_type : {'topological', 'structural', 'mecanichal', None}, default None
If no specific attributes are introduced as additional keywords, a set of attributes can be
chosen:
Expand Down Expand Up @@ -168,14 +168,14 @@ def compare(molecular_system, molecular_system_2, selection='all', structure_ind

atts_false = []

if isinstance(attributes_type, str):
if attributes_type == 'topological':
if isinstance(attribute_type, str):
if attribute_type == 'topological':
atts_to_be_compared += _topological_attributes
elif attributes_type == 'structural':
elif attribute_type == 'structural':
atts_to_be_compared += _structural_attributes
elif attributes_type == 'mechanical':
elif attribute_type == 'mechanical':
atts_to_be_compared += _mechanical_attributes
elif is_all(attributes_type):
elif is_all(attribute_type):
atts_to_be_compared += list(attributes.keys())

for key in kwargs.keys():
Expand Down
17 changes: 16 additions & 1 deletion molsysmt/build/get_missing_bonds.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ def get_missing_bonds(molecular_system, threshold='2 angstroms', selection='all'

if engine=="MolSysMT":

from molsysmt._private.atom_indices import complementary_atom_indices
from molsysmt.basic import get, select, get_form
from molsysmt.structure import get_neighbors
from molsysmt.structure import get_contacts
from molsysmt.element.group.amino_acid import get_bonded_atom_pairs as _bonds_in_amino_acid
from molsysmt.element.group.terminal_capping import get_bonded_atom_pairs as _bonds_in_terminal_capping
from molsysmt.element.group.terminal_capping import is_n_terminal_capping, is_c_terminal_capping
Expand All @@ -29,6 +30,20 @@ def get_missing_bonds(molecular_system, threshold='2 angstroms', selection='all'
bonds_templates = []
bonds_distances = []

n_atoms = get(molecular_system, n_atoms=True)
atoms_water = select(molecular_system, selection='group_type=="water"')
atoms_not_water = complementary_atom_indices(molecular_system, atoms_water)
heavy_atoms_not_water = select(molecular_system, selection='atom_type!="H"', mask=atoms_not_water)
h_atoms_no_water = [ii for ii in atoms_not_water if ii not in heavy_atoms_not_water]

if with_distances:

contacts_heavy_atoms = get_contacts(molecular_system, selection=heavy_atoms_not_water,
threshold=threshold, output_type='pairs',
output_indices='atom_index', pbc=True)

return contacts_heavy_atoms

if with_templates:

aux_peptidic_bonds_C={}
Expand Down
1 change: 1 addition & 0 deletions molsysmt/tests/basic/get/test_get_nglview_NGLWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import numpy as np



def test_get_nglview_NGLWidget_1():
molsys = msm.convert([systems['nglview']['md_1u19.gro'], systems['nglview']['md_1u19.xtc']],
to_form='molsysmt.MolSys')
Expand Down
Loading

0 comments on commit b81a218

Please sign in to comment.