diff options
author | Ian Jauslin <jauslin@ias.edu> | 2018-02-06 19:57:42 +0000 |
---|---|---|
committer | Ian Jauslin <jauslin@ias.edu> | 2018-02-06 19:57:42 +0000 |
commit | bfed53d2c76cc0449d2d6ef1963863092fb98d03 (patch) | |
tree | f9ab1f9e84474684dcdaa37b8a0743c4fa93c1b6 /figs/atoms.fig |
Diffstat (limited to 'figs/atoms.fig')
-rw-r--r-- | figs/atoms.fig/Makefile | 15 | ||||
-rw-r--r-- | figs/atoms.fig/crystal-base.gp | 21 | ||||
-rw-r--r-- | figs/atoms.fig/crystal.py | 24 | ||||
-rw-r--r-- | figs/atoms.fig/gas-base.gp | 21 | ||||
-rw-r--r-- | figs/atoms.fig/gas.py | 39 | ||||
-rw-r--r-- | figs/atoms.fig/liquid-base.gp | 21 | ||||
-rw-r--r-- | figs/atoms.fig/liquid.py | 39 |
7 files changed, 180 insertions, 0 deletions
diff --git a/figs/atoms.fig/Makefile b/figs/atoms.fig/Makefile new file mode 100644 index 0000000..b0cdfa6 --- /dev/null +++ b/figs/atoms.fig/Makefile @@ -0,0 +1,15 @@ +PROJECTNAME=crystal liquid gas +PNGS=$(addsuffix .png, $(PROJECTNAME)) + +all: $(PNGS) + +$(PNGS): + cp $(patsubst %.png, %, $@)-base.gp $(patsubst %.png, %, $@).gp + python $(patsubst %.png, %, $@).py >> $(patsubst %.png, %, $@).gp + gnuplot $(patsubst %.png, %, $@).gp > $@ + +clean-aux: + rm -f $(addsuffix .gp, $(PROJECTNAME)) + +clean: clean-aux + rm -f $(PNGS) diff --git a/figs/atoms.fig/crystal-base.gp b/figs/atoms.fig/crystal-base.gp new file mode 100644 index 0000000..4502919 --- /dev/null +++ b/figs/atoms.fig/crystal-base.gp @@ -0,0 +1,21 @@ +set terminal pngcairo size 2048,2048 + +set key off +unset colorbox +unset border +unset xtics +unset ytics +unset ztics + +set parametric + +set view equal xyz + +set isosample 100 + +set pm3d depthorder +set pm3d lighting primary 0.50 specular 0.6 + +set palette defined (0 "#339999", 1"#339999") + +splot \ diff --git a/figs/atoms.fig/crystal.py b/figs/atoms.fig/crystal.py new file mode 100644 index 0000000..4b1ba3c --- /dev/null +++ b/figs/atoms.fig/crystal.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +from math import * +import random +import sys + +# size of lattice +N=5 + +# configuration +config=[] +for i in range(N): + for j in range(N): + for k in range(N): + config.append([2*i+((j+k)%2),sqrt(3)*(j+(k%2)/3),2*sqrt(6)/3*k]) + + +for i in range(len(config)): + print(str(config[i][0])+"+cos(u)*sin(v)", end=",") + print(str(config[i][1])+"+sin(u)*sin(v)", end=",") + print(str(config[i][2])+"+cos(v)", end=" ") + print("with pm3d", end="") + if i<len(config)-1: + print(", \\") diff --git a/figs/atoms.fig/gas-base.gp b/figs/atoms.fig/gas-base.gp new file mode 100644 index 0000000..7e337b6 --- /dev/null +++ b/figs/atoms.fig/gas-base.gp @@ -0,0 +1,21 @@ +set terminal pngcairo size 2048,2048 + +set key off +unset colorbox +unset border +unset xtics +unset ytics +unset ztics + +set parametric + +set view equal xyz + +set isosample 100 + +set pm3d depthorder +set pm3d lighting primary 0.5 specular 0.6 + +set palette defined (0 "#339999", 1"#339999") + +splot \ diff --git a/figs/atoms.fig/gas.py b/figs/atoms.fig/gas.py new file mode 100644 index 0000000..8685999 --- /dev/null +++ b/figs/atoms.fig/gas.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 + +from math import * +import random + +# size of space +L=15 +# number of particles +N=10 + +# check whether two rods overlap +def check_overlap(sphere1,sphere2): + if(sqrt((sphere2[0]-sphere1[0])**2+(sphere2[1]-sphere1[1])**2+(sphere2[2]-sphere1[2])**2)<2): + return(True) + return(False) + +# configuration +config=[] +# add spheres +while len(config)<N: + # random position + x=[random.uniform(0,L), random.uniform(0,L), random.uniform(0,L)] + # check it does not interfere with other spheres + fine=True + for sphere in config: + if(check_overlap(sphere,x)): + fine=False + break + if fine: + config.append(x) + +for i in range(len(config)): + sphere=config[i] + print(str(sphere[0])+"+cos(u)*sin(v)", end=", ") + print(str(sphere[1])+"+sin(u)*sin(v)", end=", ") + print(str(sphere[2])+"+cos(v)", end=" ") + print("with pm3d", end="") + if i<len(config)-1: + print(", \\") diff --git a/figs/atoms.fig/liquid-base.gp b/figs/atoms.fig/liquid-base.gp new file mode 100644 index 0000000..4502919 --- /dev/null +++ b/figs/atoms.fig/liquid-base.gp @@ -0,0 +1,21 @@ +set terminal pngcairo size 2048,2048 + +set key off +unset colorbox +unset border +unset xtics +unset ytics +unset ztics + +set parametric + +set view equal xyz + +set isosample 100 + +set pm3d depthorder +set pm3d lighting primary 0.50 specular 0.6 + +set palette defined (0 "#339999", 1"#339999") + +splot \ diff --git a/figs/atoms.fig/liquid.py b/figs/atoms.fig/liquid.py new file mode 100644 index 0000000..99b09ba --- /dev/null +++ b/figs/atoms.fig/liquid.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 + +from math import * +import random + +# size of space +L=15 +# number of particles +N=100 + +# check whether two rods overlap +def check_overlap(sphere1,sphere2): + if(sqrt((sphere2[0]-sphere1[0])**2+(sphere2[1]-sphere1[1])**2+(sphere2[2]-sphere1[2])**2)<2): + return(True) + return(False) + +# configuration +config=[] +# add spheres +while len(config)<N: + # random position + x=[random.uniform(0,L), random.uniform(0,L), random.uniform(0,L)] + # check it does not interfere with other spheres + fine=True + for sphere in config: + if(check_overlap(sphere,x)): + fine=False + break + if fine: + config.append(x) + +for i in range(len(config)): + sphere=config[i] + print(str(sphere[0])+"+cos(u)*sin(v)", end=", ") + print(str(sphere[1])+"+sin(u)*sin(v)", end=", ") + print(str(sphere[2])+"+cos(v)", end=" ") + print("with pm3d", end="") + if i<len(config)-1: + print(", \\") |