This will setup a Ubuntu-like terminal in MacOS X.
cat bash_profile >> ~/.bash_profile
open Ubuntu.terminal
| FROM ubuntu:22.04 as llvm_mos_base | |
| RUN apt-get update | |
| RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ | |
| git curl ca-certificates ninja-build cmake build-essential \ | |
| libstdc++-10-dev libxml2-dev libssl-dev pkg-config python3-pip \ | |
| swig python3-dev libedit-dev libncurses5-dev liblzma-dev | |
| FROM llvm_mos_base as build | |
| WORKDIR /tmp |
| # Copyright (c) Jupyter Development Team. | |
| # Distributed under the terms of the Modified BSD License. | |
| # | |
| # What is installed? | |
| # - https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html | |
| # - GCC 11, CMake, OpenMPI, parmed, openmm, nglview, mdtraj | |
| # - Faunus main branch incl. manual and examples | |
| # | |
| ARG OWNER=jupyter |
| #include <vector> | |
| #include <iostream> | |
| #include <type_traits> | |
| #include <Eigen/Eigen> | |
| /** | |
| * @brief Eigen::Map facade to access data members in STL vectors/arrays | |
| * | |
| * No data is copied and modifications of the Eigen object | |
| * modifies the original container and vice versa. |
| #!/usr/bin/env python | |
| # Copyright (c) 2015-2023 Mikael Lund | |
| # | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions | |
| # are met: | |
| # | |
| # 1. Redistributions of source code must retain the above copyright | |
| # notice, this list of conditions and the following disclaimer. |
| private: | |
| enum baseparticle_ : Index {RX=0,RY,RZ,ID,Q,LAST}; | |
| enum multipoleparticle_ : Index {MUX=LAST,MUY,MUZ}; | |
| public: | |
| // Particle charge | |
| EIGEN_STRONG_INLINE Scalar charge() const { return (*this)[Q]; } | |
| EIGEN_STRONG_INLINE Scalar& charge() { return (*this)[Q]; } | |
| // Particle id |
| #include <iostream> | |
| #include <functional> | |
| #include <map> | |
| #include <cmath> | |
| #include <memory> | |
| /* ordered pair */ | |
| template<class T> | |
| struct opair : public std::pair<T,T> { | |
| typedef std::pair<T,T> base; |
This maps a vector of 3d positions and map each index into an evenly spaced lattice of grid points (cells). The neighbors of a given index in the position vector can be used to quickly find all other index in the vicinity.
More inspiration: http://cacs.usc.edu/education/cs596/01-1LinkedListCell.pdf
| #!/bin/bash | |
| curl -LH "Accept: application/x-bibtex;q=1" http://dx.doi.org/$1 | |
| echo |
| #include <random> | |
| #include <iostream> | |
| template<typename T, typename Tengine=std::mt19937> | |
| class RandOne { | |
| std::uniform_real_distribution<T> dist_; | |
| Tengine eng_; | |
| public: | |
| /* constructor w. non-deterministic seed */ | |
| RandOne() : dist_(0,1) { | |
| std::random_device rd; |