Skip to content

Commit

Permalink
Ani 2x (#480)
Browse files Browse the repository at this point in the history
* Adding ANI-2x parameters

* Moving 2x to seperate branch

* Adding ANI-2x to new branch

* Adding 2x network

* Update models.py

* Update api.rst

* Update __init__.py

Co-authored-by: Christian Devereux <[email protected]>
Co-authored-by: Farhad Ramezanghorbani <[email protected]>
  • Loading branch information
3 people committed Jun 5, 2020
1 parent 13cacd0 commit 279e53a
Show file tree
Hide file tree
Showing 559 changed files with 252,361 additions and 5 deletions.
2 changes: 2 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Model Zoo
:members:
.. autoclass:: torchani.models.ANI1ccx
:members:
.. autoclass:: torchani.models.ANI2x
:members:


Datasets
Expand Down
10 changes: 8 additions & 2 deletions torchani/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# -*- coding: utf-8 -*-
"""TorchANI is a PyTorch implementation of `ANI`_, created and maintained by
"""`TorchANI`_ is a PyTorch implementation of `ANI`_, created and maintained by
the `Roitberg group`_. TorchANI contains classes like
:class:`AEVComputer`, :class:`ANIModel`, and :class:`EnergyShifter` that can
be pipelined to compute molecular energies from the 3D coordinates of
molecules. It also include tools to: deal with ANI datasets(e.g. `ANI-1`_,
`ANI-1x`_, `ANI-1ccx`_, etc.) at :attr:`torchani.data`, import various file
`ANI-1x`_, `ANI-1ccx`_, `ANI-2x`_) at :attr:`torchani.data`, import various file
formats of NeuroChem at :attr:`torchani.neurochem`, and more at :attr:`torchani.utils`.
.. _TorchANI:
https://doi.org/10.26434/chemrxiv.12218294.v1
.. _ANI:
http://pubs.rsc.org/en/Content/ArticleLanding/2017/SC/C6SC05720A#!divAbstract
Expand All @@ -21,6 +24,9 @@
.. _ANI-1ccx:
https://doi.org/10.26434/chemrxiv.6744440.v1
.. _ANI-2x:
https://doi.org/10.26434/chemrxiv.11819268.v1
"""

from .utils import EnergyShifter
Expand Down
26 changes: 23 additions & 3 deletions torchani/models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
"""The ANI model zoo that stores public ANI models.
Currently the model zoo has two models: ANI-1x and ANI-1ccx. The classes
of these two models are :class:`ANI1x` and :class:`ANI1ccx`,
these are subclasses of :class:`torch.nn.Module`.
Currently the model zoo has three models: ANI-1x, ANI-1ccx, and ANI-2x.
The classes of these models are :class:`ANI1x`, :class:`ANI1ccx`, and
:class:`ANI2x` these are subclasses of :class:`torch.nn.Module`.
To use the models just instantiate them and either
directly calculate energies or get an ASE calculator. For example:
Expand Down Expand Up @@ -282,3 +282,23 @@ def ANI1ccx(periodic_table_index=False, model_index=None):
if model_index is None:
return BuiltinEnsemble._from_neurochem_resources(info_file, periodic_table_index)
return BuiltinModel._from_neurochem_resources(info_file, periodic_table_index, model_index)


