Skip to content

Commit

Permalink
Merge branch 'main' into add/performance_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
daico007 authored Sep 25, 2023
2 parents 53fa3b1 + 615fd29 commit a83e9fb
Show file tree
Hide file tree
Showing 215 changed files with 68,538 additions and 3,662 deletions.
128 changes: 128 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: CI

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
schedule:
- cron: "0 0 * * *"

jobs:
test:
if: github.event.pull_request.draft == false
name: GMSO Tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macOS-latest, ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
pydantic-version: ["2"]

defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v3
name: Checkout Branch / Pull Request

- name: Install Mamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment-dev.yml
create-args: >-
python=${{ matrix.python-version }}
pydantic=${{ matrix.pydantic-version }}
- name: Install Package
run: python -m pip install -e .

- name: Test (OS -> ${{ matrix.os }} / Python -> ${{ matrix.python-version }})
run: python -m pytest -v --cov=gmso --cov-report=xml --cov-append --cov-config=setup.cfg --color yes --pyargs gmso

- name: Upload Coverage Report
uses: codecov/codecov-action@v2
with:
name: GMSO-Coverage
verbose: true

bleeding-edge-test:
if: github.event.pull_request.draft == false
name: Bleeding Edge mosdef Tests for GMSO
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v3
name: Checkout Branch / Pull Request

- name: Install Mamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environment-dev.yml
python-version: python="3.10"

- name: Clone mBuild and Foyer and forcefield-utilities
run: |
git clone https://github.com/mosdef-hub/mbuild.git
git clone https://github.com/mosdef-hub/foyer.git
git clone https://github.com/mosdef-hub/forcefield-utilities.git
- name: Update Environment with mbuild/foyer/ffutils Dependencies
run: |
micromamba update --name gmso-dev --file mbuild/environment.yml
micromamba update --name gmso-dev --file foyer/environment.yml
micromamba update --name gmso-dev --file forcefield-utilities/environment-dev.yml
- name: Install Packages from Source
run: |
pip install -e mbuild
pip install -e foyer
pip install -e forcefield-utilities
pip install -e .
- name: Run Bleeding Edge Tests
run: |
python -m pytest -v --color yes --pyargs gmso
docker:
runs-on: ubuntu-latest
needs: test
name: Build Docker Image
if: ${{ false }}

steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Get Tagged Version
run: |
echo "DOCKER_TAGS=mosdef-gmso-${CI_COMMIT_REF_SLUG}, mosdef-gmso-stable" >> $GITHUB_ENV
if: github.ref_type == 'tag'

- name: Get Push Version
run: |
echo "DOCKER_TAGS=mosdef-gmso-${CI_COMMIT_REF_SLUG}, mosdef-gmso-latest" >> $GITHUB_ENV
if: github.ref_type == 'branch'

- name: Docker Image Info
run: |
echo Docker Image tags: ${DOCKER_TAGS}
- name: Build and Push
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ env.DOCKER_TAGS }}
41 changes: 41 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: "41 4 * * 6"

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ python ]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*.py[cod]
*.ipynb_checkpoints
.pymon
test-output.xml

# C extensions
*.so
Expand Down
10 changes: 6 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,26 @@ ci:
submodules: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.4.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
exclude: 'setup.cfg|gmso/tests/files/.*'
- repo: https://github.com/psf/black
rev: 21.8b0
rev: 23.9.1
hooks:
- id: black
args: [--line-length=80]
- repo: https://github.com/pycqa/isort
rev: 5.9.3
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
args: [--profile=black, --line-length=80]
exclude: "gmso/tests/files/.*"
- repo: https://github.com/pycqa/pydocstyle
rev: '6.1.1'
rev: '6.3.0'
hooks:
- id: pydocstyle
exclude: ^(gmso/abc|gmso/core|gmso/tests/|docs/|devtools/|setup.py)
Expand Down
7 changes: 5 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@

version: 2
formats:
- htmlzip
- pdf
conda:
environment: docs/docs-env.yml

build:
os: ubuntu-20.04
tools:
python: "mambaforge-4.10"
sphinx:
builder: html
configuration: docs/conf.py
Expand Down
41 changes: 13 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
ARG PY_VERSION=3.7
FROM continuumio/miniconda3:4.8.2-alpine AS builder
ARG PY_VERSION
FROM mambaorg/micromamba:1.4.3

EXPOSE 8888

LABEL maintainer.name="mosdef-hub"\
maintainer.url="https://mosdef.org"
maintainer.url="https://mosdef.org"

ENV PATH /opt/conda/bin:$PATH

Expand All @@ -15,30 +13,17 @@ ADD . /gmso

WORKDIR /gmso

RUN conda update conda -yq && \
conda config --set always_yes yes --set changeps1 no && \
. /opt/conda/etc/profile.d/conda.sh && \
sed -i -E "s/python.*$/python="$PY_VERSION"/" environment-dev.yml && \
conda install -c conda-forge mamba && \
mamba env create nomkl -f environment-dev.yml && \
conda activate gmso-dev && \
mamba install -c conda-forge nomkl jupyter && \
python setup.py install && \
echo "source activate gmso-dev" >> \
/home/anaconda/.profile && \
conda clean -afy && \
mkdir /home/anaconda/data && \
chown -R anaconda:anaconda /gmso && \
chown -R anaconda:anaconda /opt && \
chown -R anaconda:anaconda /home/anaconda

