Are multiple molecular systems#
Checking whether a container (list or tuple) holds only valid molecular systems.
This function checks whether the input is a list or tuple and whether all its items are valid molecular systems in one of the :ref:supported forms <Introduction_Forms>
.
Added in version 1.0.0.
How this function works#
API documentation
Follow this link for a detailed description of the input arguments, raised errors, and returned objects of this function: molsysmt.basic.are_multiple_molecular_systems()
.
Let’s show how this method works with some simple cases:
import molsysmt as msm
from molsysmt import systems
molsys_A = '2LAO'
molsys_B = systems['Trp-Cage']['1l2y.h5msm']
molsys_C = systems['T4 lysozyme L99A']['t4_lysozyme_L99A.h5msm']
msm.are_multiple_molecular_systems([molsys_A, molsys_B, molsys_C])
True
Tip
All methods defined in the molsysmt.basic module can also be invoked from the library’s top level. Hence, molsysmt.are_multiple_molecular_systems()
is the same function as molsysmt.basic.are_multiple_molecular_systems()
.
A molecular system can also be represented as a composite form, for example a pair [Topology, Structures]
. In such cases the entire pair counts as one molecular system within the container, not two separate objects.
topology = msm.convert(molsys_C, to_form='openmm.Topology')
structures = msm.convert(molsys_C, to_form='XYZ')
msm.are_multiple_molecular_systems([molsys_A, molsys_B, [topology, structures]])
True
Now consider a mixed container where at least one item is not a molecular system: the function returns False
.
topology = msm.convert(molsys_B, to_form='openmm.Topology')
structures = msm.convert(molsys_C, to_form='XYZ')
msm.are_multiple_molecular_systems([molsys_A, molsys_B, [topology, structures]])
False
This function is especially useful in validation workflows where input data may be heterogeneous
or come from multiple sources. For individual objects, use :func:molsysmt.basic.is_a_molecular_system
.
See also
User guide > Introduction > Demo systems:
Explore pre-defined molecular systems available for testing and tutorials.
User guide > Tools > Basic > Is a molecular system:
Check whether a single object is a valid molecular system.
User guide > Tools > Basic > Convert:
Convert a molecular system into another form.