8000 add LAMMPS .grid(.gz) import by alphataubio · Pull Request #181 · RBVI/ChimeraX · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

add LAMMPS .grid(.gz) import #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

alphataubio
Copy link

Integration Guide for LAMMPS Grid Format in ChimeraX

This guide explains how to integrate the LAMMPS .grid file format support into the ChimeraX map_data bundle.

Overview

LAMMPS (Large-scale Atomic/Molecular Massively Parallel Simulator) can output grid data using the dump grid command. This implementation allows ChimeraX to read and visualize these grid files, similar to how it handles MRC map files.

Files to Add

Create a new grid folder within the map_data bundle with the following files:

  1. __init__.py - Registers the format and provides the open/save functions
  2. grid.py - Contains the actual implementation for reading/writing LAMMPS grid files
  3. test_grid.py - Unit tests for the implementation

Additionally, you need to register the format in the main formats registry.

Integration Steps

1. Create the grid folder

mkdir src/bundles/map_data/src/grid

2. Add the implementation files

Copy the files from the provided code artifacts:

  • __init__.py and grid.py from the main implementation artifact
  • test_grid.py from the unit test artifact

3. Register the format

Add the format entry to the formats dictionary in src/bundles/map_data/src/formats.py as shown in the register format artifact.

4. Update the bundle's setup.py (if necessary)

Make sure the grid subdirectory is included in the package. This should happen automatically with most setup scripts, but check that the directory is included in any package lists.

Testing

To test the implementation:

  1. Build and install the modified bundle
  2. Create a sample LAMMPS grid file (use the provided example as a reference)
  3. Run ChimeraX and open the grid file:
    open sample.grid
    
  4. Test with compressed files:
    open sample.grid.gz
    
  5. The grid data should be loaded and displayed as volume data

You can also run the unit tests directly.

Usage Examples

Opening a grid file

From the ChimeraX command line:

# Open uncompressed file
open path/to/simulation.grid

# Open compressed file
open path/to/simulation.grid.gz

Converting grid to MRC format

After opening a grid file, save it as MRC:

save path/to/output.mrc

Command-line processing

Process the grid file without opening the GUI:

# Uncompressed file
chimerax --nogui --cmd "open path/to/simulation.grid; save path/to/output.mrc; exit"

# Compressed file
chimerax --nogui --cmd "open path/to/simulation.grid.gz; save path/to/output.mrc; exit"

Additional Notes

  • The implementation handles multiple data columns in the grid file, creating a separate volume for each column
  • It also supports files with multiple timesteps, naming each volume accordingly
  • Grid indices in LAMMPS files are typically 0-based, which matches ChimeraX's internal representation
  • Compressed files (.grid.gz) are automatically supported thanks to ChimeraX's stream handling

Troubleshooting

  • If the grid doesn't appear correctly, check the grid origin and step size in the file
  • Use the volume command to adjust visualization parameters
  • For large grid files, consider using memory mapping with the open command's mapMode option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0