Help Needed to Modify Script for Inserting Two Layers of Particles with Different Compositions

Submitted by Alibaz11 on Sun, 05/12/2024 - 23:08

I'm currently working on a particle packing simulation where I'm using a script to insert particles and simulate pressing. I want to extend this script to insert a second layer of particles on top of the first, with a different composition ratio of the same two particle types. After both layers are inserted, I would like to proceed with the pressing simulation. I have managed to insert the first layer successfully, but I need help modifying the script to add a second layer with a distinct composition.

I will provide you with some snippets of my script for simplification:

# Initial Setup and Variables
atom_style granular
atom_modify map array
boundary p p f
newton off
communicate single vel yes
units micro

variable alphastart equal 0.4
variable xmin equal -29
variable xmax equal 29
variable ymin equal -29
variable ymax equal 29
variable zmin equal 0
variable zmax equal 58
variable atomTypes equal 2
variable rad1_1 equal 0.5
variable rad2_1 equal 2.5
variable ratio1_1 equal 0.11361
variable ratio2_1 equal 0.88639

# Domain and Box Creation
region domain block ${xmin} ${xmax} ${ymin} ${ymax} ${zmin} ${zmax} units box
create_box ${atomTypes} domain

# Particle Templates and Distribution for First Layer
fix pts1 all particletemplate/sphere 100057 atom_type 1 density constant ${dens1} radius constant ${rad1_1}
fix pts2 all particletemplate/sphere 100069 atom_type 2 density constant ${dens2} radius constant ${rad2_1}
fix pdd1 all particledistribution/discrete 100103 2 pts1 ${ratio1_1} pts2 ${ratio2_1}

# Particle Insertion for First Layer
fix ins nve_group insert/pack seed 100151 distributiontemplate pdd1 maxattempt 200 insert_every once overlapcheck yes all_in yes vel constant 0. 0. 0. region domain volumefraction_region ${alphastart}
run 1
unfix ins

# Setup for Pressing
fix cad1 all mesh/surface/stress/servo file meshes/moving_face.stl type 2 scale ${scaleFac} move ${moveX} ${moveY} ${moveZ} stress on reference_point 0. 0. 0. com 0. 0. 0. ctrlPV force axis 0. 0. -1. target_val ${servo_f} vel_max ${Vmax} kp ${servo_kp} ki ${servo_ki} kd ${servo_kd}
..........

So, how to script the insertion of a second layer with a different ratio between Type 1 and Type 2. the second layer should basically occupy the rest (60%) of the simulaiton box (40% is initial layer).

I would be very thankful for every assistance. Thanks in advance