From bdf817efec1cfdd67cc6176a6664442fd98173ae Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Mon, 17 Oct 2022 20:59:01 -0400 Subject: As presented at RUMA on 2022-10-12 --- figs/atoms.fig/gas-rods.py | 88 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 figs/atoms.fig/gas-rods.py (limited to 'figs/atoms.fig/gas-rods.py') diff --git a/figs/atoms.fig/gas-rods.py b/figs/atoms.fig/gas-rods.py new file mode 100644 index 0000000..dc63d24 --- /dev/null +++ b/figs/atoms.fig/gas-rods.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python3 + +from math import * +import random + +# size of space +L=30 +# number of rods +N=15 +# aspect ratio +a=10 + +# check whether two rods overlap +def check_overlap(rod1,rod2): + # relative placement + relative_pos=unrotate(subtract(rod2[0],rod1[0]), rod1[1]) + if(abs(relative_pos[0])<2 and abs(relative_pos[1])<2 and abs(relative_pos[2])<2): + return(True) + # relative angle + relative_ang=cart_to_spherical(unrotate(spherical_to_cart(rod2[1]), rod1[1])) + # exclusion volume + # rotate other rod + relative_pos=unrotate(relative_pos, [0,relative_ang[1]]) + #if(abs(relative_pos[1])<2 and abs(relative_pos[0])-21 and abs(c)<1.0001): + if(c>0): + return([w[0],0]) + else: + return([w[0],pi]) + if(s>=0): + return([w[0],acos(c)]) + return([w[0],2*pi-acos(c)]) + +# configuration +config=[] +# add rods +while len(config)