Where is attribute#

Identifying the item where a specific attribute is found in a molecular system.

In MolSysMT, molecular systems can be defined as a list of items, each of which may belong to a different form and contribute different attributes. For example, one item might provide structural data (coordinates, time), while another defines topology (bonds, atom types). If you wonder where a specific attribute resides within such a system, the function molsysmt.basic.where_is_attribute() can help.

Hint

Visit the section User guide > Introduction > Molecular System > Attributes in case you are not familiar with the concept of “attribute” in MolSysMT.

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.where_is_attribute().

Let’s illustrate how this function works with the following situation. Imagine we have a molecular system coming from the combination of two files: one with structural attributes and the other with topological ones.

import molsysmt as msm
structure = msm.systems['pentalanine']['pentalanine.inpcrd']
topology = msm.systems['pentalanine']['pentalanine.prmtop']
msm.info([topology, structure])
form n_atoms n_groups n_components n_chains n_molecules n_entities n_waters n_peptides n_structures
['file:prmtop', 'file:inpcrd'] 5207 1722 1716 1 1716 2 1715 1 1

The function molsysmt.basic.where_is_attribute() allows us to know where a given attribute is found in the list of items. Let’s see how {func}molsysmt.basic.where_is_attribute identifies the item holding a specific attribute:

msm.where_is_attribute([topology, structure], attribute='box')
('/home/diego/repos@uibcdf/molsysmt/molsysmt/data/inpcrd/pentalanine.inpcrd',
 'file:inpcrd')
msm.where_is_attribute([topology, structure], attribute='group_name')
('/home/diego/repos@uibcdf/molsysmt/molsysmt/data/prmtop/pentalanine.prmtop',
 'file:prmtop')

Tip

All methods defined in the molsysmt.basic module can be invoked also from the main level of the library. Hence, molsysmt.where_is_attribute() is the same method as molsysmt.basic.where_is_attribute().

See also

User guide > Introduction > Molecular System > Attributes:
Overview of the different types of attributes and how they are distributed across items.

User guide > Tools > Basic > Info:
Display a summary of the topology and structural data of a molecular system.

User guide > Tools > Basic > Has attribute:
Check whether a molecular system contains a specific attribute.

User guide > Tools > Basic > Get attributes:
Retrieve a dictionary of available attributes from a molecular system.