Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Commit f313375

Browse files
author
Yunqi Shao
committed
Initial public release
Coauthored with Matti Hellström, Pavlin D. Mitev, Lisanne Knijff and Chao Zhang
0 parents  commit f313375

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+6760
-0
lines changed

.circleci/build_doc.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# SHELL script for building the documentation and push to github pages
4+
# taken from here: https://www.alkaline-ml.com/2018-12-23-automate-gh-builds/
5+
6+
set -e
7+
shopt -s extglob
8+
9+
cd doc
10+
make clean html
11+
cd ..
12+
13+
mv doc/_build/html ./
14+
rm -r !(".git"|"html"|".."|".")
15+
16+
git checkout gh-pages
17+
git checkout --orphan gh-pages-tmp
18+
git config --global user.email "$GH_EMAIL" > /dev/null 2>&1
19+
git config --global user.name "$GH_NAME" > /dev/null 2>&1
20+
touch .nojekyll
21+
22+
if [[ "$CIRCLE_BRANCH" =~ ^master$|^[0-9]+\.[0-9]+\.X$ ]]; then
23+
cp -r html/* ./
24+
else
25+
mkdir -p "$CIRCLE_BRANCH"
26+
cp -r html/* ./"$CIRCLE_BRANCH"
27+
fi
28+
29+
rm -r html/
30+
git add --all
31+
git commit --allow-empty -m "[ci skip] Publishing updated documentation..."
32+
git remote rm origin
33+
git remote add origin https://"$GH_NAME":"$GH_TOKEN"@github.com/teoroo-cmc/PiNN.git
34+
git push --force origin gh-pages-tmp:gh-pages

.circleci/config.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Python CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-python/ for more details
4+
#
5+
version: 2
6+
workflows:
7+
version: 2
8+
build-and-test:
9+
jobs:
10+
- build
11+
- pytest:
12+
requires:
13+
- build
14+
- deploy-doc:
15+
requires:
16+
- build
17+
jobs:
18+
build:
19+
docker:
20+
- image: circleci/python:3.6.1
21+
working_directory: ~/repo
22+
steps:
23+
- checkout
24+
- restore_cache:
25+
keys:
26+
- venv-{{ checksum "requirements-dev.txt" }}-{{ checksum ".circleci/config.yml" }}
27+
- venv-
28+
- run:
29+
name: Install dependencies
30+
command: |
31+
python3 -m venv venv
32+
. venv/bin/activate
33+
pip install tensorflow==1.13.1
34+
pip install -r requirements-dev.txt
35+
- save_cache:
36+
paths:
37+
- ./venv
38+
key: venv-{{ checksum "requirements-dev.txt" }}-{{ checksum ".circleci/config.yml" }}
39+
pytest:
40+
docker:
41+
- image: circleci/python:3.6.1
42+
working_directory: ~/repo
43+
steps:
44+
- checkout
45+
- restore_cache:
46+
keys:
47+
- venv-{{ checksum "requirements-dev.txt" }}-{{ checksum ".circleci/config.yml" }}
48+
- run:
49+
name: run tests
50+
command: |
51+
. venv/bin/activate
52+
pip install -e .
53+
export CUDA_VISIBLE_DEVICES=''
54+
pytest tests/ --cov=pinn
55+
codecov --token=$CODECOV_TOKEN
56+
deploy-doc:
57+
docker:
58+
- image: circleci/python:3.6.1
59+
working_directory: ~/repo
60+
steps:
61+
- checkout
62+
- restore_cache:
63+
keys:
64+
- venv-{{ checksum "requirements-dev.txt" }}-{{ checksum ".circleci/config.yml" }}
65+
- run:
66+
name: Deploy doc
67+
command: |
68+
. venv/bin/activate
69+
sudo apt-get update
70+
sudo apt-get install pandoc
71+
pip install -e .
72+
./.circleci/build_doc.sh

.coveragerc

Whitespace-only changes.

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*/__pycache__
2+
.pytest_cache
3+
pinn.egg-info/
4+
tmp/
5+
*.pyc
6+
*~
7+
_build/
8+
.ipynb_checkpoints/
9+
/.coverage
10+
/coverage.xml

