keyword stringclasses 7
values | repo_name stringlengths 8 98 | file_path stringlengths 4 244 | file_extension stringclasses 29
values | file_size int64 0 84.1M | line_count int64 0 1.6M | content stringlengths 1 84.1M ⌀ | language stringclasses 14
values |
|---|---|---|---|---|---|---|---|
2D | janberges/elphmod | examples/bare/run.sh | .sh | 583 | 25 | #!/bin/bash
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
eval `elphmodenv`
echo 'Using Hartwigsen-Goedecker-Hutter pseudopotentials'
echo '[1] Hartwigsen et al., Phys. Rev. B 58, 3641 (1998)'
echo '[2] Goedecker et al., Phys. Rev. B 54, 1703 ... | Shell |
2D | janberges/elphmod | examples/projwfc/projwfc.py | .py | 1,349 | 52 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import elphmod
import matplotlib.pyplot as plt
colors = ['red', 'blue', 'black']
labels = ['$s$', '$p_{x, y}$', '$p_z$']
x, k, eps, proj = elphmod.el.read_atomic_projections... | Python |
2D | janberges/elphmod | examples/projwfc/run.sh | .sh | 798 | 29 | #!/bin/bash
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
eval `elphmodenv`
echo 'Using normconserving pseudopotentials from PseudoDojo'
echo '[1] van Setten et al., Comput. Phys. Commun. 226, 39 (2018)'
echo '[2] Hamann, Phys. Rev. B 88, 0851... | Shell |
2D | janberges/elphmod | examples/phrenorm/run.sh | .sh | 933 | 42 | #!/bin/bash
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
eval `elphmodenv`
echo 'Using Hartwigsen-Goedecker-Hutter pseudopotentials'
echo '[1] Hartwigsen et al., Phys. Rev. B 58, 3641 (1998)'
echo '[2] Goedecker et al., Phys. Rev. B 54, 1703 ... | Shell |
2D | janberges/elphmod | examples/phrenorm/decay.py | .py | 690 | 26 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
# Based on code by Arne Schobert.
import elphmod
import matplotlib.pyplot as plt
pwi = elphmod.bravais.read_pwi('scf.in')
R1, H1 = elphmod.el.read_decayH('decay.H')
R2, H2 ... | Python |
2D | janberges/elphmod | examples/phrenorm/phrenorm.py | .py | 2,914 | 118 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import copy
import elphmod
import matplotlib.pyplot as plt
import numpy as np
comm = elphmod.MPI.comm
info = elphmod.MPI.info
PW = elphmod.bravais.read_pwi('scf.in')
PH = el... | Python |
2D | janberges/elphmod | examples/phrenorm/defpot.py | .py | 971 | 37 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import elphmod
import matplotlib.pyplot as plt
import numpy as np
nu = 8 # ionic displacement
a = 0 # electronic orbital
el = elphmod.el.Model('TaS2')
ph = elphmod.ph.Model(... | Python |
2D | janberges/elphmod | examples/quadrupole/quadrupole.py | .py | 4,282 | 183 | #!/usr/bin/env python3
import elphmod
import matplotlib.pyplot as plt
import numpy as np
import scipy.optimize
comm = elphmod.MPI.comm
info = elphmod.MPI.info
info('Load tight-binding, mass-spring, and coupling models')
el = elphmod.el.Model('TaS2')
ph = elphmod.ph.Model('dyn', lr=False)
elph = elphmod.elph.Model('... | Python |
2D | janberges/elphmod | examples/quadrupole/run.sh | .sh | 803 | 33 | #!/bin/bash
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
eval `elphmodenv`
echo 'Using normconserving pseudopotentials from PseudoDojo'
echo '[1] van Setten et al., Comput. Phys. Commun. 226, 39 (2018)'
echo '[2] Hamann, Phys. Rev. B 88, 0851... | Shell |
2D | janberges/elphmod | examples/fluctuations/run.sh | .sh | 732 | 31 | #!/bin/bash
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
eval `elphmodenv`
echo 'Using Hartwigsen-Goedecker-Hutter pseudopotentials'
echo '[1] Hartwigsen et al., Phys. Rev. B 58, 3641 (1998)'
echo '[2] Goedecker et al., Phys. Rev. B 54, 1703 ... | Shell |
2D | janberges/elphmod | examples/fluctuations/fluctuations.py | .py | 2,363 | 76 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import elphmod
import matplotlib.pyplot as plt
import numpy as np
comm = elphmod.MPI.comm
info = elphmod.MPI.info
q = np.array([[0.0, 2 * np.pi / 3]])
nk = 48
kT = 0.005
B... | Python |
2D | janberges/elphmod | examples/goldstone/run.sh | .sh | 730 | 26 | #!/bin/bash
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
eval `elphmodenv`
echo 'Using normconserving pseudopotentials from PseudoDojo'
echo '[1] van Setten et al., Comput. Phys. Commun. 226, 39 (2018)'
echo '[2] Hamann, Phys. Rev. B 88, 0851... | Shell |
2D | janberges/elphmod | examples/goldstone/goldstone.py | .py | 2,257 | 85 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import elphmod
import matplotlib.patches as pts
import matplotlib.pyplot as plt
import numpy as np
colors = ['dodgerblue', 'orange']
labels = ['$x, y$', '$z$']
e = elphmod.e... | Python |
2D | janberges/elphmod | examples/projwfc_3d/projwfc_3d.py | .py | 1,091 | 42 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import elphmod
import matplotlib.pyplot as plt
colors = ['red', 'blue', 'green', 'gray']
labels = ['$s$', '$p$', '$d$', 'other']
x, k, eps, proj = elphmod.el.read_atomic_pro... | Python |
2D | janberges/elphmod | examples/projwfc_3d/run.sh | .sh | 632 | 23 | #!/bin/bash
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
eval `elphmodenv`
echo 'Using normconserving pseudopotentials from PseudoDojo'
echo '[1] van Setten et al., Comput. Phys. Commun. 226, 39 (2018)'
echo '[2] Hamann, Phys. Rev. B 88, 0851... | Shell |
2D | janberges/elphmod | examples/ph_vs_epw/run.sh | .sh | 686 | 30 | #!/bin/bash
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
eval `elphmodenv`
echo 'Using Hartwigsen-Goedecker-Hutter pseudopotentials'
echo '[1] Hartwigsen et al., Phys. Rev. B 58, 3641 (1998)'
echo '[2] Goedecker et al., Phys. Rev. B 54, 1703 ... | Shell |
2D | janberges/elphmod | examples/ph_vs_epw/ph_vs_epw.py | .py | 1,691 | 57 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import elphmod
import numpy as np
info = elphmod.MPI.info
pwi = elphmod.bravais.read_pwi('pw.in')
nk = np.array(pwi['k_points'][:3])
a = elphmod.bravais.primitives(**pwi)
... | Python |
2D | janberges/elphmod | examples/modes/modes_modules.py | .py | 3,589 | 118 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
"""
Created on Sun Mar 14 15:15:43 2021
@author: arne
"""
import numpy as np
import matplotlib.pyplot as plt
# Note: returns angle in degree
def theta(v, w):
return np.... | Python |
2D | janberges/elphmod | examples/modes/run.sh | .sh | 158 | 7 | #!/bin/bash
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
mpirun python3 modes.py
| Shell |
2D | janberges/elphmod | examples/modes/modes.py | .py | 7,098 | 237 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
"""
Created on Sun Mar 14 15:15:43 2021
@author: arne
"""
import elphmod
import re
import numpy as np
import sys
from modes_modules import (supercell_vectors, permutation_fi... | Python |
2D | janberges/elphmod | examples/lr/lr.py | .py | 2,950 | 100 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import elphmod
import matplotlib.pyplot as plt
import numpy as np
import sys
comm = elphmod.MPI.comm
path = 'KGM'
q, x, corners = elphmod.bravais.path(path, ibrav=4, N=50, m... | Python |
2D | janberges/elphmod | examples/lr/run.sh | .sh | 1,110 | 48 | #!/bin/bash
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
eval `elphmodenv`
echo 'Using normconserving pseudopotentials from PseudoDojo'
echo '[1] van Setten et al., Comput. Phys. Commun. 226, 39 (2018)'
echo '[2] Hamann, Phys. Rev. B 88, 0851... | Shell |
2D | janberges/elphmod | examples/phrenorm_3d/phrenorm_3d.py | .py | 2,661 | 109 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import copy
import elphmod
import matplotlib.pyplot as plt
import numpy as np
comm = elphmod.MPI.comm
info = elphmod.MPI.info
PW = elphmod.bravais.read_pwi('scf.in')
PH = el... | Python |
2D | janberges/elphmod | examples/phrenorm_3d/run.sh | .sh | 1,017 | 41 | #!/bin/bash
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
eval `elphmodenv`
echo 'Using normconserving pseudopotentials from PseudoDojo'
echo '[1] van Setten et al., Comput. Phys. Commun. 226, 39 (2018)'
echo '[2] Hamann, Phys. Rev. B 88, 0851... | Shell |
2D | janberges/elphmod | examples/phrenorm_graphene/phrenorm_graphene.py | .py | 2,521 | 106 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import copy
import elphmod
import matplotlib.pyplot as plt
import numpy as np
comm = elphmod.MPI.comm
info = elphmod.MPI.info
PW = elphmod.bravais.read_pwi('scf.in')
PH = el... | Python |
2D | janberges/elphmod | examples/phrenorm_graphene/run.sh | .sh | 1,022 | 41 | #!/bin/bash
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
eval `elphmodenv`
echo 'Using normconserving pseudopotentials from PseudoDojo'
echo '[1] van Setten et al., Comput. Phys. Commun. 226, 39 (2018)'
echo '[2] Hamann, Phys. Rev. B 88, 0851... | Shell |
2D | janberges/elphmod | examples/projwfc_1d/projwfc_1d.py | .py | 1,369 | 53 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import elphmod
import matplotlib.pyplot as plt
colors = ['red', 'blue', 'black', 'gray']
labels = ['$s$', '$p_{x, y}$', '$p_z$', 'other']
x, k, eps, proj = elphmod.el.read_a... | Python |
2D | janberges/elphmod | examples/projwfc_1d/run.sh | .sh | 786 | 28 | #!/bin/bash
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
eval `elphmodenv`
echo 'Using normconserving pseudopotentials from PseudoDojo'
echo '[1] van Setten et al., Comput. Phys. Commun. 226, 39 (2018)'
echo '[2] Hamann, Phys. Rev. B 88, 0851... | Shell |
2D | janberges/elphmod | examples/md/run.sh | .sh | 189 | 9 | #!/bin/bash
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
cp `which i-pi-driver-py` ipi_driver.py
python3 md.py
| Shell |
2D | janberges/elphmod | examples/md/md.py | .py | 933 | 37 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import elphmod.models.tas2
import subprocess
import time
try:
import ipi_driver
except ModuleNotFoundError:
import ipi._driver.driver as ipi_driver
el, ph, elph = el... | Python |
2D | janberges/elphmod | tests/test_misc.py | .py | 490 | 18 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import elphmod
import unittest
class TestMisc(unittest.TestCase):
def test_split(self):
"""Test factorizing expression with separators and brackets."""
s... | Python |
2D | janberges/elphmod | tests/test_models.py | .py | 1,501 | 53 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import elphmod.models.chain
import elphmod.models.graphene
import elphmod.models.tas2
import numpy as np
import unittest
elphmod.misc.verbosity = 0
class TestModels(unittest... | Python |
2D | janberges/elphmod | tests/test_el.py | .py | 2,086 | 65 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import copy
import elphmod.models.graphene
import numpy as np
import unittest
elphmod.misc.verbosity = 0
class TestElectron(unittest.TestCase):
def test_electron_cell_tr... | Python |
2D | janberges/elphmod | tests/test_ph.py | .py | 3,493 | 109 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import copy
import elphmod.models.graphene
import numpy as np
import unittest
elphmod.misc.verbosity = 0
class TestPhonon(unittest.TestCase):
def test_phonon_cell_transf... | Python |
2D | janberges/elphmod | tests/test_diagrams.py | .py | 5,501 | 161 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import elphmod.models.tas2
import numpy as np
import unittest
elphmod.misc.verbosity = 0
tol = dict(rtol=1e-2, atol=0.0)
class TestDiagrams(unittest.TestCase):
def _tes... | Python |
2D | janberges/elphmod | tests/test_dispersion.py | .py | 980 | 33 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import elphmod.models.graphene
import numpy as np
import unittest
elphmod.misc.verbosity = 0
class TestDispersion(unittest.TestCase):
def test_dispersion_full(self, nk=1... | Python |
2D | janberges/elphmod | tests/run_py_versions_conda.sh | .sh | 486 | 25 | #!/bin/bash
# conda install conda-build
# source run_py_versions_conda.sh
env=/dev/shm/env
log=run_py_versions_conda.log
echo "Tests for different Python versions" > $log
for minor in `seq 5 14`
do
conda create -y -p $env python=3.$minor
conda activate $env
conda install -y numpy scipy
conda develo... | Shell |
2D | janberges/elphmod | tests/test_md.py | .py | 1,993 | 63 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import elphmod.models.graphene
import elphmod.models.tas2
import numpy as np
import unittest
elphmod.misc.verbosity = 0
class TestMD(unittest.TestCase):
def test_dense_v... | Python |
2D | janberges/elphmod | tests/test_elph.py | .py | 977 | 34 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import copy
import elphmod.models.graphene
import numpy as np
import unittest
elphmod.misc.verbosity = 0
class TestElectronPhonon(unittest.TestCase):
def test_q2r(self):... | Python |
2D | janberges/elphmod | tests/test_occupations.py | .py | 2,021 | 59 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
from elphmod import occupations
import numpy as np
import unittest
tol = dict(rtol=1e-5, atol=1e-4)
class TestOccupations(unittest.TestCase):
def _test_derivatives(self,... | Python |
2D | janberges/elphmod | tests/run.sh | .sh | 125 | 10 | #!/bin/bash
set -e
echo "Serial tests"
python3 -m unittest -vfc
echo "Parallel tests"
mpirun -n 2 python3 -m unittest -fc
| Shell |
2D | janberges/elphmod | tests/test_bravais.py | .py | 2,398 | 73 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import elphmod
import numpy as np
import unittest
class TestBravais(unittest.TestCase):
def _test_wigner_2d(self, angle=120, nk=12):
"""Verify that 2D and general... | Python |
2D | janberges/elphmod | tests/test_elel.py | .py | 762 | 30 | #!/usr/bin/env python3
# Copyright (C) 2017-2026 elphmod Developers
# This program is free software under the terms of the GNU GPLv3 or later.
import copy
import elphmod.models.graphene
import numpy as np
import unittest
elphmod.misc.verbosity = 0
class TestElectronElectron(unittest.TestCase):
def test_q2r(self... | Python |
3D | antecede/EZSpecificity | main_specificity_ss.py | .py | 4,062 | 128 | import sys
root_dir = "/projects/bbto/suyufeng/enzyme_specificity_public"
log_root_dir = "/scratch/bbto/suyufeng/data/logs"
sys.path.append(f"{root_dir}/src")
from pytorch_lightning.callbacks.early_stopping import EarlyStopping
import pytorch_lightning as pl
from Datasets.brenda import Singledataset
import torch, sh... | Python |
3D | antecede/EZSpecificity | example.ipynb | .ipynb | 26,341 | 667 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Prepared Data\n",
"\n",
"The data directory should contain four files / directory:\n",
"1. substrates files: \"substrates.csv\". It must contains the column \"Substrate_SMILES\" which are the smile strings for substrate v... | Unknown |
3D | antecede/EZSpecificity | main_specificity_ss_eval.py | .py | 3,059 | 103 | import sys
root_dir = "/projects/bbto/suyufeng/enzyme_specificity_public"
sys.path.append(f"{root_dir}/src")
import pytorch_lightning as pl
from Datasets.brenda import Singledataset
import torch, sys, glob
import torch.multiprocessing
from rdkit import RDLogger
import warnings
from sklearn import metrics
import numpy... | Python |
3D | antecede/EZSpecificity | utils.py | .py | 1,337 | 41 | import os
import time
from easydict import EasyDict
import yaml
from logging import Logger
import logging
def get_logger(name, log_dir=None):
logger = logging.getLogger(name)
logger.setLevel(logging.DEBUG)
formatter = logging.Formatter('[%(asctime)s::%(name)s::%(levelname)s] %(message)s')
stream_handl... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/main.py | .py | 1,865 | 56 | import random
import numpy as np
import torch
from rdkit import RDLogger
from grover.util.parsing import parse_args, get_newest_train_args
from grover.util.utils import create_logger
from task.cross_validate import cross_validate
from task.fingerprint import generate_fingerprints
from task.predict import make_predict... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/task/run_evaluation.py | .py | 5,581 | 158 | """
The evaluation function.
"""
from argparse import Namespace
from logging import Logger
from typing import List
import numpy as np
import torch
import torch.utils.data.distributed
from grover.data.scaler import StandardScaler
from grover.util.utils import get_class_sizes, get_data, split_data, get_task_names, get_... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/task/train.py | .py | 16,779 | 439 | """
The training function used in the finetuning task.
"""
import csv
import logging
import os
import pickle
import time
from argparse import Namespace
from logging import Logger
from typing import List
import numpy as np
import pandas as pd
import torch
from torch.optim.lr_scheduler import ExponentialLR
from torch.ut... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/task/fingerprint.py | .py | 3,113 | 100 | """
The fingerprint generation function.
"""
from argparse import Namespace
from logging import Logger
from typing import List
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from grover.data import MolCollator
from grover.data import MoleculeDataset
from grover.util.utils import get_data, ... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/task/pretrain.py | .py | 9,571 | 242 | """
The GROVER pretrain function.
"""
import os
import time
from argparse import Namespace
from logging import Logger
import torch
from torch.utils.data import DataLoader
from grover.data.dist_sampler import DistributedSampler
from grover.data.groverdataset import get_data, split_data, GroverCollator, BatchMolDataset... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/task/grovertrainer.py | .py | 11,317 | 280 | """
The GROVER trainer.
"""
import os
import time
from logging import Logger
from typing import List, Tuple
from collections.abc import Callable
import torch
from torch.nn import Module
from torch.utils.data import DataLoader
from grover.model.models import GroverTask
from grover.util.multi_gpu_wrapper import MultiGpu... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/task/predict.py | .py | 10,630 | 317 | """
The predict function using the finetuned model to make the prediction. .
"""
from argparse import Namespace
from typing import List
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from grover.data import MolCollator
from grover.data import Molecule... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/task/__init__.py | .py | 0 | 0 | null | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/task/cross_validate.py | .py | 2,514 | 70 | """
The cross validation function for finetuning.
This implementation is adapted from
https://github.com/chemprop/chemprop/blob/master/chemprop/train/cross_validate.py
"""
import os
import time
from argparse import Namespace
from logging import Logger
from typing import Tuple
import numpy as np
from grover.util.utils... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/scripts/build_vocab.py | .py | 1,704 | 44 | """
The vocabulary building scripts.
"""
import os
import sys
sys.path.append(f"/work/yufeng/2022/enzyme_specificity/src/other_softwares/grover_software")
from grover.data.torchvocab import MolVocab
def build():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--data_path', default... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/scripts/save_features.py | .py | 4,808 | 128 | """
Computes and saves molecular features for a dataset.
"""
import os
import shutil
import sys
from argparse import ArgumentParser, Namespace
from multiprocessing import Pool
from typing import List, Tuple
from tqdm import tqdm
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
from grove... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/scripts/__init__.py | .py | 0 | 0 | null | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/scripts/split_data.py | .py | 2,606 | 88 | """
The data splitting script for pretraining.
"""
import os
from argparse import ArgumentParser
import csv
import shutil
import numpy as np
import grover.util.utils as fea_utils
parser = ArgumentParser()
parser.add_argument("--data_path", default="../drug_data/grover_data/delaneyfreesolvlipo.csv")
parser.add_argum... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/model/models.py | .py | 22,143 | 509 | """
The GROVER models for pretraining, finetuning and fingerprint generating.
"""
from argparse import Namespace
from typing import List, Dict, Callable
import numpy as np
import torch
from torch import nn as nn
from grover.data import get_atom_fdim, get_bond_fdim
from grover.model.layers import Readout, GTransEncode... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/model/layers.py | .py | 39,294 | 904 | """
The basic building blocks in model.
"""
import math
from argparse import Namespace
from typing import Union
import numpy
import scipy.stats as stats
import torch
from torch import nn as nn
from torch.nn import LayerNorm, functional as F
from grover.util.nn_utils import get_activation_function, select_neighbor_and... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/util/metrics.py | .py | 4,207 | 123 | """
The evaluation metrics.
"""
import math
from typing import List, Callable, Union
from sklearn.metrics import accuracy_score, mean_squared_error, roc_auc_score, mean_absolute_error, r2_score, \
precision_recall_curve, auc, recall_score, confusion_matrix
def accuracy(targets: List[int], preds: List[float], thr... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/util/multi_gpu_wrapper.py | .py | 3,059 | 111 | """
Wrapper for multi-GPU training.
"""
# use Hovorod for multi-GPU pytorch training
try:
import horovod.torch as mgw
import torch
print('using Horovod for multi-GPU training')
except ImportError:
print('[WARNING] Horovod cannot be imported; multi-GPU training is unsupported')
pass
class MultiGpu... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/util/utils.py | .py | 28,757 | 795 | """
The general utility functions.
"""
import csv
import logging
import os
import pickle
import random
from argparse import Namespace
from collections import defaultdict
from logging import Logger
from typing import List, Set, Tuple, Union, Dict
import numpy as np
import torch
from rdkit import Chem
from rdkit.Chem.Sc... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/util/scheduler.py | .py | 4,499 | 98 | """
The learning rate scheduler.
This implementation is adapted from
https://github.com/chemprop/chemprop/blob/master/chemprop/nn_utils.py
"""
from typing import List, Union
import numpy as np
from torch.optim.lr_scheduler import _LRScheduler
class NoamLR(_LRScheduler):
"""
Noam learning rate scheduler with ... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/util/nn_utils.py | .py | 3,492 | 97 | """
The utility function for model construction.
This implementation is adapted from
https://github.com/chemprop/chemprop/blob/master/chemprop/nn_utils.py
"""
import torch
from torch import nn as nn
def param_count(model: nn.Module) -> int:
"""
Determines number of trainable parameters.
:param model: An n... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/util/parsing.py | .py | 23,328 | 488 | """
The parsing functions for the argument input.
"""
import os
import pickle
from argparse import ArgumentParser, Namespace
from tempfile import TemporaryDirectory
import torch
from grover.data.molfeaturegenerator import get_available_features_generators
from grover.util.utils import makedirs
def add_common_args(p... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/data/moldataset.py | .py | 8,625 | 246 | """
The molecule dataset for finetuning.
This implementation is adapted from
https://github.com/chemprop/chemprop/blob/master/chemprop/data/data.py
"""
import random
from argparse import Namespace
from typing import Callable, List, Union
import numpy as np
from rdkit import Chem
from torch.utils.data.dataset import Da... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/data/groverdataset.py | .py | 7,951 | 248 | """
The dataset used in training GROVER.
"""
import math
import os
import csv
from typing import Union, List
import numpy as np
import torch
from torch.utils.data.dataset import Dataset
from rdkit import Chem
import grover.util.utils as feautils
from grover.data import mol2graph
from grover.data.moldataset import Mole... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/data/dist_sampler.py | .py | 4,982 | 138 | """
The re-implemented distributed sampler for the distributed training of GROVER.
"""
import math
import time
import torch
from torch.utils.data.sampler import Sampler
import torch.distributed as dist
class DistributedSampler(Sampler):
"""Sampler that restricts data loading to a subset of the dataset.
It is... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/data/molgraph.py | .py | 15,938 | 388 | """
The data structure of Molecules.
This implementation is adapted from
https://github.com/chemprop/chemprop/blob/master/chemprop/features/featurization.py
"""
from argparse import Namespace
from typing import List, Tuple, Union
import numpy as np
import torch
from rdkit import Chem
# Atom feature sizes
MAX_ATOMIC_N... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/data/torchvocab.py | .py | 6,636 | 191 | """
The contextual property.
"""
import pickle
from collections import Counter
from multiprocessing import Pool
import tqdm
from rdkit import Chem
from grover.data.task_labels import atom_to_vocab
from grover.data.task_labels import bond_to_vocab
class TorchVocab(object):
"""
Defines the vocabulary for atom... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/data/__init__.py | .py | 427 | 8 | from grover.data.molfeaturegenerator import get_available_features_generators, get_features_generator
from grover.data.molgraph import BatchMolGraph, get_atom_fdim, get_bond_fdim, mol2graph
from grover.data.molgraph import MolGraph, BatchMolGraph, MolCollator
from grover.data.moldataset import MoleculeDataset, Molecule... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/data/task_labels.py | .py | 4,585 | 117 | """
The label generator for the pretraining.
"""
from collections import Counter
from typing import Callable, Union
import numpy as np
from rdkit import Chem
from descriptastorus.descriptors import rdDescriptors
from grover.data.molfeaturegenerator import register_features_generator
Molecule = Union[str, Chem.Mol]
F... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/data/molfeaturegenerator.py | .py | 5,497 | 147 | """
The registered feature generator for molecules.
This implementation is adapted from
https://github.com/chemprop/chemprop/blob/master/chemprop/features/features_generators.py
"""
from typing import Callable, List, Union
import numpy as np
from rdkit import Chem, DataStructs
from rdkit.Chem import AllChem
Molecule... | Python |
3D | antecede/EZSpecificity | other_softwares/grover_software/grover/data/scaler.py | .py | 2,854 | 71 | """
The scaler for the regression task.
This implementation is adapted from
https://github.com/chemprop/chemprop/blob/master/chemprop/data/scaler.py
"""
from typing import Any, List
import numpy as np
class StandardScaler:
"""A StandardScaler normalizes a dataset.
When fit on a dataset, the StandardScaler le... | Python |
3D | antecede/EZSpecificity | Models/cpi.py | .py | 8,567 | 233 | import logging
import torch
import numpy as np
import torch.nn as nn
import pytorch_lightning as pl
class CPI(pl.LightningModule):
"""FFN."""
def __init__(
self,
config,
**kwargs,
):
"""__init__.
Args:
"""
super(CPI, self).__init__(**kwargs)
... | Python |
3D | antecede/EZSpecificity | Models/common.py | .py | 11,502 | 348 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.loss import _WeightedLoss
from torch_scatter import scatter_mean, scatter_add
from math import pi as PI
def split_tensor_by_batch(x, batch, num_graphs=None):
"""
Args:
x: (N, ...)
batch: ... | Python |
3D | antecede/EZSpecificity | Models/ss.py | .py | 13,221 | 284 | import torch
import torch.nn as nn
import numpy as np
import pytorch_lightning as pl
from collections import defaultdict
from Models.Structure.structure import Graph
from Models.common import MLP
NONLINEARITIES = {
"tanh": nn.Tanh(),
"relu": nn.ReLU(),
"softplus": nn.Softplus(),
"elu": nn.ELU()
}
cla... | Python |
3D | antecede/EZSpecificity | Models/utils.py | .py | 1,239 | 53 | import sys
root_dir = "/work/yufeng/2022/enzyme_specificity"
sys.path.append(f"{root_dir}/src")
def load_model(config):
from Models.dlkcat import DLKcat
from Models.cpi import CPI
from Models.ss import SS
if config.model.name == 'DLKcat':
return DLKcat(config)
elif config.model.name == '... | Python |
3D | antecede/EZSpecificity | Models/Structure/gnn.py | .py | 1,616 | 44 | from torch_geometric.nn import GATConv
from torch_geometric.nn.conv import PDNConv
import torch_geometric.nn as gnn
import torch.nn as nn
from Models.common import NONLINEARITIES
class GNN(nn.Module):
def __init__(self, config, edge_dim):
super().__init__()
self.convs = nn.ModuleList()
... | Python |
3D | antecede/EZSpecificity | Models/Structure/__init__.py | .py | 44 | 1 | from Models.Structure.structure import Graph | Python |
3D | antecede/EZSpecificity | Models/Structure/structure.py | .py | 3,332 | 84 | import pytorch_lightning as pl
import torch
import torch.nn as nn
from torch_scatter import scatter
from Models.Structure.gnn import GNN
from Models.Structure.egnn import EGNN
import Datasets.Structure.transforms as trans
def get_encoder(config, edge_dim):
if config.name == 'gnn':
net = GNN(
c... | Python |
3D | antecede/EZSpecificity | Models/Structure/egnn.py | .py | 2,858 | 85 | from torch import nn
import torch
from torch_scatter import scatter_sum, scatter_mean
from Models.common import MLP
class EnBaseLayer(nn.Module):
def __init__(self, hidden_dim, edge_feat_dim, act_fn='relu', norm='None', attention=False, residual=True):
super().__init__()
self.hidden_dim = hidden_d... | Python |
3D | antecede/EZSpecificity | Datasets/data_representer.py | .py | 16,075 | 431 | import lmdb
import pickle
from torch_geometric.data import Data
import torch.utils.data as data
import os
import torch
import numpy as np
from Datasets.utils import preprocess_enzyme_feature, preprocess_reaction_feature, torchify_dict, load_tensor, load_pickle, get_paths, check_paths_exist
from Datasets.Structure imp... | Python |
3D | antecede/EZSpecificity | Datasets/preprocess_full_brenda.ipynb | .ipynb | 21,592 | 530 | {
"cells": [
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from tqdm import tqdm\n",
"import numpy as np\n",
"import sys\n",
"import re\n",
"import os\n",
"\n",
"root_dir = \"/work/yufeng/2022/enzyme_s... | Unknown |
3D | antecede/EZSpecificity | Datasets/create_dataset.py | .py | 2,671 | 74 | import random
import pandas as pd
from tqdm import tqdm
import time
root_dir = "/projects/bbto/suyufeng/enzyme_specificity"
def check(ecnumber_dict, enzyme1, enzyme2, digits):
ecnumber1s = ecnumber_dict[enzyme1].split('.')
ecnumber2s = ecnumber_dict[enzyme2].split('.')
for index, (ecnumber1, ecnumber2) in... | Python |
3D | antecede/EZSpecificity | Datasets/utils.py | .py | 13,610 | 383 | import numpy as np
import torch
from tqdm import tqdm
from torch_scatter import scatter
import rdkit
import random
from rdkit import Chem
from rdkit.Chem.rdchem import BondType, HybridizationType
import pandas as pd
import pickle, os
from Datasets.const import restype_3to1, restype_name_to_atom14_names, letter_to_num
... | Python |
3D | antecede/EZSpecificity | Datasets/create_original_brenda_dataset.ipynb | .ipynb | 13,935 | 425 | {
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from tqdm import tqdm\n",
"import numpy as np\n",
"import sys\n",
"root_dir = \"/projects/bbhh/suyufeng/enzyme_specificity\"\n",
"sys.path.append(f\... | Unknown |
3D | antecede/EZSpecificity | Datasets/preprocess.ipynb | .ipynb | 33,006 | 838 | {
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from tqdm import tqdm\n",
"import numpy as np\n",
"import sys\n",
"import re\n",
"import os\n",
"\n",
"root_dir = \"/projects/bbhh/suyufeng/enz... | Unknown |
3D | antecede/EZSpecificity | Datasets/const.py | .py | 4,856 | 161 | import numpy as np
global restype_3to1, restype_1to3, restype_name_to_atom14_names, restypes, res_angle_alt, n_res_chi, atom_type_masks, weights, letter_to_num, num_to_letter
letter_to_num = {'C': 4, 'D': 3, 'S': 15, 'Q': 5, 'K': 11, 'I': 9,
'P': 14, 'T': 16, 'F': 13, 'A': 0, 'G': 7, 'H': 8,
... | Python |
3D | antecede/EZSpecificity | Datasets/brenda.py | .py | 2,900 | 68 | import pytorch_lightning as pl
from torch_geometric.data import DataLoader
from torch_geometric.transforms import Compose
from rdkit import RDLogger
from Datasets.data_representer import get_representer
import Datasets.Structure.transforms as utils_trans
from Datasets.utils import read_datasets
RDLogger.DisableLog('r... | Python |
3D | antecede/EZSpecificity | Datasets/create_features.py | .py | 27,473 | 629 | import sys
data_root_dir = "/scratch/bbto/suyufeng/tmp/enzyme_specificity"
src_root_dir = "/projects/bbto/suyufeng/enzyme_specificity"
sys.path.append(f"{src_root_dir}/src")
import numpy as np
import torch
from tqdm import tqdm
from rdkit import Chem, RDLogger
import ray
import pandas as pd
import lmdb
import pickle
im... | Python |
3D | antecede/EZSpecificity | Datasets/Experiment/experimental_evaluate_preprocess.ipynb | .ipynb | 22,721 | 660 | {
"cells": [
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"\n",
"root_dir = \"/projects/bbhh/suyufeng/enzyme_specificity\""
]
},
{
"attachments": {},
"cell_type": "markdown",
"me... | Unknown |
3D | antecede/EZSpecificity | Datasets/CPI/cpi.py | .py | 2,194 | 66 | import sys
import numpy as np
import torch
root_dir = "/work/yufeng/2022/enzyme_specificity"
sys.path.append(f"{root_dir}/src")
torch.multiprocessing.set_sharing_strategy('file_system')
import pandas as pd
import pytorch_lightning as pl
from torch_geometric.data import DataLoader
from rdkit import RDLogger
from Data... | Python |
3D | antecede/EZSpecificity | Datasets/Downloads/brenda_crawler.py | .py | 5,590 | 137 | from zeep import Client
import hashlib
import os
from tqdm import tqdm
import pandas as pd
class BrendaCrawler:
def __init__(self):
# if dataset is None:
# dataset = 'halogenase'
self.root_dir = "/projects/bbhh/suyufeng/enzyme_specificity"
# self.dataset = dataset
self.w... | Python |
3D | antecede/EZSpecificity | Datasets/Structure/protein_ligand.py | .py | 14,563 | 376 | import os
import numpy as np
from rdkit import Chem
from rdkit.Chem.rdchem import BondType, HybridizationType
from rdkit.Chem import ChemicalFeatures
from rdkit import RDConfig
import torch
import torch.nn.functional as F
from torch_scatter import scatter
ATOM_FAMILIES = ['Acceptor', 'Donor', 'Aromatic', 'Hydrophobe',... | Python |
3D | antecede/EZSpecificity | Datasets/Structure/__init__.py | .py | 106 | 2 | from Datasets.Structure.structure import StructureDataset
from Datasets.Structure.collator import collator | Python |
3D | antecede/EZSpecificity | Datasets/Structure/utils.py | .py | 1,934 | 62 | import copy
import torch
import numpy as np
from torch_geometric.data import Data, DataLoader, Batch
FOLLOW_BATCH = ['protein_element', 'ligand_context_element', 'pos_real', 'pos_fake']
class StructureComplexData(Data):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@static... | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.