A library for MagiC 3 output analysis and RDF calculations
Project description
MagicTools
Python library and CLI tools for analysis of MagiC-3 molecular dynamics simulations.
Features
- Radial Distribution Functions (RDF): Calculate and analyze pair distribution functions
- Angular Distribution Functions (ADF): Analyze angular correlations
- Molecular System Manipulation: Build and modify molecular systems
- Trajectory Processing: Read and process molecular dynamics trajectories
- Visualization: Plot distribution functions with customizable settings
Installation
From PyPI (recommended)
pip install magic-3-tools
From source (as part of MagiC-3 repository)
git clone https://bitbucket.org/magic-su/magic-3.git
cd magic-3/MagicTools
pip install .
For development (editable install):
pip install -e ".[dev]"
Usage
Python library
import MagicTools
print(MagicTools.__version__)
Import specific classes and functions:
from MagicTools import System, OnePlot, MultPlot, RDFCalculator
Read MagiC-format files:
from MagicTools.MagicTools import ReadMagiC
system = ReadMagiC("system.magic")
for mol_type in system.MolTypes:
print(mol_type.Name, mol_type.NMol)
Plot distribution functions:
OnePlot(system.DFs[0])
MultPlot(system.DFs)
CLI tool: magic-rdf
The magic-rdf command calculates Radial Distribution Functions from MagiC-3 trajectories.
Note: If you installed MagiC-3 from source using the main
install.sh, the same tool is available asrdf.py(a symlink in$MAGIC/bin). Both names run the same code. The User Guide uses therdf.pyconvention.
Basic usage:
magic-rdf
By default, magic-rdf reads input from rdf.inp in the current directory.
Options:
magic-rdf [-i input_file] [-np N] [--force] [--opt_memory_use]
-i input_file Input file name (default: rdf.inp)
-np N Run in parallel using N CPU cores
--force Skip trajectory format check
--opt_memory_use Optimize memory usage (useful for large trajectories)
Example:
# Use default input file (rdf.inp)
magic-rdf
# Specify custom input file
magic-rdf -i my_calculation.inp
# Run parallel RDF calculation on 4 cores
magic-rdf -i rdf.inp -np 4
The input file uses MagiC-2 RDF format (with &PARAMETERS section). Errors and debug output are written to rdf.err.
Optional dependency: trajectory support
For reading external trajectory formats (e.g., from GROMACS or LAMMPS via MDTraj):
pip install "magic-3-tools[trajectory]"
Requirements
- Python >= 3.10
- numpy >= 1.20
- pandas >= 1.3
- matplotlib >= 3.3
License
This project is licensed under the GNU General Public License v3 — see LICENSE for details.
Authors
- Prof. Alexander Lyubartsev (alexander.lyubartsev@su.se) — Principal investigator and method developer
Citation
If you use MagicTools or MagiC-3 in your research, please cite:
-
A. Mirzoev, A.P. Lyubartsev, "MagiC: Software Package for Multiscale Modeling", J. Chem. Theory Comput. 9(3), 1512–1520 (2013). DOI: 10.1021/ct301019v
-
A. Mirzoev, L. Nordenskiöld, A.P. Lyubartsev, "Magic v.3: An integrated software package for systematic structure-based coarse-graining", Comput. Phys. Commun. 237, 263–273 (2019). DOI: 10.1016/j.cpc.2018.11.018
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file magic_3_tools-0.2.0.tar.gz.
File metadata
- Download URL: magic_3_tools-0.2.0.tar.gz
- Upload date:
- Size: 93.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5141e17cdff2f535280a3a4e98b0e7e97bc3fe0f7daeb8069d5e86b5aca0a9b6
|
|
| MD5 |
9a855f044e21758b0563d92afc44b8d0
|
|
| BLAKE2b-256 |
49d0703138a8de090345b1831073adfc5d02c5a41cc309968e236f2d81904796
|
File details
Details for the file magic_3_tools-0.2.0-py3-none-any.whl.
File metadata
- Download URL: magic_3_tools-0.2.0-py3-none-any.whl
- Upload date:
- Size: 101.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ff4747675b925274acd583d3dd49f0e9a631d6864e6f746a0d14fc94916a090
|
|
| MD5 |
ca0cc0143b69c24ed72e210400000f90
|
|
| BLAKE2b-256 |
0c51adf860fbf33004adfa67d593947300142356776b78cf1770c8141a5bcd59
|