.readthedocs.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
3+
# Build documentation in the docs/ directory with Sphinx
4+
sphinx:
5+
configuration: doc/conf.py
6+
7+
# Optionally build your docs in additional formats such as PDF and ePub
8+
formats: []
9+
10+
# Optionally set the version of Python and requirements required to build your docs
11+
python:
12+
version: 3.7
13+
install:
14+
- requirements: doc/requirements.txt
15+
- requirements: requirements-dev.txt
16+
- path: .

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM tensorflow/tensorflow:1.13.1-py3-jupyter
2+
3+
# Install PiNN
4+
COPY . /opt/src/pinn
5+
RUN pip install /opt/src/pinn && \
6+
pip install -r /opt/src/pinn/requirements-dev.txt && \
7+
pip install -r /opt/src/pinn/requirements-extra.txt && \
8+
jupyter nbextension enable widgetsnbextension --py --sys-prefix && \
9+
jupyter nbextension enable nglview --py --sys-prefix && \
10+
jupyter tensorboard enable --sys-prefix
11+
12+
# Setup
13+
ENTRYPOINT ["pinn_train"]

Dockerfile-gpu

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM tensorflow/tensorflow:1.13.1-gpu-py3-jupyter
2+
3+
# Install PiNN
4+
COPY . /opt/src/pinn
5+
RUN pip install /opt/src/pinn && \
6+
pip install -r /opt/src/pinn/requirements-dev.txt && \
7+
pip install -r /opt/src/pinn/requirements-extra.txt && \
8+
jupyter nbextension enable widgetsnbextension --py --sys-prefix && \
9+
jupyter nbextension enable nglview --py --sys-prefix && \
10+
jupyter tensorboard enable --sys-prefix
11+
12+
# Setup
13+
ENTRYPOINT ["pinn_train"]

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2019, Teoroo-CMC
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.rst

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
==========================================================
2+
PiNN: a Python library for building atomic neural networks
3+
==========================================================
4+
5+
.. image:: https://img.shields.io/circleci/build/github/Teoroo-CMC/PiNN/master.svg?style=flat-square&token=dd8894015481e2f87675a340fbfa712c94d69e8f
6+
:target: https://circleci.com/gh/Teoroo-CMC/PiNN/tree/master
7+
8+
.. image:: https://img.shields.io/codecov/c/github/Teoroo-CMC/PiNN/master.svg?style=flat-square
9+
:target: https://codecov.io/gh/Teoroo-CMC/PiNN/branch/master
10+
11+
.. image:: https://img.shields.io/docker/cloud/build/yqshao/pinn.svg?style=flat-square
12+
:target: https://cloud.docker.com/repository/docker/yqshao/pinn
13+
14+
.. image:: https://readthedocs.org/projects/teoroo-pinn/badge/?version=latest&style=flat-square
15+
:target: https://teoroo-pinn.readthedocs.io/en/latest/?badge=latest
16+
17+
PiNN is a Python library built on top of TensorFlow for building
18+
atomic neural network potentials. The PiNN library also provides
19+
elemental layers and abstractions to implement various atomic neural
20+
networks.
21+
22+
The code is currenly maintained by Yunqi Shao at Uppsala Unversiy.
23+
24+
Reference
25+
=========
26+
- Shao, Y.; Hellström, M.; Mitev, P. D.; Knijff, L.; Zhang, C. PiNN: A
27+
Python Library for Building Atomic Neural Networks of Molecules and
28+
Materials. arXiv:1910.03376 [cond-mat, physics:physics] 2019. `link
29+
<http://arxiv.org/abs/1910.03376>`_
30+
31+
Requirements
32+
============
33+
- Python 3
34+
- TensorFlow (tested with 1.13.1)
35+
- ASE
36+
37+
Installation
38+
============
39+
40+
Install from source code::
41+
42+
git clone https://github.com/Teoroo-CMC/PiNN.git
43+
cd PiNN && pip install -e .
44+
45+
Or use our `docker
46+
image <https://cloud.docker.com/repository/docker/yqshao/pinn/tags>`_. If
47+
you use singularity, you can build a singularity image directly from
48+
the docker image::
49+
50+
singularity build pinn.sif docker://yqshao/pinn:latest (or latest-gpu)
51+
singularity exec pinn.sif jupyter notebook # this starts a jupyter notebook server
52+
./pinn.sif -h # this invokes the pinn_train trainner
53+
54+
Extra dependencies are in:
55+
56+
- ``requirements-dev.txt``: dependency for testing and documentation building.
57+
- ``requirements-extra.txt``: extra libraries for various purposes, included in the docker image.
58+
59+
Quick Start
60+
===========
61+
A set of tutorial notebooks can be found in the `documentation <https://teoroo-pinn.readthedocs.io/en/latest>`_.
62+
63+
Models and datasets
64+
===================
65+
66+
Dataset loaders
67+
---------------
68+
- CP2K format
69+
- RuNNer format
70+
- ANI-1 dataset
71+
- QM9 dataset
72+
73+
Implemented Networks
74+
--------------------
75+
- PiNet
76+
- Behler-Parrinello Neural Network
77+
78+
Implemented models
79+
------------------
80+
- Potential model
81+
- Dipole model
82+
83+
Community
84+
=========
85+
As an open-source project, the following contributions are highly welcome:
86+
87+
- Reporting bugs
88+
- Proposing new features
89+
- Discussing the current version of the code
90+
- Submitting fixes
91+
92+
We use Github to host code, to track issues and feature requests, as well
93+
as to accept pull requests.
94+
95+
Please follow the procedure below before you open a new issue.
96+
97+
- Check for duplicate issues first.
98+
- If you are reporting a bug, include the system information
99+
(platform, Python and TensorFlow version etc.).
100+
101+
If you would like to add some new features via pull request, please
102+
discuss with the main developer (Yunqi Shao) first to see whether it
103+
fits the scope and aims of this project.

