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 copyright notice to every python script #245

Merged
merged 2 commits into from
Dec 18, 2023
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions benchmarks/inference.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

"""
Benchmark script for inference.
This script compiles a model using torch.compile and measures the time it takes to run a forward and backward pass for a certain molecule.
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/neighbors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import os
import torch
import numpy as np
Expand Down
4 changes: 4 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

# Configuration file for the Sphinx documentation builder.

# -- Project information
Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import subprocess
from setuptools import setup, find_packages
import torch
Expand Down
4 changes: 4 additions & 0 deletions tests/test_calculator.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import torch
from torch.testing import assert_allclose
import pytest
Expand Down
4 changes: 4 additions & 0 deletions tests/test_cfconv.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import pytest
from pytest import mark
import torch as pt
Expand Down
4 changes: 4 additions & 0 deletions tests/test_datamodule.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

from pytest import mark
import torch
from torchmdnet.data import DataModule
Expand Down
4 changes: 4 additions & 0 deletions tests/test_dataset_comp6.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import torch as pt
from tempfile import TemporaryDirectory
from torch_geometric.loader import DataLoader
Expand Down
4 changes: 4 additions & 0 deletions tests/test_datasets.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import pytest
from pytest import mark, raises
from os.path import join
Expand Down
4 changes: 4 additions & 0 deletions tests/test_equivariance.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import torch
from torchmdnet.models.model import create_model
from utils import load_example_args
Expand Down
4 changes: 4 additions & 0 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

from pytest import mark
import yaml
import glob
Expand Down
4 changes: 4 additions & 0 deletions tests/test_model.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import pytest
from pytest import mark
import pickle
Expand Down
4 changes: 4 additions & 0 deletions tests/test_model_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

from pytest import mark, raises
import torch
from torch.autograd import grad
Expand Down
4 changes: 4 additions & 0 deletions tests/test_module.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

from pytest import mark
from glob import glob
from os.path import dirname, join
Expand Down
4 changes: 4 additions & 0 deletions tests/test_neighbors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import os
import pytest
import torch
Expand Down
4 changes: 4 additions & 0 deletions tests/test_optimize.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import pytest
from pytest import mark
import torch as pt
Expand Down
4 changes: 4 additions & 0 deletions tests/test_prior_d2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

from torchmdnet.priors import D2
import torch as pt
from pytest import mark
Expand Down
4 changes: 4 additions & 0 deletions tests/test_priors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import pytest
from pytest import mark
import torch
Expand Down
4 changes: 4 additions & 0 deletions tests/test_rbfs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

from pytest import mark
import torch
from torchmdnet.models.utils import rbf_class_mapping
Expand Down
4 changes: 4 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

from os.path import join, exists
from pytest import mark, raises
import torch
Expand Down
4 changes: 4 additions & 0 deletions tests/test_wrappers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import pytest
from pytest import mark
from torchmdnet import models
Expand Down
4 changes: 4 additions & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import yaml
from os.path import dirname, join
import torch
Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/calculators.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import torch
from torchmdnet.models.model import load_model

Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/data.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

from os.path import join
from tqdm import tqdm
import torch
Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

from .ace import Ace
from .ani import ANI1, ANI1CCX, ANI1X
from .comp6 import ANIMD, DrugBank, GDB07to09, GDB10to13, Tripeptides, S66X8, COMP6v1
Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/datasets/ace.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import hashlib
import h5py
import numpy as np
Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/datasets/ani.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import h5py
import numpy as np
import os
Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/datasets/comp6.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import h5py
import numpy as np
import os
Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/datasets/custom.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import glob
import numpy as np
import torch
Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/datasets/hdf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import torch
from torch_geometric.data import Dataset, Data
import h5py
Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/datasets/md17.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import os
import os.path as osp
from typing import Callable, List, Optional
Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/datasets/md22.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import os
import os.path as osp
from typing import Callable, List, Optional
Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/datasets/qm9.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import torch
from torch_geometric.transforms import Compose
from torch_geometric.datasets import QM9 as QM9_geometric
Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/datasets/qm9q.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import h5py
import numpy as np
import os
Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/datasets/spice.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import hashlib
import h5py
import numpy as np
Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/extensions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

# Place here any short extensions to torch that you want to use in your code.
# The extensions present in extensions.cpp will be automatically compiled in setup.py and loaded here.
# The extensions will be available under torch.ops.torchmdnet_extensions, but you can add wrappers here to make them more convenient to use.
Expand Down
6 changes: 5 additions & 1 deletion torchmdnet/extensions/extensions.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/* Raul P. Pelaez 2023. Torch extensions to the torchmdnet library.
/*
* Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
* Distributed under the MIT License.
*(See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)
* Raul P. Pelaez 2023. Torch extensions to the torchmdnet library.
* You can expose functions to python here which will be compatible with TorchScript.
* Add your exports to the TORCH_LIBRARY macro below, see __init__.py to see how to access them from python.
* The WITH_CUDA macro will be defined when compiling with CUDA support.
Expand Down
5 changes: 4 additions & 1 deletion torchmdnet/extensions/neighbors/common.cuh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* Raul P. Pelaez 2023. Common utilities for the CUDA neighbor operation.
/* Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
* Distributed under the MIT License.
*(See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)
* Raul P. Pelaez 2023. Common utilities for the CUDA neighbor operation.
*/
#ifndef NEIGHBORS_COMMON_CUH
#define NEIGHBORS_COMMON_CUH
Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/extensions/neighbors/neighbors_cpu.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
* Distributed under the MIT License.
*(See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)
*/
#include <torch/extension.h>
#include <tuple>

Expand Down
7 changes: 5 additions & 2 deletions torchmdnet/extensions/neighbors/neighbors_cuda.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* Raul P. Pelaez 2023
Connection between the neighbor CUDA implementations and the torch extension.
/*
* Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
* Distributed under the MIT License.
* (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)
* Raul P. Pelaez 2023
*/
#include "neighbors_cuda_brute.cuh"
#include "neighbors_cuda_cell.cuh"
Expand Down
16 changes: 10 additions & 6 deletions torchmdnet/extensions/neighbors/neighbors_cuda_brute.cuh
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/* Raul P. Pelaez 2023. Brute force neighbor list construction in CUDA.

A brute force approach that assigns a thread per each possible pair of particles in the system.
Based on an implementation by Raimondas Galvelis.
Works fantastically for small (less than 10K atoms) systems, but cannot handle more than 32K
atoms.
/* Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
* Distributed under the MIT License.
*(See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)
*
* Raul P. Pelaez 2023. Brute force neighbor list construction in CUDA.
*
* A brute force approach that assigns a thread per each possible pair of particles in the system.
* Based on an implementation by Raimondas Galvelis.
* Works fantastically for small (less than 10K atoms) systems, but cannot handle more than 32K
* atoms.
*/
#ifndef NEIGHBORS_BRUTE_CUH
#define NEIGHBORS_BRUTE_CUH
Expand Down
6 changes: 4 additions & 2 deletions torchmdnet/extensions/neighbors/neighbors_cuda_cell.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* Raul P. Pelaez 2023. Batched cell list neighbor list implementation for CUDA.

/* Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
* Distributed under the MIT License.
*(See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)
* Raul P. Pelaez 2023. Batched cell list neighbor list implementation for CUDA.
*/
#ifndef NEIGHBOR_CUDA_CELL_H
#define NEIGHBOR_CUDA_CELL_H
Expand Down
13 changes: 8 additions & 5 deletions torchmdnet/extensions/neighbors/neighbors_cuda_shared.cuh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/* Raul P. Pelaez 2023. Shared memory neighbor list construction for CUDA.
This brute force approach checks all pairs of atoms by collaborativelly loading and processing
tiles of atoms into shared memory.
This approach is tipically slower than the brute force approach, but can handle an arbitrarily
large number of atoms.
/* Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
* Distributed under the MIT License.
*(See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)
* Raul P. Pelaez 2023. Shared memory neighbor list construction for CUDA.
* This brute force approach checks all pairs of atoms by collaborativelly loading and processing
* tiles of atoms into shared memory.
* This approach is tipically slower than the brute force approach, but can handle an arbitrarily
* large number of atoms.
*/
#ifndef NEIGHBORS_SHARED_CUH
#define NEIGHBORS_SHARED_CUH
Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

__all_models__ = ["graph-network", "transformer", "equivariant-transformer", "tensornet"]
4 changes: 4 additions & 0 deletions torchmdnet/models/model.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

import re
from typing import Optional, List, Tuple, Dict
import torch
Expand Down
4 changes: 4 additions & 0 deletions torchmdnet/models/output_modules.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)

from abc import abstractmethod, ABCMeta
from typing import Optional
import torch
Expand Down
Loading
Loading