Metadata-Version: 2.4
Name: domd-toolkit
Version: 1.0.0
Summary: A modular platform for constructing molecular dynamics simulations (Chemical Compiler).
Home-page: https://github.com/DoMD-toolkit/DoMD
Author: Rui Shi, Ming-Yang Li, Hu-jun Qian
Author-email: hjqian@jlu.edu.cn
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Chemistry
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=2.0.0
Requires-Dist: scipy>=1.10.0
Requires-Dist: pandas>=2.0.0
Requires-Dist: networkx>=3.0
Requires-Dist: sqlalchemy>=2.0.0
Requires-Dist: numba>=0.60.0
Requires-Dist: scikit-learn>=1.7.0
Requires-Dist: joblib>=1.5.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: mdanalysis>=2.10.0
Requires-Dist: rdkit==2025.03.6
Requires-Dist: torch>=2.5.0
Requires-Dist: torch-geometric>=2.5.0
Provides-Extra: vis
Requires-Dist: matplotlib>=3.10; extra == "vis"
Requires-Dist: seaborn>=0.13; extra == "vis"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: sphinx; extra == "dev"
Requires-Dist: twine; extra == "dev"
Provides-Extra: babel
Requires-Dist: openbabel>=3.1.1; extra == "babel"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

<pre>
        ██████                                                                                      
      █▓▓▓▓▓▓▓▓▓▓▓████                                           ████████████████████               
     ██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██              ██▓▓▓▓▓▓▓▓▓▓▓█         ██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓  ▓██            
     █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██           █▓▓▓▓▓▓▓▓▓▓▓▓█▒        █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ▓▓█           
     █▓▓▓▓▓      ▓▓▓▓▓▓▓▓▓▓▓▓██          █▓▓▓▓▓▓▓▓▓▓██          ████▓▓▓▓▓██████████▓▓▓▓▓▓██         
    ░█▓▓▓▓         ▓▓▓▓▓▓▓▓▓▓▓▓▓█           █▓▓▓▓▓█                █▓▓▓▓▓█         ██▓▓▓▓▓██        
    ██▓▓▓▓           ▓▓▓▓▓▓▓▓▓▓▓▓██         █▓▓▓▓▓█                █▓▓▓▓▓█           █▓▓▓▓▓▓██      
    █▓▓▓▓▓            ▓▓▓▓▓▓▓▓▓▓▓▓██        █▓▓▓▓▓█████       ██████▓▓▓▓▓█            ██▓▓▓▓▓██     
    █▓▓▓▓▓            ▓▓▓▓▓▓▓▓▓▓▓▓▓█▓       █▓▓▓▓▓▓▓▓▓▓▓█   ██▓▓▓▓▓▓▓▓▓▓▓█              █▓▓▓▓▓█     
    █▓▓▓▓▓            ▓▓▓▓▓▓▓▓▓▓▓▓▓▓█       █▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓█              ██▓▓▓▓█     
    █▓▓▓▓▓            ▓▓▓▓▓▓▓▓▓▓▓▓▓▓█       █▓▓▓▓▓███▓▓▓▓▓▓▓▓▓▓▓▓███▓▓▓▓▓█              ██▓▓▓▓█     
    █▓▓▓▓▓           ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██      █▓▓▓▓▓█  ██▓▓▓▓▓▓▓▓██  █▓▓▓▓▓█              ██▓▓▓▓█     
    █▓▓▓▓▓          ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██      █▓▓▓▓▓█    █▓▓▓▓▓██    █▓▓▓▓▓█              ██▓▓▓▓█     
    █▓▓▓▓▓        ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██      █▓▓▓▓▓█    █▓▓▓▓▓█     █▓▓▓▓▓█              ██▓▓▓▓█     
    █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████▓▓▓▓▓▓█       █▓▓▓▓▓█    █▓▓▓▓▓█     █▓▓▓▓▓█              ██▓▓▓▓█     
    █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██    ░░██████       █▓▓▓▓▓█    █▓▓▓▓▓█     █▓▓▓▓▓█              ██▓▓▓▓█     
    █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█        ██▓▓▓▓██     █▓▓▓▓▓█     █▓▓▓██     █▓▓▓▓▓█              ██▓▓▓▓█     
   ░█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█       ██▓▓▓▓▓▓▓██   █▓▓▓▓▓█                █▓▓▓▓▓█              ██▓▓▓▓█     
    █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█    ███▓▓▓▓▓▓▓▓▓█   ██▓▓▓▓▓█                █▓▓▓▓▓█             ██▓▓▓▓▓█     
    █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓███▓▓▓▓▓▓▓▓▓▓▓▓██     █▓▓▓▓█                █▓▓▓▓▓█            █▓▓▓▓▓▓█      
    █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓█       █▓▓▓█                █▓▓▓▓▓█          ██▓▓▓▓▓██       
    █▓▓▓▓▓▓▓▓▓▓▓▓▓▓█████▓▓▓▓▓▓▓▓▓▓▓▓▓▓█      ██▓▓▓█                █▓▓▓▓▓█         █▓▓▓▓▓▓██        
    █▓▓▓▓▓▓▓▓▓▓▓▓████████▓▓▓▓▓▓▓▓▓▓▓▓▓██   ░██▓▓▓▓▓▓▓▓▓█      █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█          
    █▓▓▓▓▓▓▓▓▓█████████ ██▓▓▓▓▓▓▓▓▒▒▒▓▓█████▓▓▓▓▓▓▓▓▓▓▓▓█    █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██           
      █████████           ██▓▓▓▓█▓▓▓█████▓▓▓▓▓▓▓▓▓▓▓▓▓██      ██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██             
