Skip to content

Instantly share code, notes, and snippets.

View certik's full-sized avatar

Ondřej Čertík certik

View GitHub Profile
from StringIO import StringIO
from sympy import *
from sympy import pprint
cfile = StringIO()
cfile.write("""
inline void mohrCoulomb(const double& phi, const double& psi, const
double& c, const double stress[nSymTen], //inputs
double& f, double df[nSymTen], double
xxyx
@certik
certik / nist_meshes.py
Created March 16, 2011 01:34
NIST meshes
from math import sqrt, log
from numpy import exp, arange
from qsnake.mesh import get_mesh_exp_params, mesh_exp
def mesh_nist1_direct(r_min, r_max, N):
r_min = float(r_min)
r_max = float(r_max)
n = arange(N+1)
a = r_max / r_min
program Hydrogen
use rdirac
use fmesh
implicit none
! Atomic number:
integer, parameter :: Z = 92
! Mesh parameters:
real(dp), parameter :: r_min = 1e-8_dp, r_max = 50.0_dp, a = 1e6_dp
integer, parameter :: NN = 3000
from numpy import loadtxt, log, abs, sign, exp
from scipy import polyfit
from pylab import plot, show
a = loadtxt("a.txt")
E = a[:, 0]
rt = a[:, 2]
E_f = E[-1]
E = E[:-1]
rt = rt[:-1]
ondrej@crow:~/repos/dftatom(master)$ tests/uranium/uranium_nonrel
Hydrogen like nonrelativistic energies for Z=92 (U)
Mesh parameters (r_min, r_max, a, N):
1.00E-08 50.00 1.00E+06 3000
n l E E_exact Error
9 -0.74986248515115494
10 -1.38325477745979727E-004
11 -8.74251184857079945E-012
@certik
certik / gist:885668
Created March 24, 2011 19:20
Manipulate for Radial Schroedinger Equation
V[r] = -1/r;
Manipulate[
r0 = 10^r0exp;
If[usen,
En = -1/(2*n^2);
];
Plot[
Evaluate[
P[r] /. NDSolve[
{
@certik
certik / README.rst
Created April 22, 2011 14:15
Semiconductor Physics Equations
@certik
certik / Makefile
Created April 29, 2011 04:55
Gfortran warning
all:
gfortran -Wextra -Wall -o w.o -c w.f90
This code:
from IPython.core.ipapi import get as get_ipython
ip = get_ipython()
ip.config.InteractiveShell.confirm_exitip.config.InteractiveShell.confirm_exit = False
IPython.frontend.terminal.embed.InteractiveShellEmbed(user_ns=namespace, banner1=banner).mainloop()
produces: