Skip to content

Instantly share code, notes, and snippets.

View Stanvk's full-sized avatar
🌱

Stan Stanvk

🌱
  • The Netherlands
  • 20:14 (UTC +01:00)
View GitHub Profile
@Stanvk
Stanvk / CVReporter.py
Last active November 4, 2025 09:22
CVReporter.py
from typing import List, TextIO
class CVReporter:
"""
Accumulates parameter-work each MD step, using a single force group.
The group should contain only the bias force (CustomCVForce) being steered.
Work is computed via energy-parameter derivatives [1]
ΔW = (∂U/∂s0) * Δs0
@Stanvk
Stanvk / Plotter.py
Created February 17, 2023 10:35
Origin Styled Matplotlib Plotter
from matplotlib import rcParams, cycler
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoMinorLocator
class Plotter():
def __init__(self):
rcParams['text.usetex'] = True
rcParams['font.family'] = 'sans-serif'
rcParams['font.sans-serif'] = ['Arial']
rcParams['font.size'] = 16
@Stanvk
Stanvk / lbm.py
Created October 7, 2019 13:41
crude D1Q3 Lattice Boltzmann Method Python implementation
import matplotlib.pyplot as plt
from matplotlib import animation
import math
import numpy as np
simulationTime = 4000
dt = 1
weights = [2 / 3, 1 / 6, 1 / 6]
velocities = [0, -1, 1]
@Stanvk
Stanvk / MonteCarloIntegrator.py
Created September 25, 2019 08:04
Simple Monte Carlo Integrator to approximate the value of pi by integrating over a quadrant of the unit circle.
import math
import random
class MonteCarlo:
def __init__(self, function, iterations):
"""
Initializes the MonteCarlo integrator.
:param function: Inject the function that the user whishes to integrate.
@Stanvk
Stanvk / Eigenvalue-problem-ODE-Solver.py
Created September 21, 2019 22:31
2nd order ODE eigenvalue problem solver with Runge Kutta and shooting method
import math
import numpy as np
import matplotlib.pyplot as plotter
######################
## Some Definitions ##
######################
# u''(x) = lambda u(x)
# y0 = u(x) and y1 = u'(x)
# u(0)=0 and u(1)=0
@Stanvk
Stanvk / Lorenz.py
Last active September 19, 2019 12:01
Chaotic Lorenz attractor
import math
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
#######################
## Lorenz Parameters ##
#######################
params = {
'a': 4, # sigma
@Stanvk
Stanvk / Simplicity.php
Last active August 29, 2015 14:15
Simplicity in Magister
<?php
use Magister\Magister;
$magister = new Magister($school, $username, $password);
//Haal alle cijfers op.
$magister->grades()->get();
<form class="well span8">
<div class="row">
<div class="span3">
<label>First Name</label>
<input type="text" class="span3" placeholder="Your First Name">
<label>Last Name</label>
<input type="text" class="span3" placeholder="Your Last Name">
<label>Email Address</label>
<div class="input-prepend">
<span class="add-on"><i class="icon-envelope"></i></span><input type="text" id="inputIcon" class="span2" style="width:233px" placeholder="Your email address">
@Stanvk
Stanvk / Bootstrap.php
Created June 29, 2013 16:07
A bootstrap for our MVC, but this time without a .htaccess
<?php
class Bootstrap
{
private $_controller;
public function __construct()
{
if(isset($_GET['view']))
<?php
/*
* Stan's MVC Framework v1.0
*------------------------------
* @author: Stanvk
* @date: 19-5-2013
*------------------------------
*
* !!This is a dummy controller!!