WORKDIR /home/anaconda

COPY devtools/docker-entrypoint.sh /entrypoint.sh

RUN chmod a+x /entrypoint.sh

USER anaconda
RUN apt-get update && apt-get install -y git

RUN micromamba create --file environment-dev.yml && \
micromamba clean -afy
ARG MAMBA_DOCKERFILE_ACTIVATE=1 # (otherwise python will not be found)

RUN micromamba install -c conda-forge nomkl jupyter python="3.10" && \
python setup.py install && \
echo "source activate gmso-dev" >> /home/.bashrc && \
mkdir -p /home/data


ENTRYPOINT ["/entrypoint.sh"]
CMD ["jupyter"]
50 changes: 35 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## GMSO: General Molecular Simulation Object
![](https://anaconda.org/conda-forge/gmso/badges/license.svg)
[![](https://anaconda.org/conda-forge/gmso/badges/version.svg)](https://anaconda.org/conda-forge/gmso)
[![Build Status](https://dev.azure.com/mosdef/mosdef/_apis/build/status/mosdef-hub.gmso?branchName=master)](https://dev.azure.com/mosdef/mosdef/_build/latest?definitionId=9&branchName=master)
[![CI](https://github.com/mosdef-hub/gmso/actions/workflows/CI.yaml/badge.svg)](https://github.com/mosdef-hub/gmso/actions/workflows/CI.yaml)
[![codecov](https://codecov.io/gh/mosdef-hub/gmso/branch/master/graph/badge.svg?token=rqPGwmXDzu)](undefined)

`GMSO`is a flexible storage of chemical topology for molecular simulation.
Expand All @@ -14,23 +14,26 @@ To learn more, get started, or contribute, check out our [Documentation](https:/
<img src="docs/images/mosdef_graphic_gmso.png?raw=true" alt="GMSO within the MoSDeF Ecosystem" width="500" height="500"/>
</p>

This is an example using `mBuild` and `Foyer` to build a `GMSO` topology through [`ParmEd`](https://parmed.github.io/ParmEd/html/index.html) and write out to [`LAMMPS`](https://docs.lammps.org/).
This is an example using `mBuild` and `Foyer` to build a `GMSO` topology and write out to [`LAMMPS`](https://docs.lammps.org/).
```python
import foyer
import forcefield_utilities as ffutils
from mbuild.lib.molecules import Ethane
from gmso.external.convert_parmed import from_parmed
from gmso.external.convert_mbuild import from_mbuild
from gmso.parameterization import apply
from gmso.formats.lammpsdata import write_lammpsdata
# Start with a mBuild compound
mb_ethane = Ethane()
oplsaa = foyer.Forcefield(name='oplsaa')
oplsaa = ffutils.FoyerFFs().load('oplsaa').to_gmso_ff()
# atomtype the system with foyer, and convert the resulting structure to a topology
typed_ethane = from_parmed(oplsaa.apply(mb_ethane))
typed_ethane.name = 'ethane'
gmso_ethane = from_mbuild(mb_ethane)
apply(top=gmso_ethane,
forcefields=oplsaa,
identify_connections=True)
# Write out lammps datafile
write_lammpsdata(typed_ethane, filename='ethane.lammps', atom_style='full')
write_lammpsdata(gmso_ethane, filename='ethane.lammps', atom_style='full')
```


Introduction
------------

Expand Down Expand Up @@ -107,19 +110,36 @@ For full, detailed instructions, refer to the [documentation for installation](h
conda install -c conda-forge gmso
```

### `pip` installation quickstart
_Note: `GMSO` is not on `pypi` currently, but its dependencies are._
### Installing from source

```bash
git clone https://github.com/mosdef-hub/gmso.git
Dependencies of GMSO are listed in the files ``environment.yml`` (lightweight environment specification containing minimal dependencies) and ``environment-dev.yml`` (comprehensive environment specification including optional and testing packages for developers).
The ``gmso`` or ``gmso-dev`` conda environments can be created with


```.. code-block:: bash
git clone https://github.com/mosdef-hub/gmso.git
cd gmso
pip install -r requirements.txt
pip install -e .
# for gmso conda environment
conda env create -f environment.yml
conda activate gmso
# for gmso-dev
conda env create -f environment-dev.yml
conda activate gmso-dev
# install a non-editable version of gmso
pip install .
```

`pip` quickstart will install `GMSO` in [`editable` mode](https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs), which means that as you edit the source code of `GMSO` those edits will be reflected in your installation.
### Install an editable version from source

Once all dependencies have been installed and the ``conda`` environment has been created, the ``GMSO`` itself can be installed.

``` code-block:: bash
cd gmso
conda activate gmso-dev # or gmso depending on your installation
pip install -e .
```
Documentation
-------------

Expand Down
Loading

0 comments on commit a83e9fb

Please sign in to comment.