This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from scipy import ndimage | |
| from matplotlib.pyplot import plot, scatter, imshow | |
| def get_fake(size, number, radius, blur): | |
| """ | |
| Generate a fake image for ideal gas (random positions). | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import math | |
| from itertools import product | |
| import numpy as np | |
| from numba import njit | |
| from numba.typed import List | |
| @njit | |
| def build_verlet_nlist(nlist: List, point: List, particles: np.ndarray, rl:float): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from time import time | |
| import numpy as np | |
| from numba import njit, prange | |
| @njit(parallel=True) | |
| def ndot1(A, B): | |
| """ | |
| Calculate C with | |
| C[i, j, k] = sum_q( A[i, j, q] · B[i, q, k] ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <fstream> | |
| #include <regex> | |
| #include <string> | |
| using XYZ = std::array<double, 3>; | |
| using Coord3D = std::vector<XYZ>; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from matplotlib.pyplot import plot, scatter, imshow | |
| from mpl_toolkits.mplot3d import Axes3D | |
| N = 1000 | |
| z = np.random.uniform(-1, 1, N) | |
| phi = np.random.uniform(-np.pi, np.pi, N) | |
| rxy = np.sqrt(1 - z**2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from mpl_toolkits.mplot3d import Axes3D | |
| fig = plt.figure() | |
| ax = fig.add_subplot(111, projection='3d') | |
| b1 = np.array([ | |
| [1, 0, 0], | |
| [0, 1, 0], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <vector> | |
| #include <set> | |
| using namespace std; | |
| using Pair = vector<int>; | |
| using Pairs = vector<Pair>; | |
| bool should_join(Pair p1, Pair p2){ | |
| for (int n1 : p1){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import re | |
| def get_frames_from_xyz(filename, use_cols): | |
| """ | |
| Get all data from different frames from an xyz file | |
| Args: | |
| filename (str): the path of the xyz file to parse |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from scipy import ndimage | |
| from matplotlib.pyplot import plot, scatter, imshow | |
| def simulate_2d(N): | |
| theta = np.random.uniform(-np.pi, np.pi, (1000, N)) | |
| x = np.cos(theta).mean(-1) # shape (1000,) | |
| y = np.sin(theta).mean(-1) # shape (1000,) | |
| order = np.linalg.norm((x, y), axis=0) |