-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestnormalcollisions.py
More file actions
56 lines (39 loc) · 1.36 KB
/
Copy pathtestnormalcollisions.py
File metadata and controls
56 lines (39 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from pathlib import Path
import sys
# Add the parent 'python_scripts' directory to sys.path
sys.path.append(str(Path(__file__).resolve().parent.parent))
"""Setup script for coeff"""
import polars as pl
import matplotlib
matplotlib.use('qtAgg')
from utils.file_io import get_config
from utils.graphics import display
from utils.particles_objects import generate_molecules, create_rectangle
config, particles_filepath, objects_filepath = get_config()
print(objects_filepath)
box = config["sim_box_size"]
print(box)
#Two moving particles and one static
positions = [(0.02,0.025,0.036), (0.04,0.025,0.036), (0.04, 0.025, 0.02)]
velocities = [(0.0,0.0,-10.0),(0.0,0.0,-10.0), (0.0,0.0,0.0)]
radii = [0.0005, 0.0005, 0.015]
ptypes = [0, 0, 2]
d_r = [0.5,0.5,0.5]
molecules = list(generate_molecules(positions, v=velocities, d_r=d_r, rad=radii, ptype=ptypes))
df = pl.concat(molecules)
df.write_parquet(particles_filepath)
#Rectangle fills half the box.
w=box[0]/2.0
h=box[1]
z=0.035
rect = [(0.0,0.0,z),(0.0,h,z),(w,h,z),(w,0.0,z)]
# Create the rectangle DataFrame
rect_df = create_rectangle(
vertices=rect,
id_val=0,
colour=(0, 255, 0, 255) # Optional styling color
)
rect_df.write_parquet(objects_filepath)
print(f"Successfully initialised {len(df)} particles for a {box[0]}x{box[2]} box.")
print(df['ptype','charge'].head())
display(df, box, objects_df=rect_df)