Skip to content
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

Add farhadh/zasdfgbnm changes #21

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/deploy-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ jobs:
- name: Deploy
run: |
rm -rf dist/*
python setup.py bdist bdist_wheel
python setup.py sdist bdist_wheel
twine upload -u zasdfgbnm-bot -p ${{secrets.zasdfgbnm_bot_pypi_password}} dist/*
5 changes: 2 additions & 3 deletions .github/workflows/deploy-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- cron: '0 0 * * *'

jobs:
build:
deploy-test:

runs-on: ubuntu-latest
strategy:
Expand All @@ -29,8 +29,7 @@ jobs:
pip install twine wheel
- name: Deploy
run: |
[ ! -z "$GITHUB_HEAD_REF" ] && exit
rm -rf dist/*
git tag $(date +'v%Y.%m.%d.%H.%M.%S')
python setup.py bdist bdist_wheel
python setup.py sdist bdist_wheel
twine upload --repository-url https://test.pypi.org/legacy/ -u zasdfgbnm-bot -p ${{secrets.zasdfgbnm_bot_test_pypi_password}} dist/*
2 changes: 1 addition & 1 deletion .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.7, 3.8]

steps:
- uses: actions/checkout@v1
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ dist
*.swo
/download
/download.tar.xz
/torchani/resources/*.info
/torchani/resources/ani-1ccx_8x
/torchani/resources/ani-2x_8x
*.qdrep
*.qdstrm
*.zip
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ To run the tests and examples, you must manually download a data package

Please cite the following paper if you use TorchANI

* Xiang Gao, Farhad Ramezanghorbani, Olexandr Isayev, Justin S. Smith, and Adrian E. Roitberg. *TorchANI: A Free and Open Source PyTorch Based Deep Learning Implementation of the ANI Neural Network Potentials*. Journal of Chemical Information and Modeling Just Accepted Manuscript, [![DOI for Citing](https://img.shields.io/badge/DOI-10.1021%2Facs.jcim.0c00451-green.svg)](https://doi.org/10.1021/acs.jcim.0c00451)
* Xiang Gao, Farhad Ramezanghorbani, Olexandr Isayev, Justin S. Smith, and Adrian E. Roitberg. *TorchANI: A Free and Open Source PyTorch Based Deep Learning Implementation of the ANI Neural Network Potentials*. Journal of Chemical Information and Modeling 2020 60 (7), 3408-3415, [![DOI for Citing](https://img.shields.io/badge/DOI-10.1021%2Facs.jcim.0c00451-green.svg)](https://doi.org/10.1021/acs.jcim.0c00451)

[![JCIM Cover](https://pubs.acs.org/na101/home/literatum/publisher/achs/journals/content/jcisd8/2020/jcisd8.2020.60.issue-7/jcisd8.2020.60.issue-7/20200727/jcisd8.2020.60.issue-7.largecover.jpg)](https://pubs.acs.org/toc/jcisd8/60/7)

* Please refer to [isayev/ASE_ANI](https://github.com/isayev/ASE_ANI) for ANI model references.

Expand Down
10 changes: 9 additions & 1 deletion torchani/aev.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
from torch import Tensor
import math
from typing import Tuple, Optional, NamedTuple
from torch.jit import Final
import sys

if sys.version_info[:2] < (3, 7):
class FakeFinal:
def __getitem__(self, x):
return x
Final = FakeFinal()
else:
from torch.jit import Final


class SpeciesAEV(NamedTuple):
Expand Down
26 changes: 13 additions & 13 deletions torchani/neurochem/parse_resources.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import os
import io
import requests
import glob
import zipfile
import shutil
from distutils import dir_util
from pathlib import Path


Expand All @@ -18,13 +17,13 @@ def parse_neurochem_resources(info_file_path):
resource_path = os.path.join(torchani_dir, 'resources/')
local_dir = os.path.expanduser('~/.local/torchani/')

if os.path.isfile(os.path.join(resource_path, info_file_path)):
# No action needed if the info file can be located in the default path
if os.stat(os.path.join(resource_path, info_file_path)).st_size != 0:
# No action needed if the info file located in the default path is not zero-sized
pass

elif os.path.isfile(os.path.join(local_dir, info_file_path)):
# if the info file is not located in the default path, ~/.local/torchani
# is tried as an alternative
# if a non-zero sized info file is not located in the default path,
# ~/.local/torchani is tried as an alternative
resource_path = local_dir

else:
Expand All @@ -40,18 +39,19 @@ def parse_neurochem_resources(info_file_path):
resource_res = requests.get(url)
resource_zip = zipfile.ZipFile(io.BytesIO(resource_res.content))
try:
# by default try to extract inside resources and overwrite the
# zero sized files
resource_zip.extractall(resource_path)
except PermissionError:
# if this fails then files are extracted in ~/.local/torchani
resource_zip.extractall(local_dir)
resource_path = local_dir
files = glob.glob(os.path.join(resource_path, extracted_name, "resources", "*"))
for f in files:
try:
shutil.move(f, resource_path)
except shutil.Error:
pass
shutil.rmtree(os.path.join(resource_path, extracted_name))

# copy all files inside the extracted directory and remove
# the directory itself
source = os.path.join(resource_path, extracted_name, "resources")
dir_util.copy_tree(source, resource_path)
dir_util.remove_tree(os.path.join(resource_path, extracted_name))
else:
raise ValueError('File {0} could not be found either in {1} or {2}\n'
'It is also not one of the supported builtin info files:'
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Loading