molsysmt.basic.copy#
- molsysmt.basic.copy(molecular_system, output_filename=None, skip_digestion=False)[source]#
Creating an independent copy of a molecular system.
This function returns a deep copy of the input molecular system, fully detached from the original. If the input is in a file-based form and output_filename is provided, the copy is written to a new file using the corresponding form handler.
- Parameters:
molecular_system (molecular system) – Molecular system in any supported MolSysMT format.
output_filename (str or pathlib.Path, default=None) – Output file path for serialization.
skip_digestion (bool, default=False) – Whether to skip MolSysMT’s internal argument digestion mechanism.
- Returns:
A new molecular system (or list of systems if the input is a sequence), independent of the original and in the same form as the input. When output_filename is given for a file-based form, the returned object follows the form-specific handler’s semantics (typically the path or a file-form handle).
- Return type:
molecular system or list of molecular systems
- Raises:
NotSupportedFormError – If the input molecular system has an unsupported form.
ArgumentError – If input arguments are invalid or inconsistent.
Notes
Supported molecular-system forms are summarized in Items and Forms.
See also
molsysmt.basic.convert()Convert a molecular system into another form.
Examples
>>> import molsysmt as msm >>> molsys_A = msm.convert(msm.systems['T4 lysozyme L99A']['181l.h5msm']) >>> molsys_B = msm.copy(molsys_A) >>> msm.compare(molsys_A, molsys_B, rule='equal') True >>> id(molsys_A) == id(molsys_B) False
Tutorial with more examples
See the following tutorial for a practical demonstration of how to use this function, along with additional examples: Copy.
Added in version 1.0.0.