doc/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
SOURCEDIR = .
8+
BUILDDIR = _build
9+
10+
# Put it first so that "make" without argument is like "make help".
11+
help:
12+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
13+
14+
.PHONY: help Makefile
15+
16+
# Catch-all target: route all unknown targets to Sphinx using the new
17+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
18+
%: Makefile
19+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

doc/ase.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
=============
2+
ASE interface
3+
=============
4+
5+
PiNN provides a ``PiNN_calc`` class to interface with ASE.
6+
7+
A calculator can be created from a model as simple as:
8+
9+
.. code:: python
10+
11+
from pinn.models import potential_model
12+
from pinn.calculator import PiNN_calc
13+
calc = PiNN_calc(potential_modle('/path/to/model/'))
14+
calc.calculate(atoms)
15+
16+
The implemented properties of the calculator depend on the prediciton
17+
returns of ``model_fn``. For example: energy, forces and stress (with
18+
PBC) calculations are implemented for the potential model; partial
19+
charge and dipole calculations are implemented for the dipole model.
20+
21+
The calculator can then be used in ASE optimizers and molecular
22+
dynamics engines. Note that the calculator will try to use the same
23+
predictor (a generator given by ``estimator.predict``) whenever
24+
possible, so as to avoid the expensive reconstruction of the
25+
computation graph. However, the graph will be reconstructed if the pbc
26+
condition of the input ``Atoms`` is changed. Also, the predictor must
27+
be reset if it is interupted for some reasons.
28+

0 commit comments

Comments
 (0)