</pre>
# DoMD
DoMD is a toolkit for atomistic molecular dynamics modelling.

# Installation

## Quick installation for the release
```bash
# Download and unzip the release zip file
$ cd <path-to-domd>
$ conda env create -f environment.yml
$ conda activate domd-toolkit
$ python -c 'from domd_tools import *; print("Success install domd.")'
```

## Step-by-step installation from repo
We recommend using `conda` to manage your environment. Follow the steps below to set up DoMD:

### 1. Create and Activate the Conda Environment
```bash
conda create -n domd-toolkit -c conda-forge python==3.12 nomkl numpy rdkit=2025.03.6 openbabel numba networkx pandas scipy jupyter scikit-learn matplotlib MDAnalysis
conda activate domd-toolkit
```

### 2. Install PyTorch and Additional Dependencies
```bash
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cpu
pip3 install torch_geometric pdbreader
```

### 3. Download the Toolkit
You can obtain the DoMD toolkit via GitHub or by downloading our official release. **Please choose one of the following options:**

**Option A: Clone from GitHub (Requires manual database download)**
1. Clone the repository:
   ```bash
   git clone https://github.com/DoMD-toolkit/DoMD.git
   ```
2. **Important:** Download the required forcefield database `opls.db` (large file) from [Google Drive Link](https://drive.google.com/file/d/18KM3CQI2Wrcs8jutCQxGTcVyc0St_Aj5/view).
3. Move `opls.db` into the following directory: `DoMD/domd_forcefield/oplsaa/resources/opls.db`

**Option B: Download the Release ``DoMD.zip`` (Recommended)**
Download the latest `DoMD.zip` file from the [Releases page](https://github.com/DoMD-toolkit/DoMD/releases). The `opls.db` file is already included in the compressed package, so no extra downloads are necessary. Unzip the file before proceeding.

### 4. Install DoMD
Navigate to the root directory of the project (where `setup.py` is located) and install it in editable mode:

```bash
cd DoMD
pip install -e .
```

## **Usage Examples & Testing**

Navigate to the polyimide example directory:
```bash
cd <path-to-the-examples>/pi
```

### **1. End-to-End Workflow**
Run the main script to process a pre-equilibrated Coarse-Grained (CG) configuration:
```bash
python polyimides.py
```
* **Outputs:** * `chemfast.gro`: The back-mapped All-Atom (AA) conformation.
    * `chemfast.top`: The GROMACS-compatible force field and topology file.
    * `out_chemfast.xml`: The PyGAMD xml intput
* **Purpose:** These files are ready for immediate use in atomistic simulations using **GROMACS**.

---

### **2. Step-by-Step Module Testing**
We also provide individual tests for specific **S-CGFG** functions to demonstrate the underlying workflow:

* **CG Topology Generation**
    ```bash
    python cg.py
    ```
    Generates an initial CG configuration (e.g., linear chains) and force field parameters based on **HSP (Hansen Solubility Parameters)** predictions. This is typically used for pre-equilibration or reaction runs. *(Note: This step is optional as a pre-equilibrated configuration is already provided).*
  * **Output:** `out_chemfast_cg.xml` file for PyGAMD, and `cg_params.txt` as CG forcefield parameters.

* **CG Parameterization**
    ```bash
    python cg_params.py
    ```
    Generates CG simulation force field parameters only from specific monomers and reaction templates.
    * **Output:** `cg_parameters.txt`

* **Back-mapping (CG to FG)**
    ```bash
    python fg.py
    ```
    Tests the Coarse-Grained to Fine-Grained (AA) conversion.
    * **Outputs:** AA conformations (stored in the `aa_confs/` folder) and topology metadata (`meta_aa_top.pkl`).

* **Force Field Parameterization**
    ```bash
    python ff.py
    ```
    Performs force field parameterization by reading `meta_aa_top.pkl`.
    * **Output:** `meta_ffs.pkl`

* **Final Assembly**
    ```bash
    python output.py
    ```
    Assembles the AA conformations and force field data into standard GROMACS input formats.
    * **Outputs:** Final `.gro`, `.top` and `.xml` (for PyGAMD) files.


# Large Files & Databases

Due to file size limits, our large database files are hosted externally. You can download them from this [Google Drive Link](https://drive.google.com/file/d/18KM3CQI2Wrcs8jutCQxGTcVyc0St_Aj5/view).

* **`domd_forcefield/oplsaa/resources/opls.db` (Required)** This is the core database necessary for standard force field assignment and running the toolkit.
* **`domd_database/forcefield/oplsaa/data/ligpargen/AllData.pkl` (Optional)** This file is strictly used for *training* the ML force field models. You can **ignore** this file if you are only running standard simulations.

# Documentation

* **Online:** Access the latest manuals, API references, and tutorials at our official [Documentation Site](https://domd-toolkit.readthedocs.io/en/latest/).
* **Offline:** You can also browse the documentation locally by opening `docs/build/html/index.html` from your cloned repository in any web browser.


