Skip to content

weka511/smac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,094 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Statistical Mechanics and Computations

Code from the course: Statistical Mechanics and Computations. It includes exercises from the textbook Statistical Mechanics: Algorithms and Computations by Werner Krauth.

# Folder File Description
  book Exercises and algorithms from the book
1 Monte Carlo Algorithms: Direct Sampling & Markov Chain sampling
  Lecture direct_pi.py Algorithm 1.1 - compute pi using direct sampling
    direct_pi_multirun.py Compute pi using multiple runs of direct sampling
    markov_pi.py Calculate pi using Markov Chain Monte Carlo
    markov_pi_multirun.py Calculate pi using multiple runs of Markov Chain Monte Carlo
    pebble_basic.py Demonstrate neighbour table for MCMC-Algorithm 1.6
    pebble_basic_inhomogeneous.py Demonstrate neighbour table for MCMC-Algorithm 1.6 with inhomogeneous probabilities
  Tutorial pebble_basic.py Move pebble using neighbour Table 1.3
    pebble_basic_movie.py Move pebble using neighbour Table 1.3
    pebble_basic_multirun.py Move pebble using neighbour Table 1.3
    pebble_dual_eigen.py Two games: Illustrate conversion of reducible matrix to irreducible+aperiodic to make motion ergodic
    pebble_dual_movie.py '''Two games: Illustrate conversion of reducible matrix to irreducible+aperiodic to make motion ergodic'''
    pebble_multirun_all_histogram.py Show probability for reaching other cells after 0, 1, 2, ... moves
    pebble_multirun_histogram.py Show probability for reaching other cells after 0, 1, 2, ... moves
    pebble_recurrent_eigen.py Dual pebble: make aperiodic
    pebble_recurrent_movie.py Dual pebble: make aperiodic
    pebble_transfer.py Model Monte Carlo simulation as a transfer matrix, illustrating speed of convergence
    pebble_transfer_eigen.py Eigenvalues and eigenvectors of transfer matrix, illustrating speed of convergence
    pebble_transfer_sub.py Model Monte Carlo simulation as a transfer matrix; subtract equilibrium value to show speed of convergence
  Homework exerciseB.py Shows that the error of markov_pi follows the law: const / sqrt(N_trials)for large N_trials. The constant is larger (sometimes much larger) than 1.642 and it depends on the stepsize delta.
    exerciseC.py Bunching method: compute the error in markov_pi.py from a single run and without knowing the mathematical value of pi.
    exerciseC1.py Bunching method: compute the error in markov_pi.py from a single run and without knowing the mathematical value of pi
    exerciseC3.py Bunching method: compute the error in markov_pi.py from a single run and without knowing the mathematical value of pi
2 Hard Disks: from classical mechanics to statistical mechancs
  Lecture direct_disks_box.py Direct sampling of disks in box, tabula rasa
    direct_disks_box_a1.py Direct sampling of disks in box, tabula rasa: investigate success rate
    direct_disks_box_movie.py Direct sampling of disks in box, tabula rasa, plotted as movie
    direct_disks_box_multirun.py Direct sampling of disks in box, tabula rasa, multiple runs
    direct_disks_box_multirun_b1.py Generate histogram of x positions by direct sampling of disks in box, tabula rasa
    event_disks_box.py Algorithm 2.1: event-driven molecular dynamics for hard disks in a box
    event_disks_box_a3.py Algorithm 2.1: event-driven molecular dynamics for hard disks in a box. Repeat
    event_disks_box_b3.py Algorithm 2.1: event-driven molecular dynamics for hard disks in a box. Repeat and generate histogram
    event_disks_box_movie.py Algorithm 2.1: event-driven molecular dynamics for hard disks in a box. Repeat. Plotted as movie
    markov_disks_box.py Algorithm 2.2: generating a hard disk configuration from another one using a Markov chain
    markov_disks_box_a2.py Algorithm 2.2: generating a hard disk configuration from another one using a Markov chain
    markov_disks_box_movie.py Algorithm 2.2: generating a hard disk configuration from another one using a Markov chain
    markov_disks_box_multirun_b2.py Algorithm 2.2: generating a hard disk configuration from another one using a Markov chain
  Tutorial direct_discrete.py Create configuration of rods using tabula rasa to give equiprobable distribution
    direct_disks_any.py Compute acceptance probability for hard disks as a function of density
    direct_disks_box.py Algorithm 2.1: event-driven molecular dynamics for hard disks in a box
    direct_disks_box_slow.py Algorithm 2.1: event-driven molecular dynamics for hard disks in a box. Build full set of disks, including invalid, then cull.
    direct_disks_multirun.py Algorithm 2.1: event-driven molecular dynamics for hard disks in a box with periodic boundary conditions: multiple runs to collects stats
    direct_disks_multirun_movie.py Algorithm 2.1: event-driven molecular dynamics for hard disks in a box with periodic boundary conditions: multiple runs to collects stats
    random_sequential_discrete.py Create configuration of rods without tabula rasa: does not give equiprobable distribution
    random_sequential_discrete_movie.py Create configuration of rods without tabula rasa: does not give equiprobable distribution
3 Entropic Interactions and Phase Transitions
  Lecture direct_pins.py Algorithm 6.1: direct sampling
    direct_pins_improved.py Algorithm 6.1: direct sampling
    direct_pins_movie.py Algorithm 6.1: direct sampling
    direct_pins_noreject.py Algorithm 6.2: rejection free sampling
    direct_pins_noreject_movie.py Algorithm 6.2: rejection free sampling
  Tutorial direct_pins.py Algorithm 6.1: direct sampling
    direct_pins_density.py
    direct_pins_movie.py
    direct_pins_noreject.py
    direct_pins_noreject_movie.py
    direct_pins_noreject_periodic.py
    direct_pins_noreject_periodic_pair.py
  Homework my_markov_disks.py
    preparation1.py
    preparation2.py
