Unverified Commit 923c8af4 authored by Gao, Xiang's avatar Gao, Xiang Committed by GitHub
Browse files

Python2 Inference Support (#171)

parent 1b2faf43
queue:
name: Hosted Ubuntu 1604
timeoutInMinutes: 30
trigger:
batch: true
branches:
include:
- master
variables:
python.version: '2.7'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- script: 'azure/install_dependencies.sh && pip install .'
displayName: 'Install dependencies'
- script: 'python2 examples/energy_force.py'
displayName: Energy and Force Example
- script: 'python2 examples/ase_interface.py'
displayName: ASE Interface Example
......@@ -16,6 +16,7 @@ calculator.
###############################################################################
# To begin with, let's first import the modules we will use:
from __future__ import print_function
from ase.lattice.cubic import Diamond
from ase.md.langevin import Langevin
from ase.optimize import BFGS
......
......@@ -9,6 +9,7 @@ TorchANI and can be used directly.
###############################################################################
# To begin with, let's first import the modules we will use:
from __future__ import print_function
import torch
import torchani
......
......@@ -27,12 +27,14 @@ at :attr:`torchani.ignite`, and more at :attr:`torchani.utils`.
from .utils import EnergyShifter
from .nn import ANIModel, Ensemble
from .aev import AEVComputer
from . import ignite
from . import utils
from . import neurochem
from . import data
from . import models
from pkg_resources import get_distribution, DistributionNotFound
import sys
if sys.version_info[0] > 2:
from . import ignite
from . import data
try:
__version__ = get_distribution(__name__).version
......
import math
if not hasattr(math, 'inf'):
math.inf = float('inf')
import torch
import itertools
from . import _six # noqa:F401
import math
from . import utils
......
......@@ -5,6 +5,7 @@
https://wiki.fysik.dtu.dk/ase
"""
from __future__ import absolute_import
import math
import torch
import ase.neighborlist
......@@ -60,7 +61,7 @@ class NeighborList:
dtype=coordinates.dtype)
cell = torch.tensor(self.cell, device=coordinates.device,
dtype=coordinates.dtype)
D += shift @ cell
D += torch.mm(shift, cell)
d = D.norm(2, -1)
neighbor_species1 = []
neighbor_distances1 = []
......
# -*- coding: utf-8 -*-
"""Helpers for working with ignite."""
from __future__ import absolute_import
import torch
from . import utils
from torch.nn.modules.loss import _Loss
from ignite.metrics.metric import Metric
from ignite.metrics import RootMeanSquaredError
from ignite.metrics import Metric, RootMeanSquaredError
from ignite.contrib.metrics.regression import MaximumAbsoluteError
......
This diff is collapsed.
import collections
if not hasattr(collections, 'abc'):
collections.abc = collections
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment