Skip to content

Commit

Permalink
In process
Browse files Browse the repository at this point in the history
  • Loading branch information
dprada committed May 4, 2024
1 parent 72f7373 commit 1fc3b33
Show file tree
Hide file tree
Showing 14 changed files with 274 additions and 207 deletions.
9 changes: 9 additions & 0 deletions molsysmt/_private/digestion/argument/copy_if_None.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from molsysmt._private.exceptions import ArgumentError

def digest_copy_if_None(copy_if_None, caller=None):

if isinstance(copy_if_None, bool):
return copy_if_None

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

3 changes: 3 additions & 0 deletions molsysmt/_private/digestion/argument/n_atoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def digest_n_atoms(n_atoms, caller=None):
elif caller=='molsysmt.native.topology.__init__':
if isinstance(n_atoms, int):
return n_atoms
elif caller=='molsysmt.native.molsys.__init__':
if isinstance(n_atoms, int):
return n_atoms

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

3 changes: 3 additions & 0 deletions molsysmt/_private/digestion/argument/n_bonds.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ def digest_n_bonds(n_bonds, caller=None):
elif caller=='molsysmt.native.topology.__init__':
if isinstance(n_bonds, int):
return n_bonds
elif caller=='molsysmt.native.molsys.__init__':
if isinstance(n_bonds, int):
return n_bonds

raise ArgumentError('n_entities', value=n_entities, caller=caller, message=None)
3 changes: 3 additions & 0 deletions molsysmt/_private/digestion/argument/n_chains.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def digest_n_chains(n_chains, caller=None):
elif caller=='molsysmt.native.topology.__init__':
if isinstance(n_chains, int):
return n_chains
elif caller=='molsysmt.native.molsys.__init__':
if isinstance(n_chains, int):
return n_chains

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

3 changes: 3 additions & 0 deletions molsysmt/_private/digestion/argument/n_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def digest_n_components(n_components, caller=None):
elif caller=='molsysmt.native.topology.__init__':
if isinstance(n_components, int):
return n_components
elif caller=='molsysmt.native.molsys.__init__':
if isinstance(n_components, int):
return n_components

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

3 changes: 3 additions & 0 deletions molsysmt/_private/digestion/argument/n_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def digest_n_entities(n_entities, caller=None):
elif caller=='molsysmt.native.topology.__init__':
if isinstance(n_entities, int):
return n_entities
elif caller=='molsysmt.native.molsys.__init__':
if isinstance(n_entities, int):
return n_entities

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

3 changes: 3 additions & 0 deletions molsysmt/_private/digestion/argument/n_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def digest_n_groups(n_groups, caller=None):
elif caller=='molsysmt.native.topology.__init__':
if isinstance(n_groups, int):
return n_groups
elif caller=='molsysmt.native.molsys.__init__':
if isinstance(n_groups, int):
return n_groups

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

3 changes: 3 additions & 0 deletions molsysmt/_private/digestion/argument/n_molecules.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def digest_n_molecules(n_molecules, caller=None):
elif caller=='molsysmt.native.topology.__init__':
if isinstance(n_molecules, int):
return n_molecules
elif caller=='molsysmt.native.molsys.__init__':
if isinstance(n_molecules, int):
return n_molecules

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

1 change: 1 addition & 0 deletions molsysmt/element/group/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from .is_group_type import is_group_type
from .get_group_type import get_group_type, get_group_type_from_group_name
from .get_bonded_atom_pairs import get_bonded_atom_pairs

_group_types = [
'water',
Expand Down
54 changes: 54 additions & 0 deletions molsysmt/element/group/get_bonded_atom_pairs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import numpy as np

def get_bonded_atom_pairs(group_name, atom_names, atom_indices=None, sorted=True):

from .get_group_type import get_group_type_from_group_name
from amino_acid import get_bonded_atom_pairs as get_bonded_atom_pairs_from_amino_acid
from ion import get_bonded_atom_pairs as get_bonded_atom_pairs_from_ion
from small_molecule import get_bonded_atom_pairs as get_bonded_atom_pairs_from_small_molecule
from terminal_capping import get_bonded_atom_pairs as get_bonded_atom_pairs_from_terminal_capping
from water import get_bonded_atom_pairs as get_bonded_atom_pairs_from_water

group_type = get_group_type_from_group_name(group_name)

bonds = None

match group_type:

case 'amino acid':
bonds = get_bonded_atom_pairs_from_amino_acid(group_name, atom_names, atom_indices=atom_indices,
sorted=sorted)

case 'ion':
bonds = get_bonded_atom_pairs_from_ion(group_name, atom_names, atom_indices=atom_indices, sorted=sorted)

case 'lipid':
pass

case 'nucleotide':
pass

case 'oligosaccharide':
pass

case 'saccharide':
pass

case 'small molecule':
bonds = get_bonded_atom_pairs_from_small_molecule(group_name, atom_names, atom_indices=atom_indices,
sorted=sorted)

case 'terminal capping':
bonds = get_bonded_atom_pairs_from_terminal_capping(group_name, atom_names, atom_indices=atom_indices,
sorted=sorted)

case 'water':
bonds = get_bonded_atom_pairs_from_water(atom_names, atom_indices=atom_indices, sorted=sorted)


if bonds is None:
print(f'Warning! The amino acid {group_name} has no template.')
raise ValueError

return bonds

Loading

0 comments on commit 1fc3b33

Please sign in to comment.