4 Sampling and Integration
  Lecture direct_sphere_3d.py
    direct_sphere_3d_movie.py
    direct_surface.py
    direct_surface_3d.py
    direct_surface_3d_movie.py
    gauss_2d.py
    gauss_2d_movie.py
    gauss_3d.py
    gauss_3d_movie.py
    gauss_test.py
    gauss_test_movie.py
    naive_gauss.py
    naive_gauss_movie.py
  Tutorial basic_use_random.py
    gamma_transform.py
    gauss_transform.py
    markov_gauss.py
    markov_gauss_movie.py
    markov_inv_sqrt.py
    markov_inv_sqrt_movie.py
    naive_ran.py
    reject_direct_gauss_cut.py
    reject_inv_sqrt_cut.py
    tower_discrete.py
    walker_test.py
  Homework data-bunch.py
    markov_hypersphere.py
    markov_hypersphere_C2.py
    markov_sphere_3D.py
    markov_sphere_4D.py
5 Quantum Statistical Mechancs 1/3: Density Matrices and Path Integrals
  Lecture harmonic_wavefunction.py
    harmonic_wavefunction_check.py
    harmonic_wavefunction_check_movie.py
    harmonic_wavefunction_movie.py
    matrix_square_harmonic.py
    matrix_square_harmonic_movie.py
    naive_harmonic_path.py
    naive_harmonic_path_movie.py
  Tutorial free_periodic_complex_exp.py
    free_periodic_complex_exp_movie.py
    free_periodic_sine_cosine.py
    free_periodic_sine_cosine_movie.py
    harmonic_trotter_movie.py
    quantum_time_evolution.py
  Homework a2.py
    markov_gauss_a1.py
    markov_gauss_movie_a1.py
    matrix_square_anharmonic_c1.py
    matrix_square_anharmonic_c3.py
    matrix_square_harmonic_b1.py
    path_Integral_b2.py
    path_Integral_c2.py
6 Quantum Statistical Mechancs 2/3: Lévy Quantum Paths
  Lecture continuous_random_walk.py Construct path using a simple random walk (endpoint is not held fixed)
    levy_free_path.py Simple simplementation of Levy Free Path Algorithm
    levy_harmonic_path.py
    levy_harmonic_path_3D.py Lévy flight in 3D
    levy_harmonic_path_movie.py
    naive_harmonic_path.py Construct path using direct sanpling (inefficient)
    naive_path_slice.py
    naive_path_slice_movie.py
    trivial_free_path.py Generate a random walk, then pull back as described in Lecture 6, 20:12. Compare result with Lévy free path
  Tutorial naive_boson_trap.py Enumerate energies in a simple harmonic trap
    naive_single_particle.py Enumerate states for Bosons, i.e. indistinguisgable particles
  Homework a1.py
    a2.py
    a3.py
    b1.py
    b2.py
    b3.py
    c1.py
    c2.py
7 Quantum Statistical Mechancs 3/3: Bose-Einstein Condensation
  Lecture markov_harmonic_bosons.py
    markov_harmonic_bosons_movie.py
    permutation_sample.py
  Tutorial canonic_harmonic_recursion.py
    canonic_harmonic_recursion_movie.py
    direct_harmonic_bosons.py
    markov_harmonic_bosons.py
    permutation_sample.py
    permutation_sample_cycle.py
  Homework a1.py
    a2.py
    a2a.py
    a3.py
    b1.py
    b2.py
    c1.py
8 Ising Model: Enumerations and Monte-Carlo Algorithms
  Lecture cluster_ising.py
    cluster_ising_movie.py
    energy_ising.py 5-1 Compute the energy of an Ising configuration
    enumerate_ising.py
    enumerate_ising_mod.py
    enumerate_ising_movie.py
    gray.py
    markov_ising.py
    markov_ising_movie.py
    thermo_ising.py
    thermo_ising_movie.py
  Tutorial heatbath_ising.py
    heatbath_ising_random_map.py
    heatbath_ising_random_map_movie.py
  Homework A1.py
    A2.py
    B1.py
    B2.py
    C1.py
    C2.py
9 Dynamic Monte Carlo, Simulated Annealing
  Lecture dynamic_ising.py
    dynamic_ising_patch.py
    fast_spin_dynamics.py
    fast_throw.py
    naive_spin_dynamics.py
    naive_spin_dynamics_movie.py
    naive_throw.py
  Tutorial direct_sphere_disks.py
    direct_sphere_disks_any.py
    direct_sphere_disks_any_movie.py
    direct_sphere_disks_movie.py
    example_pylab_visualization.py
    markov_sphere_disks.py
    resize_disks.py
    simulated_annealing.py
    simulated_annealing_movie.py
  Homework A1.py
    A2.py
    B1.py
    C1.py
    C2.py
10 The Alpha and Omega of Monte Carlo
  Lecture direct_gamma.py Integral of x**gamma, illustrating need for importance sampling
    direct_gamma_average.py Integral of x**gamma, illustrating need for importance sampling
    direct_gamma_average_movie.py Histogram of Integral of x**gamma, illustrating need for importance sampling
    direct_gamma_average_rescaled.py
    direct_gamma_average_rescaled_movie.py Integral of x**gamma: rescale, plot histograms, and compare with Lévy distribution
    direct_gamma_running.py
    direct_gamma_running_movie.py
    direct_needle.py Buffon's experiment (with cheat)
    direct_needle_patch.py Buffon's experiment
- utils backends.py List graphics backends
    walker.py Used to create README.MD from file tree

About

Code I have written for course: Statistical Mechanics and Computations

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages