{"id":18524299,"url":"https://github.com/mdanalysis/cellgrid","last_synced_at":"2025-04-09T11:32:00.408Z","repository":{"id":34163640,"uuid":"38007536","full_name":"MDAnalysis/cellgrid","owner":"MDAnalysis","description":null,"archived":false,"fork":false,"pushed_at":"2018-06-09T16:31:13.000Z","size":625,"stargazers_count":7,"open_issues_count":6,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-29T17:36:41.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MDAnalysis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-24T19:53:29.000Z","updated_at":"2018-06-09T16:31:15.000Z","dependencies_parsed_at":"2022-09-02T16:02:11.505Z","dependency_job_id":null,"html_url":"https://github.com/MDAnalysis/cellgrid","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MDAnalysis%2Fcellgrid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MDAnalysis%2Fcellgrid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MDAnalysis%2Fcellgrid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MDAnalysis%2Fcellgrid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MDAnalysis","download_url":"https://codeload.github.com/MDAnalysis/cellgrid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248031639,"owners_count":21036446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T17:40:30.519Z","updated_at":"2025-04-09T11:32:00.388Z","avatar_url":"https://github.com/MDAnalysis.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"CellGrid\n========\n\n[![Build Status](https://img.shields.io/travis/MDAnalysis/cellgrid.svg)](https://travis-ci.org/MDAnalysis/cellgrid)\n[![Coverage](https://img.shields.io/coveralls/MDAnalysis/cellgrid.svg)](https://coveralls.io/r/MDAnalysis/cellgrid?branch=master)\n\nCellgrid offers scalable functions for calculating pairwise distances between arrays of 3d coordinates.\nFor many cases the distances only up to a given value are of interest, meaning that the volume can be decomposed into smaller subvolumes to reduce the number of pairs that need to be calculated.\nCellGrid was designed with molecular dynamics results in mind, and offers support for periodic boundary conditions.\n\nInstall me like this:\n---------------------\n``` bash\ngit clone git@github.com:MDAnalysis/cellgrid.git\ncd cellgrid\npython setup.py install --user\n```\n\nHow to use me\n-------------\n\n``` python\n\u003e\u003e\u003e import numpy as np\n\u003e\u003e\u003e from cellgrid import capped_distance_array\n\n# Random coordinates to search for pairs between\n\u003e\u003e\u003e a = np.random.random(3000).reshape(1000, 3).astype(np.float32)\n\u003e\u003e\u003e b = np.random.random(30000).reshape(10000, 3).astype(np.float32)\n# All reside within a 1 x 1 x 1 box\n\u003e\u003e\u003e box = np.ones(3).astype(np.float32)\n\n# Find all pairs witin 0.25 of each other\n# Returns indices of pairs and the distance between them\n\u003e\u003e\u003e capped_distance_array(a, b, 0.25, box)\n(array([[ 226, 8896],\n        [ 226, 3557],\n        [ 226, 8982],\n        ..., \n        [ 259,   11],\n        [ 259, 2215],\n        [ 259, 5117]]),\n array([ 0.21252801,  0.21431111,  0.12156317, ...,  0.02756999,\n         0.24850761,  0.15750615], dtype=float32))\n\n```\n\nInternally this is done using the eponymous CellGrid object, which takes coordinates and sorts them spatially into Cells.\n\n``` python\n\u003e\u003e\u003e from cellgrid import CellGrid\n\n\u003e\u003e\u003e cg = CellGrid(box, 0.25, a)\n\u003e\u003e\u003e cg\n\u003cCellGrid with dimensions 4, 4, 4\u003e\n\u003e\u003e\u003e cg[0]\n\u003cCell at (0, 0, 0) with 13 coords\u003e\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdanalysis%2Fcellgrid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdanalysis%2Fcellgrid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdanalysis%2Fcellgrid/lists"}