molsysmt.native package#

Submodules#

molsysmt.native.file_tng module#

class molsysmt.native.file_tng.TNGFile(filename=None, mode='read')[source]#

Bases: object

Placeholder handler for TNG trajectories.

molsysmt.native.file_xtc module#

class molsysmt.native.file_xtc.XTCFile(filename=None, mode='read')[source]#

Bases: object

Placeholder handler for XTC trajectories.

molsysmt.native.gro_file_handler module#

class molsysmt.native.gro_file_handler.GROAtomicCoordinateEntry[source]#

Bases: object

In-memory representation of a GRO coordinate entry.

class molsysmt.native.gro_file_handler.GROFileHandler(file, io_mode='r', closed=False, skip_digestion=False)[source]#

Bases: object

Handle reading and writing GRO coordinate files.

close()[source]#

Close the underlying file.

dump()[source]#

Serialize the current entry back to GRO format.

load()[source]#

Load and parse the current GRO entry.

molsysmt.native.gro_file_handler.parse(file)[source]#

Parse a GRO file-like object into a GROAtomicCoordinateEntry.

molsysmt.native.h5msm_file_handler module#

class molsysmt.native.h5msm_file_handler.H5MSMFileHandler(filename, io_mode='r', creator='MolSysMT', compression='gzip', compression_opts=4, int_precision='single', float_precision='single', length_unit=None, time_unit=None, energy_unit=None, temperature_unit=None, charge_unit=None, mass_unit=None, closed=False, skip_digestion=False)[source]#

Bases: object

Lightweight handler for reading and writing h5msm files.

close()[source]#

Close the underlying HDF5 handle.

write_topology(topology, selection='all', syntax='MolSysMT')[source]#

Write a topology object into the file, converting if needed.

molsysmt.native.molecular_mechanics module#

class molsysmt.native.molecular_mechanics.MolecularMechanics(forcefield=None, water_model=None, implicit_solvent=None, non_bonded_method=None, cutoff_distance=None, switch_distance=None, dispersion_correction=None, ewald_error_tolerance=None, constraints=None, flexible_constraints=None, rigid_water=None, hydrogen_mass=None, salt_concentration=None, kappa=None, solute_dielectric=None, solvent_dielectric=None, formal_charge=None, partial_charge=None)[source]#

Bases: object

Container for molecular mechanics force-field settings.

copy()[source]#

Create a deep copy of the MolecularMechanics object.

get_leap_parameters()[source]#

Get parameter names for LEaP-compatible force fields.

get_openmm_System_parameters()[source]#

Build the keyword dictionary for creating an OpenMM System.

get_openmm_forcefield_names()[source]#

Resolve OpenMM force field names for the configured options.

set_parameters(return_non_processed=False, **kwargs)[source]#

Standardize and set available parameters from keyword arguments.

to_dict()[source]#

Return a dictionary representation of the parameters.

to_openmm_ForceField()[source]#

Instantiate an OpenMM ForceField object.

molsysmt.native.molecular_mechanics_dict module#

molsysmt.native.molsys module#

class molsysmt.native.molsys.MolSys(n_atoms=0, n_groups=0, n_components=0, n_molecules=0, n_entities=0, n_chains=0, n_bonds=0, skip_digestion=False)[source]#

Bases: object

Container holding native topology, structures, and molecular mechanics data.

add(item, atom_indices='all', structure_indices='all', keep_ids=True, skip_digestion=False)[source]#

Append topology and structures from another MolSys.

add_missing_bonds(threshold='2 angstroms', selection='all', structure_indices=0, syntax='MolSysMT', engine='MolSysMT', with_templates=True, with_distances=True, skip_digestion=False)[source]#

Fill missing bonds inferred from the current coordinates.

append_structures(item, atom_indices='all', structure_indices='all', skip_digestion=False)[source]#

Append structures from another MolSys while aligning atom indices.

copy()[source]#

Deep-copy the MolSys.

extract(atom_indices='all', structure_indices='all', copy_if_all=True, skip_digestion=False)[source]#

Return a copy or subset of the molecular system.

get(element='system', selection='all', structure_indices='all', mask=None, syntax='MolSysMT', get_missing_bonds=True, output_type='values', skip_digestion=False, **kwargs)[source]#

Proxy to molsysmt.get() using this MolSys as input.

info(element='system', selection='all', syntax='MolSysMT', skip_digestion=False)[source]#

Return a text summary of the MolSys.

rebuild_atoms(redefine_ids=True, redefine_types=True)[source]#

Recompute atom ids/types from the present topology.

rebuild_chains(redefine_ids=True, redefine_types=True)[source]#

Recompute chain ids/types from the present topology.

rebuild_components(redefine_ids=True, redefine_types=True)[source]#

