Skip to main content

Simple Gromacs python wrapper

Project description

Documentation Status PyPI version

GroMorG

A python tool to automate the calculation of MD simulations of small organic molecules using gromacs.
Online documentation is available at https://gromorg.readthedocs.io/

Features

  • Link first principles & molecular mechanics calculations using PyQchem
  • Get parameters from SwissParam (https://www.swissparam.ch) automatically from molecular structure
  • Clean run without intermediate files
  • Add solvent molecules to the system
  • Extract structures from the trajectory (including surrounding solvent molecules)

Requirements

Basic example

from gromorg import GromOrg
import matplotlib.pyplot as plt
from pyqchem.structure import Structure

# Define moleule as PyQchem Structure
structure = Structure(coordinates=[[ 0.6695, 0.0000, 0.0000],
                                   [-0.6695, 0.0000, 0.0000],
                                   [ 1.2321, 0.9289, 0.0000],
                                   [ 1.2321,-0.9289, 0.0000],
                                   [-1.2321, 0.9289, 0.0000],
                                   [-1.2321,-0.9289, 0.0000]],
                      symbols=['C', 'C', 'H', 'H', 'H', 'H'])

# Define Gromacs parameters
gmx_params = {
             'integrator': 'md-vv',     # Verlet integrator
             'nsteps': 5000,            # 0.001 * 5000 = 50 ps
             'dt': 0.001,               # time step, in ps
             # Temperature coupling is on
             'tcoupl': 'nose-hoover',    # Nose-Hoover thermostat
             'tau_t': 0.3,               # time constant, in ps
             'ref_t': 300,               # reference temperature, one for each group, in K
             # Bond parameters
             'gen_vel': 'yes',           # assign velocities from Maxwell distributio
             'gen_temp': 300,            # temperature for Maxwell distribution
             'gen_seed': -1,             # generate a random seed
             }

# Define simulation
calc = GromOrg(structure, 
               params=gmx_params,        # MDP parms 
               box=[10, 10, 10],         # a, b, c in angstrom
               angles=[90, 90, 90],      # alpha, beta, gamma in degree
               supercell=[3, 3, 3],
               delete_scratch=True,      # delete temp files when finished
               silent=False)             # print MD log info in screen

# Run simulation and get trajectory (MDTraj) and energy
trajectory, energy = calc.run_md(whole=True) 

# plot energies
plt.plot(energy['potential'], label='potential')
plt.plot(energy['kinetic'], label='kinetic')
plt.plot(energy['total'], label='total')
plt.legend()
plt.show()

# Store trajectory
trajectory.save('trajectory.gro')

Contact info

Abel Carreras
abelcarreras83@gmail.com

Donostia International Physics Center (DIPC)
Donostia-San Sebastian, Euskadi (Spain)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gromorg-0.3.1.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gromorg-0.3.1-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file gromorg-0.3.1.tar.gz.

File metadata

  • Download URL: gromorg-0.3.1.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gromorg-0.3.1.tar.gz
Algorithm Hash digest
SHA256 576afda0e80a5899ca2e52192b30bdd20ab4170ad4371403da46efd4cef3a3d8
MD5 cd634e1ae8c5f95ca3d4d530b1307c08
BLAKE2b-256 2812087ddfd0c5316a4d244f904a2864a85562ef7239abfd52a625c357bc1277

See more details on using hashes here.

Provenance

The following attestation bundles were made for gromorg-0.3.1.tar.gz:

Publisher: python-publish.yml on abelcarreras/gromorg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gromorg-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: gromorg-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gromorg-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a339bd57e9fa65e59cafefde0f24a395383f5ed1e04c7a5ddbb4dc5b5ac05acb
MD5 48b492c63793ad8b0fb25924a1cb9860
BLAKE2b-256 724c2bc63698a4e82487bbd643971b53a8d60d7ba3a38902ce9eff2ae7a2fd6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for gromorg-0.3.1-py3-none-any.whl:

Publisher: python-publish.yml on abelcarreras/gromorg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page