def ANI2x(periodic_table_index=False, model_index=None):
"""The ANI-2x model as in `ANI2x Paper`_ and `ANI2x Results on GitHub`_.
The ANI-2x model is an ensemble of 8 networks that was trained on the
ANI-2x dataset. The target level of theory is wB97X/6-31G(d). It predicts
energies on HCNOFSCl elements exclusively it shouldn't be used with other
atom types.
.. _ANI2x Results on GitHub:
https://github.com/cdever01/ani-2x_results
.. _ANI2x Paper:
https://doi.org/10.26434/chemrxiv.11819268.v1
"""
info_file = 'ani-2x_8x.info'
if model_index is None:
return BuiltinEnsemble._from_neurochem_resources(info_file, periodic_table_index)
return BuiltinModel._from_neurochem_resources(info_file, periodic_table_index, model_index)
4 changes: 4 additions & 0 deletions torchani/resources/ani-2x_8x.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ani-2x_8x/rHCNOSFCl-5.1R_16-3.5A_a8-4.params
ani-2x_8x/sae_linfit.dat
ani-2x_8x/train
8
229 changes: 229 additions & 0 deletions torchani/resources/ani-2x_8x/inputtrain.ipt
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
sflparamsfile=rHCNOSFCl-5.1R_16-3.5A_a8-4.params
ntwkStoreDir=networks/
atomEnergyFile=sae_linfit.dat
nmax=0
tolr=40
emult=5.0000000e-01
eta=0.001
tcrit=1.0000000e-05
tmax=0
tbtchsz=2048
vbtchsz=2048
gpuid=0
ntwshr=0
nkde=0
energy=1
force=1
dipole=0
charge=0
acachg=0
fmult=0.001
pbc=0
cmult=1.0000000e+00
runtype=ANNP_CREATE_HDNN_AND_TRAIN
adptlrn=OFF
decrate=9.0000000e-01
moment=ADAM
mu=9.9000000e-01
cdweight=0.1
repuls=0
seed=1065533848
network_setup {
inputsize=1008;
atom_net H $
layer [
nodes=256;
activation=9;
type=0;
l2norm=1;
l2valu=1.0000000e-06;
]
layer [
nodes=192;
activation=9;
type=0;
l2norm=0;
l2valu=1.0000000e-06;
]
layer [
nodes=160;
activation=9;
type=0;
l2norm=0;
l2valu=1.0000000e-06;
]
layer [
nodes=1;
activation=6;
type=0;
]
$
atom_net C $
layer [
nodes=224;
activation=9;
type=0;
l2norm=1;
l2valu=1.0000000e-06;
]
layer [
nodes=192;
activation=9;
type=0;
l2norm=0;
l2valu=1.0000000e-06;
]
layer [
nodes=160;
activation=9;
type=0;
l2norm=0;
l2valu=1.0000000e-06;
]
layer [
nodes=1;
activation=6;
type=0;
]
$
atom_net N $
layer [
nodes=192;
activation=9;
type=0;
l2norm=1;
l2valu=1.0000000e-06;
]
layer [
nodes=160;
activation=9;
type=0;
l2norm=0;
l2valu=1.0000000e-06;
]
layer [
nodes=128;
activation=9;
type=0;
l2norm=0;
l2valu=1.0000000e-06;
]
layer [
nodes=1;
activation=6;
type=0;
]
$
atom_net O $
layer [
nodes=192;
activation=9;
type=0;
l2norm=1;
l2valu=1.0000000e-06;
]
layer [
nodes=160;
activation=9;
type=0;
l2norm=0;
l2valu=1.0000000e-06;
]
layer [
nodes=128;
activation=9;
type=0;
l2norm=0;
l2valu=1.0000000e-06;
]
layer [
nodes=1;
activation=6;
type=0;
]
$
atom_net S $
layer [
nodes=160;
activation=9;
type=0;
l2norm=1;
l2valu=1.0000000e-06;
]
layer [
nodes=128;
activation=9;
type=0;
l2norm=0;
l2valu=1.0000000e-06;
]
layer [
nodes=96;
activation=9;
type=0;
l2norm=0;
l2valu=1.0000000e-06;
]
layer [
nodes=1;
activation=6;
type=0;
]
$
atom_net F $
layer [
nodes=160;
activation=9;
type=0;
l2norm=1;
l2valu=1.0000000e-06;
]
layer [
nodes=128;
activation=9;
type=0;
l2norm=0;
l2valu=1.0000000e-06;
]
layer [
nodes=96;
activation=9;
type=0;
l2norm=0;
l2valu=1.0000000e-06;
]
layer [
nodes=1;
activation=6;
type=0;
]
$
atom_net Cl $
layer [
nodes=160;
activation=9;
type=0;
l2norm=1;
l2valu=1.0000000e-06;
]
layer [
nodes=128;
activation=9;
type=0;
l2norm=0;
l2valu=1.0000000e-06;
]
layer [
nodes=96;
activation=9;
type=0;
l2norm=0;
l2valu=1.0000000e-06;
]
layer [
nodes=1;
activation=6;
type=0;
]
$
}
14 changes: 14 additions & 0 deletions torchani/resources/ani-2x_8x/rHCNOSFCl-5.1R_16-3.5A_a8-4.params
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
DESC = ANI_NORMAL
TM = 1
CG = 0
RP = 0
AC = 0
Rcr = 5.1000e+00
Rca = 3.5000e+00
EtaR = [1.9700000e+01]
ShfR = [8.0000000e-01,1.0687500e+00,1.3375000e+00,1.6062500e+00,1.8750000e+00,2.1437500e+00,2.4125000e+00,2.6812500e+00,2.9500000e+00,3.2187500e+00,3.4875000e+00,3.7562500e+00,4.0250000e+00,4.2937500e+00,4.5625000e+00,4.8312500e+00]
Zeta = [1.4100000e+01]
ShfZ = [3.9269908e-01,1.1780972e+00,1.9634954e+00,2.7488936e+00]
EtaA = [1.2500000e+01]
ShfA = [8.0000000e-01,1.1375000e+00,1.4750000e+00,1.8125000e+00,2.1500000e+00,2.4875000e+00,2.8250000e+00,3.1625000e+00]
Atyp = [H,C,N,O,S,F,Cl]
7 changes: 7 additions & 0 deletions torchani/resources/ani-2x_8x/sae_linfit.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
H,0=-0.5978583943827134
C,1=-38.08933878049795
N,2=-54.711968298621066
O,3=-75.19106774742086
S,4=-398.1577125334925
F,5=-99.80348506781634
Cl,6=-460.1681939421027
Loading

0 comments on commit 279e53a

Please sign in to comment.