Skip to content

Mapping atomistic systems to coarse-grained systems

Notifications You must be signed in to change notification settings

uppittu11/cg_mapping

 
 

Repository files navigation

cg_mapping

Build Status codecov

Mapping atomistic systems to coarse-grained systems

Convert an atomistic trajectory to a coarse-grained trajectory using MDTraj and user-defined mapping files.

Installation

The package can be installed locally using pip. Here is how to install cg_mapping in a new conda environment:

git clone https://github.com/uppittu11/cg_mapping.git
conda create -n cg_mapping_env -c conda-forge --file requirements.txt -y
conda activate cg_mapping_env
cd cg_mapping && pip install -e .

Usage

The CG mapping module can be scripted and run from a python interpreter. Here is an example:

import mdtraj as md
from cg_mapping.mapper import Mapper

# Load in the mdtraj.Trajectory from disk
atomistic_trajectory = md.load("traj.xtc", top="start.gro")

# Initialize mapper and load in default mappings
my_mapper = Mapper()
my_mapper.load_mapping_dir()

# Load atomistic trajectory into the mapper
my_mapper.load_trajectory(atomistic_trajectory)

# Map the atomistic trajectory to the CG level
cg_trajectory = my_mapper.cg_map()

# Save the CG trajectory out to disk
cg_trajectory[0].save("cg_traj.gro")
cg_trajectory.save("cg_traj.xtc")

About

Mapping atomistic systems to coarse-grained systems

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%