repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
ocp | ocp-main/ocpmodels/common/relaxation/optimizers/lbfgs_torch.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import logging
from collections import deque
from pathlib import Path
from typing import Deque, Optional
import ase
import torch
from torch_... | 7,832 | 31.502075 | 79 | py |
ocp | ocp-main/ocpmodels/common/relaxation/optimizers/__init__.py | 0 | 0 | 0 | py | |
ocp | ocp-main/ocpmodels/models/base.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import logging
import torch
import torch.nn as nn
from torch_geometric.nn import radius_graph
from ocpmodels.common.utils import (
comp... | 3,688 | 27.596899 | 94 | py |
ocp | ocp-main/ocpmodels/models/dimenet.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
from torch import nn
from torch_geometric.nn import DimeNet, radius_graph
from torch_scatter import scatter
from torch_sparse im... | 8,211 | 34.549784 | 98 | py |
ocp | ocp-main/ocpmodels/models/dimenet_plus_plus.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
---
This code borrows heavily from the DimeNet implementation as part of
pytorch-geometric: https://github.com/rusty1s/pytorch_geometric. Licens... | 15,691 | 32.175476 | 80 | py |
ocp | ocp-main/ocpmodels/models/forcenet.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from math import pi as PI
from typing import Optional
import numpy as np
import torch
import torch.nn as nn
from torch_geometric.nn import M... | 18,340 | 34.339114 | 124 | py |
ocp | ocp-main/ocpmodels/models/spinconv.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
import time
from math import pi as PI
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from ... | 43,927 | 33.372457 | 137 | py |
ocp | ocp-main/ocpmodels/models/schnet.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
from torch_geometric.nn import SchNet
from torch_scatter import scatter
from ocpmodels.common.registry import registry
from ocp... | 4,755 | 32.258741 | 98 | py |
ocp | ocp-main/ocpmodels/models/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from .base import BaseModel
from .cgcnn import CGCNN
from .dimenet import DimeNetWrap as DimeNet
from .dimenet_plus_plus import DimeNetPlusPlu... | 676 | 36.611111 | 74 | py |
ocp | ocp-main/ocpmodels/models/cgcnn.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
import torch.nn as nn
from torch_geometric.nn import MessagePassing, global_mean_pool, radius_graph
from torch_geometric.nn.mode... | 8,190 | 33.855319 | 142 | py |
ocp | ocp-main/ocpmodels/models/gemnet/initializers.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
def _standardize(kernel):
"""
Makes sure that N*Var(W) = 1 and E[W] = 0
"""
eps = 1e-6
if len(kernel.shap... | 1,385 | 27.875 | 92 | py |
ocp | ocp-main/ocpmodels/models/gemnet/gemnet.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import Optional
import numpy as np
import torch
from torch_geometric.nn import radius_graph
from torch_scatter import scatter
fr... | 20,301 | 32.724252 | 118 | py |
ocp | ocp-main/ocpmodels/models/gemnet/utils.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import json
import torch
from torch_scatter import segment_csr
def read_json(path: str):
""""""
if not path.endswith(".json"):
... | 9,228 | 31.960714 | 128 | py |
ocp | ocp-main/ocpmodels/models/gemnet/__init__.py | 0 | 0 | 0 | py | |
ocp | ocp-main/ocpmodels/models/gemnet/layers/base_layers.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
import torch
from ..initializers import he_orthogonal_init
class Dense(torch.nn.Module):
"""
Combines dense layer wit... | 3,001 | 24.87931 | 76 | py |
ocp | ocp-main/ocpmodels/models/gemnet/layers/atom_update_block.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
from torch_scatter import scatter
from ocpmodels.modules.scaling import ScaleFactor
from ..initializers import he_orthogonal_i... | 6,443 | 30.281553 | 107 | py |
ocp | ocp-main/ocpmodels/models/gemnet/layers/embedding_block.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import numpy as np
import torch
from .base_layers import Dense
class AtomEmbedding(torch.nn.Module):
"""
Initial atom embeddings b... | 2,424 | 23.25 | 92 | py |
ocp | ocp-main/ocpmodels/models/gemnet/layers/radial_basis.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
from typing import Dict, Union
import numpy as np
import torch
from scipy.special import binom
from torch_geometric.nn.models.sc... | 6,434 | 29.353774 | 77 | py |
ocp | ocp-main/ocpmodels/models/gemnet/layers/basis_utils.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
import numpy as np
import sympy as sym
from scipy import special as sp
from scipy.optimize import brentq
def Jn(r, n):
"""... | 10,403 | 34.148649 | 121 | py |
ocp | ocp-main/ocpmodels/models/gemnet/layers/spherical_basis.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import sympy as sym
import torch
from torch_geometric.nn.models.schnet import GaussianSmearing
from .basis_utils import real_sph_harm
from .... | 3,221 | 32.216495 | 86 | py |
ocp | ocp-main/ocpmodels/models/gemnet/layers/interaction_block.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
import torch
from ocpmodels.modules.scaling.scale_factor import ScaleFactor
from .atom_update_block import AtomUpdateBlock
fro... | 10,381 | 29.356725 | 118 | py |
ocp | ocp-main/ocpmodels/models/gemnet/layers/__init__.py | 0 | 0 | 0 | py | |
ocp | ocp-main/ocpmodels/models/gemnet/layers/efficient.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
from ..initializers import he_orthogonal_init
class EfficientInteractionDownProjection(torch.nn.Module):
"""
Down pro... | 5,005 | 27.770115 | 81 | py |
ocp | ocp-main/ocpmodels/models/painn/painn.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
---
MIT License
Copyright (c) 2021 www.compscience.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this so... | 21,957 | 32.472561 | 96 | py |
ocp | ocp-main/ocpmodels/models/painn/utils.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
from torch_scatter import segment_csr
def repeat_blocks(
sizes,
repeats,
continuous_indexing: bool = True,
sta... | 6,138 | 35.325444 | 128 | py |
ocp | ocp-main/ocpmodels/models/painn/__init__.py | 0 | 0 | 0 | py | |
ocp | ocp-main/ocpmodels/models/escn/so3.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import os
import torch
import torch.nn as nn
try:
from e3nn import o3
from e3nn.o3 import FromS2Grid, ToS2Grid
except ImportError:
... | 19,050 | 32.422807 | 112 | py |
ocp | ocp-main/ocpmodels/models/escn/escn.py | """
Copyright (c) Meta, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import logging
import time
from typing import List
import numpy as np
import torch
import torch.nn as nn
from pyexpat.model import XML_CQUANT_OP... | 34,881 | 33.951904 | 126 | py |
ocp | ocp-main/ocpmodels/models/escn/__init__.py | 0 | 0 | 0 | py | |
ocp | ocp-main/ocpmodels/models/scn/scn.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import logging
import sys
import time
import numpy as np
import torch
import torch.nn as nn
from torch_geometric.nn import radius_graph
fro... | 30,218 | 35.060859 | 136 | py |
ocp | ocp-main/ocpmodels/models/scn/smearing.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
import torch.nn as nn
# Different encodings for the atom distance embeddings
class GaussianSmearing(torch.nn.Module):
def ... | 2,803 | 31.229885 | 77 | py |
ocp | ocp-main/ocpmodels/models/scn/spherical_harmonics.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import logging
import math
import os
import torch
try:
from e3nn import o3
from e3nn.o3 import FromS2Grid, ToS2Grid
# Borrowed... | 14,397 | 36.397403 | 122 | py |
ocp | ocp-main/ocpmodels/models/scn/sampling.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
import torch
### Methods for sample points on a sphere
def CalcSpherePoints(num_points: int, device: str = "cpu") -> torch.Ten... | 1,527 | 31.510638 | 79 | py |
ocp | ocp-main/ocpmodels/models/scn/__init__.py | 0 | 0 | 0 | py | |
ocp | ocp-main/ocpmodels/models/gemnet_gp/initializers.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
def _standardize(kernel):
"""
Makes sure that N*Var(W) = 1 and E[W] = 0
"""
eps = 1e-6
if len(kernel.shap... | 1,385 | 27.875 | 92 | py |
ocp | ocp-main/ocpmodels/models/gemnet_gp/gemnet.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import Optional
import numpy as np
import torch
from torch_cluster import radius_graph
from torch_scatter import scatter
from to... | 22,203 | 33.16 | 118 | py |
ocp | ocp-main/ocpmodels/models/gemnet_gp/utils.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import json
from typing import Optional, Tuple
import torch
from torch_scatter import segment_csr
def read_json(path: str):
""""""
... | 9,439 | 32.006993 | 128 | py |
ocp | ocp-main/ocpmodels/models/gemnet_gp/__init__.py | 0 | 0 | 0 | py | |
ocp | ocp-main/ocpmodels/models/gemnet_gp/layers/base_layers.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
from typing import Optional
import torch
from ..initializers import he_orthogonal_init
class Dense(torch.nn.Module):
"""
... | 3,247 | 25.406504 | 71 | py |
ocp | ocp-main/ocpmodels/models/gemnet_gp/layers/atom_update_block.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import Optional
import torch
from torch_scatter import scatter
from torch_scatter.utils import broadcast
from ocpmodels.common ... | 7,813 | 30.256 | 107 | py |
ocp | ocp-main/ocpmodels/models/gemnet_gp/layers/embedding_block.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import Optional
import numpy as np
import torch
from ocpmodels.common import gp_utils
from .base_layers import Dense
class A... | 2,621 | 23.735849 | 92 | py |
ocp | ocp-main/ocpmodels/models/gemnet_gp/layers/radial_basis.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
from typing import Dict, Union
import numpy as np
import torch
from scipy.special import binom
from ocpmodels.common.typing impo... | 6,381 | 29.103774 | 77 | py |
ocp | ocp-main/ocpmodels/models/gemnet_gp/layers/basis_utils.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
import numpy as np
import sympy as sym
from scipy import special as sp
from scipy.optimize import brentq
def Jn(r, n):
"""... | 10,397 | 34.128378 | 121 | py |
ocp | ocp-main/ocpmodels/models/gemnet_gp/layers/spherical_basis.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import sympy as sym
import torch
from torch_geometric.nn.models.schnet import GaussianSmearing
from ocpmodels.common.typing import assert_is_... | 3,221 | 32.216495 | 86 | py |
ocp | ocp-main/ocpmodels/models/gemnet_gp/layers/interaction_block.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
from typing import Optional
import torch
from ocpmodels.common import gp_utils
from ocpmodels.modules.scaling import ScaleFacto... | 11,227 | 30.016575 | 118 | py |
ocp | ocp-main/ocpmodels/models/gemnet_gp/layers/__init__.py | 0 | 0 | 0 | py | |
ocp | ocp-main/ocpmodels/models/gemnet_gp/layers/efficient.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import Tuple
import torch
from ..initializers import he_orthogonal_init
class EfficientInteractionDownProjection(torch.nn.Mod... | 4,957 | 27.170455 | 81 | py |
ocp | ocp-main/ocpmodels/models/gemnet_oc/initializers.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from functools import partial
import torch
def _standardize(kernel):
"""
Makes sure that N*Var(W) = 1 and E[W] = 0
"""
eps ... | 2,765 | 27.8125 | 137 | py |
ocp | ocp-main/ocpmodels/models/gemnet_oc/interaction_indices.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
from torch_scatter import segment_coo
from torch_sparse import SparseTensor
from .utils import get_inner_idx, masked_select_spar... | 10,507 | 32.787781 | 86 | py |
ocp | ocp-main/ocpmodels/models/gemnet_oc/gemnet_oc.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import logging
import os
from typing import Dict, Optional, Union
import numpy as np
import torch
from torch_geometric.nn import radius_graph... | 48,949 | 34.834553 | 93 | py |
ocp | ocp-main/ocpmodels/models/gemnet_oc/utils.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import numpy as np
import torch
from torch_scatter import segment_coo, segment_csr
from torch_sparse import SparseTensor
def ragged_range(si... | 14,529 | 33.188235 | 128 | py |
ocp | ocp-main/ocpmodels/models/gemnet_oc/__init__.py | 0 | 0 | 0 | py | |
ocp | ocp-main/ocpmodels/models/gemnet_oc/layers/base_layers.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
import torch
from ..initializers import he_orthogonal_init
class Dense(torch.nn.Module):
"""
Combines dense layer with... | 2,826 | 25.175926 | 76 | py |
ocp | ocp-main/ocpmodels/models/gemnet_oc/layers/atom_update_block.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
import torch
from torch_scatter import scatter
from ocpmodels.common.utils import scatter_det
from ocpmodels.modules.scaling imp... | 5,833 | 28.614213 | 78 | py |
ocp | ocp-main/ocpmodels/models/gemnet_oc/layers/embedding_block.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import numpy as np
import torch
from .base_layers import Dense
class AtomEmbedding(torch.nn.Module):
"""
Initial atom embeddings ba... | 2,622 | 24.715686 | 72 | py |
ocp | ocp-main/ocpmodels/models/gemnet_oc/layers/radial_basis.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
from typing import Dict, Union
import numpy as np
import sympy as sym
import torch
from scipy.special import binom
from ocpmodel... | 7,675 | 29.827309 | 77 | py |
ocp | ocp-main/ocpmodels/models/gemnet_oc/layers/basis_utils.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
import numpy as np
import sympy as sym
import torch
from scipy import special as sp
from scipy.optimize import brentq
def Jn(r:... | 11,335 | 32.838806 | 121 | py |
ocp | ocp-main/ocpmodels/models/gemnet_oc/layers/force_scaler.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import logging
import torch
class ForceScaler:
"""
Scales up the energy and then scales down the forces
to prevent NaNs and inf... | 3,081 | 31.442105 | 77 | py |
ocp | ocp-main/ocpmodels/models/gemnet_oc/layers/spherical_basis.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
from ocpmodels.modules.scaling import ScaleFactor
from .basis_utils import get_sph_harm_basis
from .radial_basis import Gaussia... | 4,369 | 29.347222 | 79 | py |
ocp | ocp-main/ocpmodels/models/gemnet_oc/layers/interaction_block.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
import torch
from ocpmodels.modules.scaling import ScaleFactor
from .atom_update_block import AtomUpdateBlock
from .base_layers... | 23,476 | 29.931489 | 85 | py |
ocp | ocp-main/ocpmodels/models/gemnet_oc/layers/__init__.py | 0 | 0 | 0 | py | |
ocp | ocp-main/ocpmodels/models/gemnet_oc/layers/efficient.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import Optional
import torch
from torch_scatter import scatter
from ..initializers import he_orthogonal_init
from .base_layers i... | 9,599 | 34.555556 | 89 | py |
ocp | ocp-main/ocpmodels/models/utils/activations.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import torch
import torch.nn.functional as F
class Act(torch.nn.Module):
def __init__(self, act: str, slope: float = 0.05) -> None:
... | 1,650 | 33.395833 | 74 | py |
ocp | ocp-main/ocpmodels/models/utils/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
| 177 | 34.6 | 65 | py |
ocp | ocp-main/ocpmodels/models/utils/basis.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import math
from typing import List, Optional
import numpy as np
import torch
import torch.nn as nn
from scipy.special import sph_harm
from ... | 10,366 | 32.659091 | 122 | py |
ocp | ocp-main/ocpmodels/datasets/oc22_lmdb_dataset.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import bisect
import logging
import math
import pickle
import random
import warnings
from pathlib import Path
import lmdb
import numpy as np... | 8,611 | 35.961373 | 103 | py |
ocp | ocp-main/ocpmodels/datasets/lmdb_database.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is modified from the ASE db json backend
and is thus licensed under the corresponding LGPL2.1 license
The ASE notice for the LGPL2.1 license is available here:
https://gitlab.com/ase/ase/-/blob/master/LICENSE
"""
import base64
import json
import ... | 10,029 | 27.413598 | 82 | py |
ocp | ocp-main/ocpmodels/datasets/lmdb_dataset.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import bisect
import logging
import math
import pickle
import random
import warnings
from pathlib import Path
from typing import Optional, Typ... | 9,163 | 35.07874 | 85 | py |
ocp | ocp-main/ocpmodels/datasets/ase_datasets.py | import bisect
import copy
import functools
import glob
import logging
import os
import warnings
from pathlib import Path
from abc import ABC, abstractmethod
from typing import List
import ase
import numpy as np
from torch import tensor
from torch.utils.data import Dataset
from tqdm import tqdm
from ocpmodels.common.r... | 18,646 | 36.145418 | 114 | py |
ocp | ocp-main/ocpmodels/datasets/target_metadata_guesser.py | import logging
import numpy as np
def uniform_atoms_lengths(atoms_lens) -> bool:
# If all of the structures have the same number of atoms, it's really hard to know
# whether the entries are intensive or extensive, and whether
# some of the entries are per-atom or not
return len(set(atoms_lens)) == 1
... | 7,441 | 36.585859 | 226 | py |
ocp | ocp-main/ocpmodels/datasets/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from .lmdb_dataset import (
LmdbDataset,
SinglePointLmdbDataset,
TrajectoryLmdbDataset,
data_list_collater,
)
from .oc22_lmdb_... | 454 | 22.947368 | 65 | py |
ocp | ocp-main/ocpmodels/datasets/embeddings/continuous_embeddings.py | """
CGCNN-like embeddings using continuous values instead of original k-hot.
Properties:
Group number
Period number
Electronegativity
Covalent radius
Valence electrons
First ionization energy
Electron affinity
Block
Atomic Volume
NaN stored for unavaialable parameters.
"""
CONTINUO... | 19,481 | 16.394643 | 74 | py |
ocp | ocp-main/ocpmodels/datasets/embeddings/khot_embeddings.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
Original CGCNN k-hot elemental embeddings.
"""
KHOT_EMBEDDINGS = {
1: [
0,
1,
0,
0,
0,
0,
... | 103,138 | 9.957081 | 63 | py |
ocp | ocp-main/ocpmodels/datasets/embeddings/qmof_khot_embeddings.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
k-hot elemental embeddings from QMOF, motivated by the following Github Issue threads:
https://github.com/txie-93/cgcnn/issues/2
https://github.... | 83,702 | 9.960194 | 86 | py |
ocp | ocp-main/ocpmodels/datasets/embeddings/__init__.py | __all__ = [
"ATOMIC_RADII",
"KHOT_EMBEDDINGS",
"CONTINUOUS_EMBEDDINGS",
"QMOF_KHOT_EMBEDDINGS",
]
from .atomic_radii import ATOMIC_RADII
from .continuous_embeddings import CONTINUOUS_EMBEDDINGS
from .khot_embeddings import KHOT_EMBEDDINGS
from .qmof_khot_embeddings import QMOF_KHOT_EMBEDDINGS
| 311 | 25 | 56 | py |
ocp | ocp-main/ocpmodels/datasets/embeddings/atomic_radii.py | """
Atomic radii in picometers
NaN stored for unavailable parameters.
"""
ATOMIC_RADII = {
0: float("NaN"),
1: 25.0,
2: 120.0,
3: 145.0,
4: 105.0,
5: 85.0,
6: 70.0,
7: 65.0,
8: 60.0,
9: 50.0,
10: 160.0,
11: 180.0,
12: 150.0,
13: 125.0,
14: 110.0,
15: 100.... | 1,670 | 14.330275 | 38 | py |
ocp | ocp-main/ocpmodels/tasks/task.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import logging
import os
from ocpmodels.common.registry import registry
from ocpmodels.trainers.forces_trainer import ForcesTrainer
class ... | 3,181 | 31.141414 | 135 | py |
ocp | ocp-main/ocpmodels/tasks/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
__all__ = ["TrainTask", "PredictTask", "ValidateTask", "RelxationTask"]
from .task import PredictTask, RelxationTask, TrainTask, ValidateTask... | 321 | 34.777778 | 71 | py |
ocp | ocp-main/ocpmodels/preprocessing/atoms_to_graphs.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import Optional
import ase.db.sqlite
import ase.io.trajectory
import numpy as np
import torch
from torch_geometric.data import D... | 10,360 | 40.115079 | 119 | py |
ocp | ocp-main/ocpmodels/preprocessing/__init__.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from .atoms_to_graphs import AtomsToGraphs
| 222 | 23.777778 | 63 | py |
ocp | ocp-main/ocpmodels/trainers/base_trainer.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import datetime
import errno
import logging
import os
import random
import subprocess
from abc import ABC, abstractmethod
from collections imp... | 29,997 | 36.264596 | 111 | py |
ocp | ocp-main/ocpmodels/trainers/energy_trainer.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import logging
from typing import Optional
import torch
import torch_geometric
from tqdm import tqdm
from ocpmodels.common import distutils... | 11,855 | 33.768328 | 129 | py |
ocp | ocp-main/ocpmodels/trainers/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
__all__ = [
"BaseTrainer",
"ForcesTrainer",
"EnergyTrainer",
]
from .base_trainer import BaseTrainer
from .energy_trainer import ... | 376 | 24.133333 | 65 | py |
ocp | ocp-main/ocpmodels/trainers/forces_trainer.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import logging
import os
import pathlib
from collections import defaultdict
from pathlib import Path
from typing import Optional
import nump... | 31,922 | 37.554348 | 127 | py |
msvi | msvi-main/setup.py | import setuptools
setuptools.setup(
name="msvi",
version="0.0.1",
author="Valerii Iakovlev",
author_email="valerii.iakovlev@aalto.fi",
url="https://github.com/yakovlev31/msvi",
packages=setuptools.find_packages(),
python_requires=">=3.9",
)
| 270 | 21.583333 | 45 | py |
msvi | msvi-main/experiments/rmnist/val.py | from types import SimpleNamespace
import torch
import wandb
from tqdm import tqdm
from einops import reduce
import msvi.utils.rmnist as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = SimpleNamespace(**vars(argpa... | 1,789 | 25.323529 | 121 | py |
msvi | msvi-main/experiments/rmnist/test.py | from types import SimpleNamespace
import torch
import wandb
from tqdm import tqdm
from einops import reduce
import msvi.utils.rmnist as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = SimpleNamespace(**vars(argpa... | 1,815 | 25.705882 | 121 | py |
msvi | msvi-main/experiments/rmnist/utils.py | import os
from collections import deque
import numpy as np
import torch
import msvi.posterior
from einops import rearrange
ndarray = np.ndarray
Tensor = torch.Tensor
def set_seed(seed):
np.random.seed(seed)
torch.manual_seed(seed)
def save_model(model, path, name):
if not os.path.isdir(path):
... | 4,823 | 30.122581 | 121 | py |
msvi | msvi-main/experiments/rmnist/train.py | from types import SimpleNamespace
import torch
import torch.nn as nn
import torch.optim as optim
import wandb
from tqdm import tqdm
import msvi.utils.rmnist as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = Simpl... | 3,556 | 29.663793 | 107 | py |
msvi | msvi-main/experiments/tests/lv_vms.py | from types import SimpleNamespace
import torch.optim as optim
from tqdm import tqdm
import utils
param = {
"T": 50, # terminal time
"M": 250, # number of observations in [0, T]
"sigY": 0.001, # observation noise
"seed": 1400, # random seed
"max_len": 201, # truncation length for the traje... | 1,390 | 27.979167 | 85 | py |
msvi | msvi-main/experiments/tests/lv_avms.py | from types import SimpleNamespace
import torch.optim as optim
from tqdm import tqdm
import utils
param = {
"T": 50, # terminal time
"M": 250, # number of observations in [0, T]
"sigY": 0.001, # observation noise
"max_len": 201, # truncation length for the trajectories
"seed": 1400, # rand... | 1,733 | 25.676923 | 85 | py |
msvi | msvi-main/experiments/tests/lv_vss.py | from types import SimpleNamespace
import torch.optim as optim
from tqdm import tqdm
import utils
param = {
"T": 50, # terminal time
"M": 250, # number of observations in [0, T]
"sigY": 0.001, # observation noise
"seed": 1400, # random seed
"max_len": 10, # truncation length for the trajec... | 1,388 | 27.9375 | 85 | py |
msvi | msvi-main/experiments/tests/utils.py | import numpy as np
import scipy.integrate
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
from torch.utils.data import DataLoader
from einops import rearrange
from einops.layers.torch import Rearrange
import msvi.decoder
import msvi.trans_func
import msvi.rec_net
import msvi.model
import... | 7,855 | 31.733333 | 126 | py |
msvi | msvi-main/experiments/pendulum/val.py | from types import SimpleNamespace
import torch
import wandb
from tqdm import tqdm
from einops import reduce
import msvi.utils.pendulum as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = SimpleNamespace(**vars(arg... | 1,791 | 25.352941 | 121 | py |
msvi | msvi-main/experiments/pendulum/test.py | from types import SimpleNamespace
import torch
import wandb
from tqdm import tqdm
from einops import reduce
import msvi.utils.pendulum as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = SimpleNamespace(**vars(arg... | 1,817 | 25.735294 | 121 | py |
msvi | msvi-main/experiments/pendulum/utils.py | import os
from collections import deque
import numpy as np
import torch
import msvi.posterior
from einops import rearrange
ndarray = np.ndarray
Tensor = torch.Tensor
def set_seed(seed):
np.random.seed(seed)
torch.manual_seed(seed)
def save_model(model, path, name):
if not os.path.isdir(path):
... | 4,823 | 30.122581 | 121 | py |
msvi | msvi-main/experiments/pendulum/train.py | from types import SimpleNamespace
import torch
import torch.nn as nn
import torch.optim as optim
import wandb
from tqdm import tqdm
import msvi.utils.pendulum as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = Sim... | 3,558 | 29.681034 | 107 | py |
msvi | msvi-main/experiments/bballs/val.py | from types import SimpleNamespace
import torch
import wandb
from tqdm import tqdm
from einops import reduce
import msvi.utils.bballs as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = SimpleNamespace(**vars(argpa... | 1,789 | 25.323529 | 121 | py |
msvi | msvi-main/experiments/bballs/test.py | from types import SimpleNamespace
import torch
import wandb
from tqdm import tqdm
from einops import reduce
import msvi.utils.bballs as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = SimpleNamespace(**vars(argpa... | 1,815 | 25.705882 | 121 | py |
msvi | msvi-main/experiments/bballs/utils.py | import os
from collections import deque
import numpy as np
import torch
import msvi.posterior
from einops import rearrange
ndarray = np.ndarray
Tensor = torch.Tensor
def set_seed(seed):
np.random.seed(seed)
torch.manual_seed(seed)
def save_model(model, path, name):
if not os.path.isdir(path):
... | 4,823 | 30.122581 | 121 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.