Skip to content

Instantly share code, notes, and snippets.

View CatChenal's full-sized avatar

Cat Chenal CatChenal

View GitHub Profile

Tweaking the LJ Potential:

Unless I misunderstood the problem, this tweaking of the LJ parameters will be a tractable optimization problem once we know these two constraints:

  1. How much more favorable we want the new V to be?
  2. Over which additional tail range we want the favorable part to persist?

This is because there are numerous possible solutions.

Examples changing addtional with on sigma given n & m:

  • In these examples, the new V is still favorable at r=8:
  • Is the favorable difference sufficient, say at r=5, and do we have a handle on which extra energy is needed?
@CatChenal
CatChenal / cell0.md
Last active October 24, 2024 17:09
Cell0 in all Jupyter notebooks

The following code appears as 'Cell0' in all my Jupyter notebooks (because I use JupyterLab Templates).
It loads the most usual functions I use:

from IPython.core.interactiveshell import InteractiveShell
# to get multiple outputs from a cell (with or without using print):
InteractiveShell.ast_node_interactivity = "all"

from IPython.display import Markdown, Image
# for presentations:
@CatChenal
CatChenal / gomacs.md
Last active December 4, 2023 18:10
Detailed and revised commands for GROMACS installation in Ubuntu-20.04 (WSL2)

Commands sequence:

tar xfz gromacs-2023.3.tar.gz
cd gromacs-2023.3
mkdir build
cd build
cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON
make
make check
@CatChenal
CatChenal / standage_gv.md
Last active February 2, 2023 20:36
Graphviz decision tree redrawn from @standage
@CatChenal
CatChenal / conda_pkg_deps_from_WSL.md
Last active February 5, 2023 20:41
WSL-Bash script to get a conda package dependents on Windows mount

Main bash script:

  • Note: this is a work around for using linux scripting (grep/sed/awk) via WSL2 on an Windows OS target (../../mnt)
    ...without installing anything.

Contents of conda_pkg_deps.sh:

#!/bin/sh
#
# Find which package in the conda package cache requires the given package.
# To be run in home folder:~$ 

The easiest way I found to create an empty file in Windows 10 like touch in Linux:

>cd . > filename.ext
@CatChenal
CatChenal / env_with_kernel.md
Last active September 20, 2023 19:48
Conda environment creation & kernel installation

Conda environment creation & kernel installation

Update: A simpler alternative is to install nb_conda_kernels, which makes accessible all defined environments.

Two commands to run when creating a new env:

# 1. Env creation: always include ipykernel (could be place in .condarc)
conda create --name env310 python=3.10 ipykernel numpy
# 2. Kernel installation: makes env available in jupyter's kernels list
python -m ipykernel install --user --name=env310 --display-name "py310"
@CatChenal
CatChenal / bare_conda_env.md
Last active September 2, 2022 18:23
What a conda environment contains when created with only python & Command to exclude packages listed in .condarc `create_default_packages`.

Using the Anaconda Prompt on a Windows 10 system:

This is the conda command that creates a new environment with only python installed while excluding
any listed packages under the create_default_packages section of user root folder\.condarc:

(base) [PS1]>conda create -n bare310 --no-default-packages python=3.10

The output (minus a few blank lines):

Collecting package metadata (current_repodata.json): done
@CatChenal
CatChenal / clear_unused_axes.md
Last active July 27, 2022 18:05
When populating a grid of mpl axes with unknown actual number of datasets, some axes may be empty: clear them AFTER the main loop.

Tip: when populating a grid of mpl axes with unknown actual number of datasets, some axes may be empty: clear them AFTER the main loop.

Code source: DETR_panoptic notebook on colab

  • In the enumerated loop below, we don't know where i will end (because out["pred_masks"][keep] was not saved into a variable, hence we can't access its length).
  • We then use the main loop index into a second one to clear any empty axis.
#[...]
@CatChenal
CatChenal / h_candle_plot.md
Last active July 27, 2022 19:57
Candle plot for two series with categorical y-axis

candle

Data points and sample figure to replicate in E. Downey's plotting

import matplotlib.pyplot as plt

sandwich_list = [
    'Lobster roll',
    'Chicken caesar',