Skip to content

Commit

Permalink
examples
Browse files Browse the repository at this point in the history
  • Loading branch information
killiansheriff committed Mar 13, 2024
1 parent 0b1eaf2 commit eb3d2b1
Show file tree
Hide file tree
Showing 29 changed files with 11,253 additions and 276 deletions.
2 changes: 1 addition & 1 deletion examples/doi-10.48550-arXiv.2311.01545/_frameworks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Model used in https://arxiv.org/abs/2311.01545

INPUT_GDOWN_LINK = 'https://drive.google.com/drive/folders/1VxK5mPu8bveaqFSSYnxrsKfZrTW_qXOX?usp=sharing' # Folder with model weights, sample graphs etc. Permission needs to be anyone with the link.
INPUT_GDOWN_LINK = 'https://drive.google.com/drive/folders/1VxK5mPu8bveaqFSSYnxrsKfZrTW_qXOX?usp=drive_link' # Folder with model weights, sample graphs etc. Permission needs to be anyone with the link.

class SyntheticChemicalMotifIdentifier(BaseSyntheticChemicalMotifIdentifier):
"""Just a class that re use the framework above but that matches the parameters of the first paper.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: black-action
on: [push, pull_request]
jobs:
linter_name:
name: runner / black formatter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: rickstaa/action-black@v1
with:
black_args: ". --check"
fail_on_error: "False"
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python Tests

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
repository_dispatch:
types: [ovito_update]
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.7", "3.10", "3.11"]
exclude:
- os: macos-latest
python-version: "3.7"
- os: windows-latest
python-version: "3.7"
steps:
- uses: actions/checkout@v3
- name: Install apt dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt install -y libegl1 libegl1-mesa libegl-mesa0 libgl1-mesa-glx libopengl0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
check-latest: true
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest
python -m pip install --pre ovito
python -m pip install .
- name: Test with pytest
run: |
pytest
161 changes: 161 additions & 0 deletions examples/doi-TBD/_additional_packages/NshellFinder/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Byte-compiled / optimized / DLL files
.vscode
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
53 changes: 53 additions & 0 deletions examples/doi-TBD/_additional_packages/NshellFinder/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# NShellFinder

![tests](https://github.com/killiansheriff/NShellFinder/actions/workflows/python-tests.yml/badge.svg)

Ovito Python modifier to find the n-th coordination shell neighbors.

## Utilisation
Here is an example on how to find the indices of nearest neighbors -- cluster by shells up to certain cutoff -- for the fcc crystal structure. The scrip can be found in the ``examples/`` folder.

```python
from ovito.io import import_file
from NshellFinder import NshellFinder

pipeline = import_file("fcc.dump")
mod = NshellFinder(crystal_structure="fcc", cutoff=18.2)
pipeline.modifiers.append(mod)
data = pipeline.compute()

neighbor_indices_per_shell = data.attributes["Neighbor indices per shell"]
# (number of nearest neighbor shells up to cutoff, number of atoms, number of nearest neighbors in the shell)

first_nn = neighbor_indices_per_shell[0] # (number of atoms, 12 first nearest neigbors)
second_nn = neighbor_indices_per_shell[1] # (number of atoms, 6 second nearest neighbors)
```


## Installation
For a standalone Python package or Conda environment, please use:
```bash
pip install --user NshellFinder
```

For *OVITO PRO* built-in Python interpreter, please use:
```bash
ovitos -m pip install --user NshellFinder
```

If you want to install the lastest git commit, please replace ``NshellFinder`` by ``git+https://github.com/killiansheriff/NshellFinder.git``.

## Contact
If any questions, feel free to contact me (ksheriff at mit dot edu).

## References & Citing
If you use this repository in your work, please cite:

```
@article{TBD,
title={TBD},
author={Sheriff, Killian and Cao, Yifan and Freitas, Rodrigo},
journal={arXiv preprint TBD},
year={2024}
}
```
Loading

0 comments on commit eb3d2b1

Please sign in to comment.