Code Monkey home page Code Monkey logo

gro_parser's Introduction

gro_parser

The gro_parser module is a Python implementation that allows reading and writing GROMACS coordinate (gro) and topology (top) files. It provides a set of classes to represent a molecular system, including residues and atoms, and supports basic operations such as adding and copying residues.

Installation

git clone https://github.com/cecilpert/gro_parser.git
pip install -e gro_parser

Usage

Loading a system and accessing informations

from gro_parser import load_system

gro_file_path = 'path/to/your.gro'
top_file_path = 'path/to/your.top'

system = load_system(gro_file_path, top_file_path)

# Browse all residues 
for residue in system.residues:
    print(residue)

# Get a specific residue by index or residue number 
residue = system.get_residue_by_idx(0) 
residue = system.get_residue_by_number(1)

# Get all residues with a specific name
residues_with_name = system.get_residue_by_name('RESIDUENAME')

Manipulating the system

# Copy a residue. Example : I want to copy the first DOPC of my system. It will insert it at the end of DOPC stack
residue_to_copy = system.get_residue_by_name('DOPC')[0]
residue_to_copy.copy()

Writing the system to gro and top files

# Write the gro file corresponding to the system
system.write_gro('path/to/output.gro')

# Write the top file corresponding to the system
system.write_top('path/to/output.top')

gro_parser's People

Contributors

cecilpert avatar jacksoncrowley avatar

Forkers

jacksoncrowley

gro_parser's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.