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
romankempt/hetbuilder
tests/test.py
.py
1,138
42
import ase .io from ase.neighborlist import NeighborList from ase.geometry.analysis import Analysis import numpy as np from itertools import combinations_with_replacement def get_bond_lengths(atoms: "ase.atoms.AToms"): symbs = set(atoms.get_chemical_symbols()) pairs = list(combinations_with_replacement(symbs,...
Python
2D
romankempt/hetbuilder
tests/example.py
.py
610
22
import ase.io from pathlib import Path from hetbuilder import PROJECT_ROOT_DIR from hetbuilder.algorithm import CoincidenceAlgorithm from hetbuilder.plotting import InteractivePlot from hetbuilder.log import set_verbosity_level import numpy as np import time import os # # we set up the algorithm class # alg = Coinc...
Python
2D
romankempt/hetbuilder
tests/test_algorithm.py
.py
748
20
import ase.io from pathlib import Path from hetbuilder import PROJECT_ROOT_DIR from hetbuilder.algorithm import CoincidenceAlgorithm from hetbuilder.plotting import InteractivePlot import numpy as np def test_coincidence_algorithm(): bottom = ase.io.read(PROJECT_ROOT_DIR.joinpath("/tests/MoS2_2H_1l.xyz")) t...
Python
2D
DiamondLightSource/python-icebreaker
setup.py
.py
61
6
#!/usr/bin/env python from setuptools import setup setup()
Python
2D
DiamondLightSource/python-icebreaker
RELEASE.md
.md
805
25
## How to prepare a release To prepare an Icebreaker EM release you need to install the package [bump2version](https://pypi.org/project/bump2version/): ```bash pip install bump2version ``` and then, in the repository directory, run one of the following ```bash # assuming current version is 1.2.3 bumpversion patch ...
Markdown
2D
DiamondLightSource/python-icebreaker
src/icebreaker/show_gradient.py
.py
342
12
import numpy as np import matplotlib.pyplot as plt def show_gradient(image): xx, yy = np.mgrid[0 : image.shape[0], 0 : image.shape[1]] fig = plt.figure(figsize=(15, 15)) ax = fig.gca(projection="3d") ax.plot_surface(xx, yy, image, rstride=1, cstride=1, cmap=plt.cm.gray, linewidth=2) ax.view_init(8...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/filter_designer.py
.py
3,977
136
import cv2 import mrcfile import numpy as np def load_img(img_path): with mrcfile.open(img_path, "r+") as mrc: img = mrc.data # plt.imshow(img, cmap='gray') # plt.show() return img def lowpass(img, pixel_size, lowcut, edge_type, falloff, lowpass=True): mask_rad = int((pixel_s...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/listdir.py
.py
1,350
65
import sys import mrcfile import os x_patches = 40 y_patches = 40 num_of_segments = 16 cc = 0 def load_img(img_path): with mrcfile.open(img_path, "r", permissive=True) as mrc: img = mrc.data # plt.imshow(img, cmap='gray') # plt.show() return img outdir = "icegroups/" # define ...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/five_figures.py
.py
2,086
64
import sys from multiprocessing import Lock, Manager, Pool from pathlib import Path import mrcfile import numpy as np def single_mic_5fig(mic_name: str, r: int = 10000) -> str: with mrcfile.open(mic_name, "r", permissive=True) as mrc: img = mrc.data if not np.isnan(np.sum(img)): min =...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/ice_groups.py
.py
2,299
77
import collections import json import os import sys import gemmi import mrcfile import numpy as np from icebreaker import star_appender def splitall(path): allparts = [] while 1: parts = os.path.split(path) if parts[0] == path: # sentinel for absolute paths allparts.insert(0, pa...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/__init__.py
.py
0
0
null
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/KMeans_segmenter.py
.py
645
20
import cv2 import numpy as np def segmenter(img_to_segment, num_of_segments): rolled_resizedZ = img_to_segment.copy() Z = rolled_resizedZ.reshape((-1, 1)) Z = np.float32(Z) criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 50, 20.0) K = num_of_segments ret, label, center = cv2.km...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/star_appender.py
.py
2,770
88
import gemmi import os def update_star(starfile, ice_groups): new_document = gemmi.cif.Document() in_doc = gemmi.cif.read_file(starfile) block_optics = in_doc.find_block("optics") if block_optics is not None: block_new_optics = new_document.add_new_block("optics") for item in block_op...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/filter_designer_not_normalized.py
.py
4,339
146
import cv2 import matplotlib.pyplot as plt import mrcfile import numpy as np def load_img(img_path): with mrcfile.open(img_path, "r+") as mrc: img = mrc.data plt.imshow(img, cmap="gray") plt.show() return img def lowpass(img, pixel_size, lowcut, edge_type, falloff, lowpass=True):...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/icebreaker_icegroups_multi.py
.py
3,292
113
""" Input is group of motion corrected micrographs. Output is group of icegrouped images. """ import os import sys import time from multiprocessing import Pool import cv2 import mrcfile import numpy as np from icebreaker import KMeans_segmenter as KMeans_seg from icebreaker import filter_designer as fd from icebreake...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/local_mask.py
.py
846
31
import cv2 import numpy as np def local_mask(lowpass1, img2, val): reg3 = np.ones((img2.shape[0], img2.shape[1]), np.uint8) # coord0 = [] # coord1 = [] # k = np.zeros((img2.shape[0], img2.shape[1]), np.uint8) for u in range(img2.shape[0]): for v in range(img2.shape[1]): if img2...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/average_mask.py
.py
1,036
33
import cv2 import numpy as np def average_mask(lowpass1, img2, val): reg3 = np.ones((img2.shape[0], img2.shape[1]), np.uint8) coord0 = [] coord1 = [] # k = np.zeros((img2.shape[0], img2.shape[1]), np.uint8) for u in range(img2.shape[0]): for v in range(img2.shape[1]): if img2[u...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/window_mean.py
.py
1,710
45
import numpy as np def window(img, x_patches, y_patches): rows, cols = img.shape x_patch_size = int(cols / x_patches) y_patch_size = int(rows / y_patches) mean_map = img.copy() for i in range(x_patches): for j in range(y_patches): if i == x_patches - 1 and j != y_patches - 1: ...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/correct_path.py
.py
1,106
29
""" Creates a folder tree that is the relion standard and then populates folder tree with the flattened micrographs produced by ICEBREAKER """ import os import pathlib import shutil def correct(data_as_dict, all_dir, ending): for i in range(len(data_as_dict["_rlnmicrographname"])): name = data_as_dict["_r...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/original_mask.py
.py
1,595
45
import cv2 import numpy as np def original_mask(lowpass1, img2, val, original, lowpass12): reg3 = np.ones((img2.shape[0], img2.shape[1]), np.uint8) orig_mean = np.zeros((lowpass12.shape[0], lowpass12.shape[1]), np.float32) coord0 = [] coord1 = [] # global_mean = np.mean(lowpass12) # k = np.zer...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/original_mask_fast.py
.py
1,056
35
import cv2 import numpy as np def original_mask(lowpass1, img2, val, original, lowpass12): reg3 = np.ones((img2.shape[0], img2.shape[1]), np.uint8) # orig_mean = np.zeros((lowpass12.shape[0], lowpass12.shape[1]), np.float32) # coord0 = [] # coord1 = [] # global_mean = np.mean(lowpass12) # k = ...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/icebreaker_equalize_multi.py
.py
3,838
125
""" Input is group of motion corrected micrographs. Output is group of equalized images. """ import os import sys from multiprocessing import Pool import cv2 import mrcfile import numpy as np from icebreaker import KMeans_segmenter as KMeans_seg from icebreaker import filter_designer as fd from icebreaker import loc...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/plot_boxplots.py
.py
1,334
54
import sys import numpy as np import matplotlib.pyplot as plt import mrcfile import os import argparse def plot_boxes(indir): files = [] for filename in os.listdir(indir): if filename.endswith(".mrc"): finalpath = os.path.join(indir, filename) files.append(finalpath) e...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/cli/ib_job.py
.py
5,421
157
#!/usr/bin/env python """ External job for calling IceBreaker equalize within Relion 3.1 in_star is input star file from relion motion cor Run in main Relion project directory external_IBequal.py """ import argparse import json import os import os.path import pathlib import shutil import gemmi from icebreaker impo...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/cli/ib_5fig.py
.py
4,204
125
#!/usr/bin/env python """ External job for calling IceBreaker equalize within Relion 3.1 in_star is input star file from relion motion cor Run in main Relion project directory external_IBequal.py """ import argparse import json import os import os.path import pathlib import gemmi from icebreaker import five_figures ...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/cli/__init__.py
.py
0
0
null
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/cli/micrographs_enhance.py
.py
544
20
import argparse from icebreaker import icebreaker_equalize_multi def main(): parser = argparse.ArgumentParser() parser.add_argument( "-i", "--input", help="Directory containing micrographs (MRC files). Output will appear in a new directory called 'flattened' within this directory", ...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/cli/stats.py
.py
439
20
import argparse from icebreaker import five_figures def main(): parser = argparse.ArgumentParser() parser.add_argument( "-i", "--input", help="Directory containing grouped micrographs", dest="indir", ) parser.add_argument( "-j", help="Number of processes", dest...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/cli/ib_group.py
.py
2,465
80
#!/usr/bin/env python """ External job for calling IceBreaker grouping within Relion 3.1 in_parts is input star file from relion picking job in_mics is previous grouping job directory Run in main Relion project directory """ import argparse import os import os.path import gemmi from icebreaker import ice_groups as ...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/cli/particles_group.py
.py
483
23
import argparse from icebreaker import ice_groups def main(): parser = argparse.ArgumentParser() parser.add_argument( "-s", "--star", help="Star file containing particles", dest="instar", ) parser.add_argument( "-i", "--input", help="Directory c...
Python
2D
DiamondLightSource/python-icebreaker
src/icebreaker/cli/micrographs_group.py
.py
544
20
import argparse from icebreaker import icebreaker_icegroups_multi def main(): parser = argparse.ArgumentParser() parser.add_argument( "-i", "--input", help="Directory containing micrographs (MRC files). Output will appear in a new directory called 'grouped' within this directory", ...
Python
2D
joselado/jyvaskyla_summer_school_2022
update.py
.py
288
14
#!/usr/bin/python3 import os import argparse parser = argparse.ArgumentParser() parser.add_argument("--m",default="Update", help='Message') args = parser.parse_args() # get the arguments os.system("git add .") os.system("git commit -m \"" + args.m+ "\"") os.system("git push")
Python
2D
joselado/jyvaskyla_summer_school_2022
LICENSE.md
.md
35,141
675
GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamb...
Markdown
2D
joselado/jyvaskyla_summer_school_2022
sessions/session1.ipynb
.ipynb
2,865,971
1,387
{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "4abab1bf", "metadata": {}, "outputs": [], "source": [ "# Add the root path of the pyqula library\n", "import os ; import sys\n", "try: sys.path.append(os.environ[\"PYQULAROOT\"]) # add the library via environmental variabl...
Unknown
2D
joselado/jyvaskyla_summer_school_2022
sessions/session3.ipynb
.ipynb
1,817,473
1,261
{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Add the root path of the pyqula library\n", "import os ; import sys\n", "try: sys.path.append(os.environ[\"PYQULAROOT\"]) # add the library via environmental variable\n", "except: \n...
Unknown
2D
joselado/jyvaskyla_summer_school_2022
sessions/session5.ipynb
.ipynb
4,373,540
1,143
{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Add the root path of the pyqula library\n", "import os ; import sys\n", "try: sys.path.append(os.environ[\"PYQULAROOT\"]) # add the library via environmental variable\n", "except: \n...
Unknown
2D
joselado/jyvaskyla_summer_school_2022
sessions/session2.ipynb
.ipynb
3,188,223
1,643
{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Add the root path of the pyqula library\n", "import os ; import sys\n", "try: sys.path.append(os.environ[\"PYQULAROOT\"]) # add the library via environmental variable\n", "except: \n...
Unknown
2D
joselado/jyvaskyla_summer_school_2022
sessions/session4.ipynb
.ipynb
4,481,944
1,492
{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Add the root path of the pyqula library\n", "import os ; import sys\n", "try: sys.path.append(os.environ[\"PYQULAROOT\"]) # add the library via environmental variable\n", "except: \n...
Unknown
2D
janberges/elphmod
CHANGELOG.md
.md
7,916
239
# Changelog See [Git commits](https://github.com/janberges/elphmod/commits) for more detailed list of changes. ## v0.32/2025-11-24 * Contributing guidelines * Idle waiting (useful when single MPI rank uses multiple OpenMP threads) * Examples shown in documentation * Improved function to calculate optical conductivit...
Markdown
2D
janberges/elphmod
CONTRIBUTING.md
.md
1,807
37
# Contributing Patches, merge request, issue reports, and feature requests are most welcome, either via email or through any of the web platforms where elphmod is hosted. ## Code checks The following tasks should be performed regularly and especially before publishing a new version. * Reformat source code with ``fr...
Markdown
2D
janberges/elphmod
logo/pad.py
.py
520
21
#!/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 numpy as np import storylines def pad(i, ho, wo): hi, wi, c = i.shape o = np.full((ho, wo, c), 255) o[(ho - hi) // 2:(ho + hi) // 2, (wo - wi) // 2:(wo + ...
Python
2D
janberges/elphmod
logo/optimize.py
.py
1,076
41
#!/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 numpy as np import storylines import sys black = np.array([0x00, 0x00, 0x00]) white = np.array([0xff, 0xff, 0xff]) blue = np.array([0x19, 0x3b, 0xda]) red = np.array([...
Python
2D
janberges/elphmod
doc/examples.sh
.sh
1,162
47
#!/bin/bash mkdir -p examples for example in ../examples/*.py ../examples/*/*.py do folder=`dirname $example` name=`basename $example` name=${name%.py} if ls $folder/$name*.png > /dev/null 2>&1 then rst=examples/$name.rst readme=../examples/$name/README.md if ! test -f $r...
Shell
2D
janberges/elphmod
doc/conf.py
.py
1,233
52
# Configuration file for the Sphinx documentation builder. # https://www.sphinx-doc.org/en/master/usage/configuration.html project = 'elphmod' copyright = '2017-2026 elphmod Developers' author = 'Uni Bremen' extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'numpydoc', 'myst_parser', ] exc...
Python
2D
janberges/elphmod
elphmod/eliashberg.py
.py
4,812
159
# Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. """Parameters for McMillan's formula.""" import numpy as np import elphmod.bravais import elphmod.diagrams import elphmod.dos import elphmod.misc import elphmod.occupations def Tc(lamda, wlog, mus...
Python
2D
janberges/elphmod
elphmod/elel.py
.py
18,582
602
# Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. """Coulomb interaction from VASP.""" import sys import numpy as np import elphmod.bravais import elphmod.dispersion import elphmod.misc import elphmod.MPI comm = elphmod.MPI.comm class Model: ...
Python
2D
janberges/elphmod
elphmod/misc.py
.py
21,034
822
# Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. """Constants, status bars, parsing, etc.""" import collections import numpy as np import sys import elphmod.MPI comm = elphmod.MPI.comm info = elphmod.MPI.info verbosity = 3 """Level of verbosity...
Python
2D
janberges/elphmod
elphmod/dos.py
.py
11,701
388
# Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. """2D tetrahedron methods.""" import numpy as np import elphmod.bravais import elphmod.misc import elphmod.MPI comm = elphmod.MPI.comm def hexDOS(energies, minimum=None, maximum=None): r"""Ca...
Python
2D
janberges/elphmod
elphmod/el.py
.py
59,390
2,014
# Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. """Tight-binding models from Wannier90.""" import numpy as np import elphmod.bravais import elphmod.dispersion import elphmod.misc import elphmod.MPI import elphmod.occupations comm = elphmod.MPI....
Python
2D
janberges/elphmod
elphmod/diagrams.py
.py
47,833
1,594
# Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. """Susceptibilities, self-energies, etc.""" import numpy as np import elphmod.bravais import elphmod.misc import elphmod.MPI import elphmod.occupations comm = elphmod.MPI.comm info = elphmod.MPI.i...
Python
2D
janberges/elphmod
elphmod/dispersion.py
.py
18,337
597
# Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. """Diagonalization on paths and meshes.""" import numpy as np import elphmod.bravais import elphmod.misc import elphmod.MPI comm = elphmod.MPI.comm def dispersion(matrix, k, angle=60, vectors=Fal...
Python
2D
janberges/elphmod
elphmod/__init__.py
.py
477
22
# Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. """Python modules for electron-phonon models.""" __version__ = '0.32' from . import MPI from . import bravais from . import diagrams from . import dispersion from . import dos from . import el from...
Python
2D
janberges/elphmod
elphmod/ph.py
.py
66,896
2,139
# Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. """Mass-spring models from Quantum ESPRESSO.""" import numpy as np import elphmod.bravais import elphmod.dispersion import elphmod.misc import elphmod.MPI comm = elphmod.MPI.comm info = elphmod.MP...
Python
2D
janberges/elphmod
elphmod/elph.py
.py
55,671
1,701
# Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. # Some routines in this file follow wan2bloch.f90 of EPW v5.3.1. # Copyright (C) 2010-2016 S. Ponce', R. Margine, C. Verdi, F. Giustino """Electron-phonon coupling from EPW.""" import numpy as np ...
Python
2D
janberges/elphmod
elphmod/occupations.py
.py
13,983
501
# Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. """Step and delta smearing functions.""" import numpy as np try: from scipy.special import erf except ImportError: import math erf = np.vectorize(math.erf) xmax = 709.0 # approx. log(...
Python
2D
janberges/elphmod
elphmod/MPI.py
.py
12,365
457
# Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. """Work distribution and shared memory.""" import numpy as np import sys import time try: from mpi4py import MPI if MPI.COMM_WORLD.size == 1: raise ImportError except ImportError:...
Python
2D
janberges/elphmod
elphmod/bravais.py
.py
87,337
2,970
# Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. """Lattices, symmetries, and interpolation.""" import numpy as np import elphmod.misc import elphmod.MPI comm = elphmod.MPI.comm info = elphmod.MPI.info deg = np.pi / 180 def rotate(vector, angl...
Python
2D
janberges/elphmod
elphmod/plot.py
.py
13,838
511
# Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. """BZ plots, fatbands, etc.""" import numpy as np import elphmod.bravais import elphmod.MPI import elphmod.misc comm = elphmod.MPI.comm def choose_backend(): """Switch to non-GUI Matplotlib b...
Python
2D
janberges/elphmod
elphmod/md.py
.py
30,378
957
# Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. r"""Charge-density-wave dynamics on supercells. We model the free energy as a function of atomic displacments :math:`\vec u` as .. math:: F(\vec u) = \frac 2 N \sum_{\vec k n} \bigl[ ...
Python
2D
janberges/elphmod
elphmod/models/__init__.py
.py
0
0
null
Python
2D
janberges/elphmod
elphmod/models/graphene.py
.py
4,716
181
#!/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 numpy as np import elphmod.bravais import elphmod.dispersion import elphmod.el import elphmod.elel import elphmod.elph import elphmod.misc import elphmod.ph Npm = (1e...
Python
2D
janberges/elphmod
elphmod/models/chain.py
.py
2,751
107
#!/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 numpy as np import elphmod.bravais import elphmod.dispersion import elphmod.el import elphmod.elph import elphmod.misc import elphmod.ph a = 1.0 # AA c = 20.0 # AA M...
Python
2D
janberges/elphmod
elphmod/models/tas2.py
.py
8,630
358
#!/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 numpy as np import elphmod.bravais import elphmod.dispersion import elphmod.el import elphmod.elph import elphmod.misc import elphmod.ph deg = elphmod.bravais.deg Np...
Python
2D
janberges/elphmod
examples/irreducibles.py
.py
635
27
#!/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 if elphmod.MPI.comm.rank != 0: raise SystemExit N = 72 points = dict() for n, m in elphmod.bravais.irreducibles(N, angle=60): d = elphmod.bravais.sq...
Python
2D
janberges/elphmod
examples/dos.py
.py
976
38
#!/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 kT = 0.025 k = np.linspace(0, 2 * np.pi, 36, endpoint=False) E = np.empty(k.shape * 2) for i, p in enumera...
Python
2D
janberges/elphmod
examples/smear_tetra.py
.py
1,836
67
#!/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 mu = -0.1665 nk = 120 kT = np.linspace(0.1, 0.0, 1000, endpoint=False) q1 = 0.0 q...
Python
2D
janberges/elphmod
examples/a2f.py
.py
2,706
97
#!/usr/bin/env python3 # Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. # See Allen and Dynes, Phys. Rev. B 12, 905 (1975) for the formulas used here. import elphmod.models.graphene import matplotlib.pyplot as plt import numpy as np comm = elphm...
Python
2D
janberges/elphmod
examples/coulomb.py
.py
569
23
#!/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 elel = elphmod.elel.Model('data/U.ijkl', nq=2, no=1) path = 'GMKG' q, x, corners = elphmod.bravais.path(path, ibrav=4, N=150) ...
Python
2D
janberges/elphmod
examples/electrons.py
.py
1,537
67
#!/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 mu = -0.1665 colors = ['orange', 'skyblue', 'dodgerblue'] ...
Python
2D
janberges/elphmod
examples/skiing.py
.py
1,151
50
#!/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 scipy.optimize symmetric = True ph = elphmod.ph.Model('data/NbSe2_DFPT.ifc', divide_mass=False) ph =...
Python
2D
janberges/elphmod
examples/kekule.py
.py
2,846
123
#!/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 matplotlib.pyplot as plt import numpy as np import scipy.optimize comm = elphmod.MPI.comm sparse = False # use sparse matrices to be ab...
Python
2D
janberges/elphmod
examples/ssh.py
.py
1,125
43
#!/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 scipy.optimize sparse = False # use sparse matrices to be able to simulate large cells? N = 6 nk = 210 nq = 210 kT = 2e-4 elphmod.models...
Python
2D
janberges/elphmod
examples/tetrahedron.py
.py
1,678
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 sympy # We want to calculate: # # 1/V integral d^2k delta[e1(k)] delta[e2(k)] f(k) def simpler(x): return sympy.factor(sympy.expand(x)) A, B, C, a, b, c, X, T, t...
Python
2D
janberges/elphmod
examples/fermi_velocity.py
.py
934
39
#!/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 matplotlib.pyplot as plt comm = elphmod.MPI.comm info = elphmod.MPI.info mu = -0.1665 nk = 120 points = 500 el = elphmod.el.Model('...
Python
2D
janberges/elphmod
examples/fan_migdal.py
.py
2,990
108
#!/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 matplotlib.pyplot as plt import numpy as np comm = elphmod.MPI.comm info = elphmod.MPI.info nq = 240 eta = 0.05 / elphmod.misc.Ry info('...
Python
2D
janberges/elphmod
examples/peierls.py
.py
1,833
82
#!/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 t = 1.0 # hopping parameter (eV) beta = -1.0 # scaling exponent # atomic positions...
Python
2D
janberges/elphmod
examples/fermi_surface.py
.py
627
28
#!/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 mu = -0.1665 kT = 0.025 nk = 72 points = 200 el = elphmod.el.Model('data/NbSe2') e = elphmod.dispersion.dispersion_full(el.H,...
Python
2D
janberges/elphmod
examples/intersections.py
.py
1,266
49
#!/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 mu = -0.1665 nk = 36 q1 = 0.0 q2 = 0.3 el = elphmod.el.Model('data/NbSe2') ekk = elphmod.dispersion.disp...
Python
2D
janberges/elphmod
examples/supercell_el.py
.py
1,308
51
#!/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 N = [ # 3 x 3 (60 degrees instead of 120 degrees) [3, 0, 0], [3, 3, 0], [0, 0, 1], ] a = elphmo...
Python
2D
janberges/elphmod
examples/susceptibility.py
.py
1,935
75
#!/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 mu = -0.1665 kT = 0.025 q, x, GMKG = elphmod.bravais.GMKG(30, corner_indices=True)...
Python
2D
janberges/elphmod
examples/supercell_elel.py
.py
1,337
51
#!/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 N = [ # 3 x 3 (60 degrees instead of 120 degrees) [3, 0, 0], [3, 3, 0], [0, 0, 1], ] a = elphmo...
Python
2D
janberges/elphmod
examples/double_delta.py
.py
1,466
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 elphmod import matplotlib.pyplot as plt import numpy as np comm = elphmod.MPI.comm mu = -0.1665 nk = 120 dk = 12 nq = nk kT = 0.01 el = elphmod.el.Model('data/NbSe...
Python
2D
janberges/elphmod
examples/phonons.py
.py
1,433
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 matplotlib.pyplot as plt import numpy as np comm = elphmod.MPI.comm info = elphmod.MPI.info colors = ['skyblue', 'dodgerblue', 'orange'] data = 'NbSe2...
Python
2D
janberges/elphmod
examples/occupations.py
.py
3,241
99
#!/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 MPI, occupations import matplotlib.pyplot as plt import numpy as np if MPI.comm.rank: raise SystemExit x = np.linspace(-10, 10, 2001) style = dict(c...
Python
2D
janberges/elphmod
examples/supercell_ph.py
.py
1,402
49
#!/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 N = [ # 3 x 3 (60 degrees instead of 120 degrees) [3, 0, 0], [3, 3, 0], [0, 0, 1], ] ph = elphm...
Python
2D
janberges/elphmod
examples/run.sh
.sh
319
22
#!/bin/bash # Copyright (C) 2017-2026 elphmod Developers # This program is free software under the terms of the GNU GPLv3 or later. eval `elphmodenv` set -e for example in *.py do echo $example mpirun python3 $example done for example in */run.sh do pushd `dirname $example` ./run.sh popd done
Shell
2D
janberges/elphmod
examples/specfun.py
.py
2,711
113
#!/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 matplotlib.pyplot as plt import numpy as np comm = elphmod.MPI.comm info = elphmod.MPI.info info('Define parameters') to_screen = True...
Python
2D
janberges/elphmod
examples/supercell_elph.py
.py
2,286
77
#!/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 = 1 # displacement direction use_model = True # or run phrenorm_graphene first N = [ # 3 x 3 (60 degree...
Python
2D
janberges/elphmod
examples/isoline.py
.py
722
32
#!/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 comm = elphmod.MPI.comm mu = -0.1665 nk = 24 a1, a2 = elphmod.bravais.translations() b1, b2 = elphmod.bravais.reciprocals(a1,...
Python
2D
janberges/elphmod
examples/simsts/simsts.py
.py
3,768
138
#!/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 nk = 72 tip = np.array([0.0, 0.0, 3.0]) # tip position V =...
Python
2D
janberges/elphmod
examples/simsts/run.sh
.sh
692
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 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/lambda/lambda.py
.py
989
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 import numpy as np nk = nq = 36 el = elphmod.el.Model('TaS2') mu = elphmod.el.read_Fermi_level('pw.out') ph = elphmod.ph.Model('ifc', apply_asr_simple=True) p...
Python
2D
janberges/elphmod
examples/lambda/run.sh
.sh
726
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/cdw_1d/run.sh
.sh
672
27
#!/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/cdw_1d/cdw_1d.py
.py
1,265
48
#!/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 scipy.optimize el = elphmod.el.Model('C', rydberg=True) ph = elphmod.ph.Model('dyn.xml', divide_mass=False, apply_asr_si...
Python
2D
janberges/elphmod
examples/simstm/simstm.py
.py
452
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 matplotlib.pyplot as plt r0, a, X, tau, data = elphmod.misc.read_cube('stm.cube') plot = elphmod.plot.plot(data[:, :, data.shape[2] // 4], angle=120) ...
Python
2D
janberges/elphmod
examples/simstm/run.sh
.sh
632
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 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/wannier/run.sh
.sh
782
32
#!/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/wannier/wannier.py
.py
1,119
40
#!/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 pwi = elphmod.bravais.read_pwi('scf.in') path = 'GMKG' k, x, corners = elphmod.bra...
Python
2D
janberges/elphmod
examples/bare/bare.py
.py
1,084
45
#!/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 scipy.optimize comm = elphmod.MPI.comm colors = ['skyblue', 'dodgerblue', 'orange'] ph = elphmod.ph.Model('dyn.xml') ...
Python