Recompute component ids/types from the present topology.

rebuild_entities(redefine_ids=True, redefine_types=True)[source]#

Recompute entity ids/types from the present topology.

rebuild_groups(redefine_ids=True, redefine_types=True)[source]#

Recompute group ids/types from the present topology.

rebuild_molecules(redefine_ids=True, redefine_types=True)[source]#

Recompute molecule ids/types from the present topology.

remove(atom_indices=None, structure_indices=None, copy_if_None=False, skip_digestion=False)[source]#

Remove atoms and/or structures by index and return the resulting MolSys.

to_form(to_form, skip_digestion=False, **kwargs)[source]#

Convert the MolSys to a target form.

molsysmt.native.pdb_atomic_coordinate_entry module#

class molsysmt.native.pdb_atomic_coordinate_entry.AtomRecord[source]#

Bases: object

to_string(output='short_string')[source]#
class molsysmt.native.pdb_atomic_coordinate_entry.AuthorRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.BookkeepingSection[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.CaveatRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.CispepRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.CompndRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.ConectRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.ConnectivityAnnotationSection[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.ConnectivitySection[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.CoordinateSection[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.Cryst1Record[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.CrystallographicAndCoordinateTransformationSection[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.Dbref1Dbref2Record[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.DbrefRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.ExpdtaRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.FormulRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.HeaderRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.HelixRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.HetRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.HetatmRecord[source]#

Bases: AtomRecord

class molsysmt.native.pdb_atomic_coordinate_entry.HeterogenSection[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.HetnamRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.HetsynRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.JrnlRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.KeywdsRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.LinkRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.MasterRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.MdltypRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.MiscellaneousFeaturesSection[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.Model[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.ModresRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.MtrixRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.NummdlRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.ObslteRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.OrigxRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.PDBAtomicCoordinateEntry[source]#

Bases: object

Aggregate of PDB record sections for atomic coordinate entries.

class molsysmt.native.pdb_atomic_coordinate_entry.PrimaryStructureSection[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.RemarkRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.RevdatRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.ScaleRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.SecondaryStructureSection[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.SeqadvRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.SeqresRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.SheetRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.SiteRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.SourceRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.SplitRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.SprsdeRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.SsbondRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.TitleRecord[source]#

Bases: object

class molsysmt.native.pdb_atomic_coordinate_entry.TitleSection[source]#

Bases: object

molsysmt.native.pdb_file_handler module#

class molsysmt.native.pdb_file_handler.PDBFileHandler(file, io_mode='r', closed=False, skip_digestion=False)[source]#

Bases: object

Handle reading and writing PDB coordinate files.

close()[source]#

Close the underlying file handle.

dump()[source]#

Serialize the current entry back to PDB format.

load()[source]#

Load and parse the PDB content.

molsysmt.native.pdb_file_handler.guess_format_version(file)[source]#

Return the PDB format version guessed from the file contents.

molsysmt.native.pdb_file_handler.parse_format33(file)[source]#

Parse a PDB file using the v3.3 specification.

molsysmt.native.simulation module#

class molsysmt.native.simulation.Simulation(molecular_system=None, remove_cm_motion=True, integrator=None, temperature=None, collisions_rate=None, integration_timestep=None, initial_velocities_to_temperature=True, constraint_tolerance=1e-05, platform='CUDA', cuda_precision='mixed')[source]#

Bases: object

Container for simulation parameters used to build OpenMM objects.

copy()[source]#

Deep-copy the Simulation settings.

get_openmm_Context_parameters()[source]#

Return keyword arguments required to build an OpenMM Context.

get_openmm_Simulation_parameters()[source]#

Return keyword arguments required to build an OpenMM Simulation.

set_parameters(return_non_processed=False, **kwargs)[source]#

Standardize and set allowed parameters from keyword arguments.

to_dict()[source]#

Return a dictionary representation of the simulation parameters.

to_openmm_Context(molecular_system=None, selection='all', structure_indices='all')[source]#

Create an OpenMM Context from the current settings.

to_openmm_Integrator()[source]#

Build an OpenMM Integrator instance for the configured dynamics.

to_openmm_Platform()[source]#

Return the selected OpenMM Platform.

to_openmm_Simulation(molecular_system=None, selection='all', structure_indices='all')[source]#

Create an OpenMM Simulation from the current settings.

molsysmt.native.simulation_dict module#

molsysmt.native.simulation_dict.is_simulation_dict(dictionary)[source]#

Return True if the dictionary only contains simulation parameter keys.

molsysmt.native.structures module#

class molsysmt.native.structures.Structures(constant_time_step=False, time_step=None, constant_id_step=False, id_step=None, constant_box=False, structure_id=None, time=None, coordinates=None, velocities=None, box=None, b_factor=None, alternate_location=None, bioassembly=None, temperature=None, potential_energy=None, kinetic_energy=None, skip_digestion=False)[source]#

Bases: object

Storing per-structure data (coordinates, box, time, energies) for a molecular system.

add(item, atom_indices='all', structure_indices='all', skip_digestion=False)[source]#

Concatenate atomic data from another Structures object along the atom axis.

append(structure_id=None, time=None, coordinates=None, velocities=None, box=None, temperature=None, potential_energy=None, kinetic_energy=None, b_factor=None, alternate_location=None, atom_indices='all', structure_indices='all', skip_digestion=False)[source]#

Append one or more structures and associated metadata to this object.

append_structures(item, atom_indices='all', structure_indices='all', skip_digestion=False)[source]#

Append structures from another Structures object.

copy()[source]#

Returns a copy of the structures.

extract(atom_indices='all', structure_indices='all', copy_if_all=False, skip_digestion=False)[source]#

Returns a new Structures object with the specified atoms and/or structures.

Parameters:
  • atom_indices (str or arraylike of int, default='all') – The indices of the extracted atoms.

  • structure_indices (str or arraylike of int, default='all') – The indices of the extracted structures or frames.

Returns:

The new structures object with the extracted atoms and frames.

Return type:

Structures

get_n_structures()[source]#

molsysmt.native.structures_dict module#

molsysmt.native.topology module#

class molsysmt.native.topology.Atoms_DataFrame(n_atoms=0)[source]#

Bases: DataFrame

Pandas DataFrame wrapper storing atom-level topology fields.

class molsysmt.native.topology.Bonds_DataFrame(n_bonds=0)[source]#

Bases: DataFrame

Pandas DataFrame wrapper storing bond connectivity.

class molsysmt.native.topology.Chains_DataFrame(n_chains=0)[source]#

Bases: DataFrame

Pandas DataFrame wrapper storing chain-level fields.

class molsysmt.native.topology.Components_DataFrame(n_components=0)[source]#

Bases: DataFrame

Pandas DataFrame wrapper storing component-level fields.

class molsysmt.native.topology.Entities_DataFrame(n_entities=0)[source]#

Bases: DataFrame

Pandas DataFrame wrapper storing entity-level fields.

class molsysmt.native.topology.Groups_DataFrame(n_groups=0)[source]#

Bases: DataFrame

Pandas DataFrame wrapper storing group-level fields.

class molsysmt.native.topology.Molecules_DataFrame(n_molecules=0)[source]#

Bases: DataFrame

Pandas DataFrame wrapper storing molecule-level fields.

class molsysmt.native.topology.Topology(n_atoms=0, n_groups=0, n_components=0, n_molecules=0, n_entities=0, n_chains=0, n_bonds=0, skip_digestion=False)[source]#

Bases: object

Native topology container including atoms, groups, chains, and bonds.

add(item, atom_indices='all', keep_ids=True, skip_digestion=False)[source]#

Append another topology, offsetting indices as needed.

add_bonds(bonded_atom_pairs, skip_digestion=False)[source]#

Append new bonds given atom index pairs.

add_missing_bonds(selection='all', syntax='MolSysMT', skip_digestion=False)[source]#

Infer and add missing bonds using geometric templates.

compare(item, rule='equal', output_type='boolean', skip_digestion=False, **kwargs)[source]#

Compare topology content with another topology.

copy()[source]#

Return a deep copy of the topology tables.

extract(atom_indices='all', copy_if_all=False, skip_digestion=False)[source]#

Return a subset topology with the selected atoms and associated hierarchy.

get_atom_indices(**kwargs)[source]#

Select atom indices matching the provided hierarchical filters.

get_n_atoms()[source]#
get_n_bonds()[source]#
get_n_chains()[source]#
get_n_components()[source]#
get_n_entities()[source]#
get_n_groups()[source]#
get_n_molecules()[source]#
rebuild_atoms(redefine_ids=True, redefine_types=True)[source]#

Regenerate atom ids/types from names and current counts.

rebuild_chains(redefine_indices=True, redefine_ids=True, redefine_types=True, redefine_names=True)[source]#

Rebuild chain mapping and metadata.

rebuild_components(redefine_indices=True, redefine_ids=True, redefine_names=True, redefine_types=True)[source]#

Rebuild component mapping and metadata.

rebuild_entities(redefine_indices=True, redefine_ids=True, redefine_names=True, redefine_types=True)[source]#

Rebuild entity mapping and metadata.

rebuild_groups(redefine_ids=True, redefine_types=True)[source]#

Regenerate group ids/types from names and current counts.

rebuild_molecules(redefine_indices=True, redefine_ids=True, redefine_names=True, redefine_types=True, molecules_as_components=True)[source]#

Rebuild molecule mapping and metadata.

remove(atom_indices=None, copy_if_None=False, skip_digestion=False)[source]#

Remove atoms by index and return the resulting topology.

remove_bonds(bond_indices='all', skip_digestion=False)[source]#

Drop bonds by index.

reset_atoms(n_atoms=0)[source]#

Reset atoms table to a new size.

reset_bonds(n_bonds=0)[source]#

Reset bonds table to a new size.

reset_chains(n_chains=0)[source]#

Reset chains table to a new size.

reset_components(n_components=0)[source]#

Reset components table to a new size.

reset_entities(n_entities=0)[source]#

Reset entities table to a new size.

reset_groups(n_groups=0)[source]#

Reset groups table to a new size.

reset_molecules(n_molecules=0)[source]#

Reset molecules table to a new size.

molsysmt.native.trajectory_file module#

class molsysmt.native.trajectory_file.TrajectoryFile(filepath=None, mode='read')[source]#

Bases: object

Unified interface to read various trajectory file formats.

copy()[source]#

Return a shallow copy of the trajectory handle.

read_frames(atom_indices='all', structure_indices='all')[source]#

Read selected frames and return IDs, time, coordinates, and box.

molsysmt.native.universal_json module#

class molsysmt.native.universal_json.UniversalJSON(data=<factory>, compressed=False, compression='none', schema=<factory>)[source]#

Bases: object

Storing a general JSON representation of a molecular system (molsysmt.UniversalJSON).

The data dict follows a broad schema: - metadata: unitless descriptive fields. - topology: per-atom columns (ids, names, group/chain/entity ids, element symbols, charges). - bonds: atom_pairs (0-based) plus optional order. - coordinates: collections with structures, each holding coordinates (nm), optional time

(ps), and optional box (vectors v0, v1, v2 in nm).

  • annotations: optional derived data.

compression/compressed control optional gzip serialization. Use to_dict(copy=True) for a JSON-compatible dict and copy() for deep copies.

Parameters:
  • data (Dict[str, Any])

  • compressed (bool)

  • compression (Literal['none', 'gzip'])

  • schema (Dict[str, str])

compressed: bool = False#
compression: Literal['none', 'gzip'] = 'none'#
copy()[source]#

Return a deep copy of the instance.

Return type:

UniversalJSON

data: Dict[str, Any]#
dump(fp, *, indent=None, compression=None)[source]#

Write content to a file path or file-like as JSON (optionally gzipped).

Parameters:
  • fp (str | TextIO)

  • indent (int | None)

  • compression (Literal['none', 'gzip'] | None)

Return type:

None

dumps(indent=None)[source]#

Return a JSON text representation.

Parameters:

indent (int | None)

Return type:

str

schema: Dict[str, str]#
to_dict(copy=True)[source]#

Return the underlying JSON-compatible dict.

Parameters:

copy (bool)

Return type:

Dict[str, Any]

molsysmt.native.viewer_json module#

class molsysmt.native.viewer_json.ViewerJSON(data=<factory>, compressed=False, compression='none', schema=<factory>)[source]#

Bases: object

Storing a minimal viewer-friendly JSON payload (molsysmt.ViewerJSON).

The underlying data dict follows the viewer schema:

  • atoms: per-atom columns (ids/names/group/chain/entity ids, element symbol, optional charges). All ids/names are strings; charges are unitless integers.

  • bonds: atom_pairs (0-based index pairs) and optional order.

  • structures: list of structures with coordinates (nm), optional time (ps), and optional box with box vectors (v0, v1, v2 in nm).

compression/compressed control optional gzip serialization. Use to_dict(copy=True) to get a JSON-compatible dict and copy() for deep copies.

Parameters:
  • data (Dict[str, Any])

  • compressed (bool)

  • compression (Literal['none', 'gzip'])

  • schema (Dict[str, str])

compressed: bool = False#
compression: Literal['none', 'gzip'] = 'none'#
copy()[source]#

Return a deep copy of the instance.

Return type:

ViewerJSON

data: Dict[str, Any]#
dump(fp, *, indent=None, compression=None)[source]#

Write content to a file path or file-like as JSON (optionally gzipped).

Parameters:
  • fp (str | TextIO)

  • indent (int | None)

  • compression (Literal['none', 'gzip'] | None)

Return type:

None

dumps(indent=None)[source]#

Return a JSON text representation.

Parameters:

indent (int | None)

Return type:

str

schema: Dict[str, str]#
to_dict(copy=True)[source]#

Return the underlying JSON-compatible dict.

Notes: - All values must be JSON types (dict, list, str, int, float, bool, None).

Parameters:

copy (bool)

Return type:

Dict[str, Any]

Module contents#