molsysmt.ViewerJSON#

import molsysmt as msm
molecular_system = msm.convert(msm.systems['TcTIM']['1tcd.h5msm'])
msm.info(molecular_system)
form n_atoms n_groups n_components n_chains n_molecules n_entities n_waters n_proteins n_structures
molsysmt.MolSys 3983 662 167 4 167 2 165 2 1
viewer_json = msm.convert(molecular_system, to_form='molsysmt.ViewerJSON')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[9], line 1
----> 1 viewer_json = msm.convert(molecular_system, to_form='molsysmt.ViewerJSON')

File ~/repos@uibcdf/molsysmt/molsysmt/_private/digestion/digest.py:122, in digest.<locals>.digestor.<locals>.wrapper(*args, **kwargs)
    120     return func(all_args['self'], **final_args)
    121 else:
--> 122     return func(**final_args)

File ~/repos@uibcdf/molsysmt/molsysmt/basic/convert.py:515, in convert(molecular_system, to_form, selection, structure_indices, syntax, skip_digestion, **kwargs)
    513 # If one to one
    514 if not isinstance(from_form, (list, tuple)):
--> 515     output = _convert_one_to_one(molecular_system, from_form, to_form=to_form, selection=selection, structure_indices=structure_indices,
    516             syntax=syntax, skip_digestion=True, **kwargs)
    518 # If multiple to one
    519 
    520 else:
    521 
    522     # conversions in private shortcuts
    523     if tuple(sorted(from_form)) in _multiple_conversion_shortcuts:

File ~/repos@uibcdf/molsysmt/molsysmt/basic/convert.py:93, in _convert_one_to_one(molecular_system, from_form, to_form, selection, structure_indices, syntax, **kwargs)
     90         if len(missing_arguments)>0:
     91             raise NotCompatibleConversionError(from_form, to_form, missing_arguments)
---> 93     output = function(molecular_system, **conversion_arguments, **kwargs)
     95 elif ('molsysmt.MolSys' in _dict_modules[from_form]._convert_to) and (to_form in _dict_modules['molsysmt.MolSys']._convert_to):
     97     output = _convert_one_to_one(molecular_system, from_form, to_form='molsysmt.MolSys', selection=selection,
     98             structure_indices=structure_indices, syntax=syntax, **kwargs)

File ~/repos@uibcdf/molsysmt/molsysmt/_private/digestion/digest.py:52, in digest.<locals>.digestor.<locals>.wrapper(*args, **kwargs)
     48 @functools.wraps(func)
     49 def wrapper(*args, **kwargs):
     51     if kwargs.get('skip_digestion', False):
---> 52         return func(*args, **kwargs)
     54     # Define caller
     56     caller = func.__module__+'.'+func.__name__

File ~/repos@uibcdf/molsysmt/molsysmt/form/molsysmt_MolSys/to_molsysmt_ViewerJSON.py:12, in to_molsysmt_ViewerJSON(item, skip_digestion)
      9 """Convert a native MolSys into a ViewerJSON container."""
     11 topo_vjson = topology_to_viewer(item.topology, skip_digestion=True)
---> 12 struct_vjson = structures_to_viewer(item.structures, skip_digestion=True)
     14 data = {
     15     "version": topo_vjson.data.get("version", "0.1"),
     16     "atoms": topo_vjson.data.get("atoms", {}),
     17     "bonds": topo_vjson.data.get("bonds", {}),
     18     "estructures": struct_vjson.data.get("estructures", struct_vjson.data.get("frames", [])),
     19 }
     21 return ViewerJSON(data=data)

File ~/repos@uibcdf/molsysmt/molsysmt/_private/digestion/digest.py:52, in digest.<locals>.digestor.<locals>.wrapper(*args, **kwargs)
     48 @functools.wraps(func)
     49 def wrapper(*args, **kwargs):
     51     if kwargs.get('skip_digestion', False):
---> 52         return func(*args, **kwargs)
     54     # Define caller
     56     caller = func.__module__+'.'+func.__name__

File ~/repos@uibcdf/molsysmt/molsysmt/form/molsysmt_Structures/to_molsysmt_ViewerJSON.py:58, in to_molsysmt_ViewerJSON(item, skip_digestion)
     56             frame["time"] = float(time_values[ii])
     57         if box_values is not None:
---> 58             frame["box"] = _box_from_matrix(np.asarray(box_values[ii]))
     59         frames.append(frame)
     61 data = {
     62     "version": "0.1",
     63     "atoms": atoms_block,
     64     "bonds": bonds_block,
     65     "estructures": frames,
     66 }

File ~/repos@uibcdf/molsysmt/molsysmt/form/molsysmt_Structures/to_molsysmt_ViewerJSON.py:10, in _box_from_matrix(box)
      8 def _box_from_matrix(box):
      9     """Return box lengths (nm) and angles (rad) from a 3x3 matrix."""
---> 10     lengths, angles = get_lengths_and_angles_from_box(
     11         puw.quantity(np.asarray(box), "nanometer"), skip_digestion=True
     12     )
     13     lengths_val = puw.get_value(lengths, to_unit="nanometer")
     14     angles_val = puw.get_value(angles, to_unit="radian")

File ~/repos@uibcdf/molsysmt/molsysmt/_private/digestion/digest.py:52, in digest.<locals>.digestor.<locals>.wrapper(*args, **kwargs)
     48 @functools.wraps(func)
     49 def wrapper(*args, **kwargs):
     51     if kwargs.get('skip_digestion', False):
---> 52         return func(*args, **kwargs)
     54     # Define caller
     56     caller = func.__module__+'.'+func.__name__

File ~/repos@uibcdf/molsysmt/molsysmt/pbc/get_lengths_and_angles_from_box.py:29, in get_lengths_and_angles_from_box(box, skip_digestion)
      7 """Return box lengths and angles from a 3x3 box matrix or an array of boxes.
      8 
      9 Parameters
   (...)     25       beta between a and c, gamma between a and b).
     26 """
     28 box_value, box_unit  = puw.get_value_and_unit(box)
---> 29 lengths_value, angles_value = msmlib.pbc.get_lengths_and_angles_from_box(box_value)
     30 lengths = puw.quantity(lengths_value.round(6), box_unit)
     31 lengths = puw.standardize(lengths)

File ~/Myopt/miniconda3/envs/molsysmt@uibcdf_3.12/lib/python3.12/site-packages/numba/core/dispatcher.py:659, in _DispatcherBase._explain_matching_error(self, *args, **kws)
    656 args = [self.typeof_pyval(a) for a in args]
    657 msg = ("No matching definition for argument type(s) %s"
    658        % ', '.join(map(str, args)))
--> 659 raise TypeError(msg)

TypeError: No matching definition for argument type(s) array(float64, 2d, C)