Pipeline Overview
create_InitCoor.sh
is the orchestrator: edit a few variables at
the top, run it once, and you receive a complete LAMMPS start-up
folder containing
IC_tmp.xyz — packed bead coordinates (Packmol)
b70_N200_L<L>.data — Moltemplate data file
N200_Rg_L<L>.colvars — colvars tuned to the system size
b70_N200_L<L>.in — production input (+ optional Slurm script)
The diagram below shows the flow; the numbered sections explain every call in the wrapper, which files it consumes, and which files it writes.
Wrapper variables
Bash var |
Meaning / effect |
---|---|
|
Segment repeat count ( |
|
Sticker/spacer pattern |
|
Number of A-chains / B-chains ( |
|
Half-box length ( |
All filenames downstream are built from these numbers, e.g.
b70_N200_L500.lt
(b
= 70 % beads, N200
= 100 + 100
chains).
End-to-end flow
The helper chain executed by create_InitCoor.sh:
LT_writer.py → monomer LT + XYZ
writePackmolInput.py → Packmol recipe
Packmol → IC_tmp.xyz
writeSysLT.py → system LT
Moltemplate → b70_N200_L<L>.data
updateColVar.py → N200_Rg_L<L>.colvars
updateInput.py → b70_N200_L<L>.in + Slurm script
fix_datafiles.py → patch data file
lmp_mpi → run simulation
Detailed step-by-step
3.1 LT_writer.py
— build monomer libraries
python3 LT_writer.py "$n" "$seg"
Creates
polyA_n<n>.lt
Moltemplate monomer (types 1 & 2)polyB_n<n>.lt
Moltemplate monomer (types 3 & 4)polyA_n<n>_mono.xyz
&polyB_n<n>_mono.xyz
(single-monomer XYZ)
Bead taxonomy
ID |
Role |
---|---|
1 |
Sticker (A-chain, specific bonding) |
2 |
Spacer (A-chain, non-specific bonding) |
3 |
Sticker (B-chain, specific bonding) |
4 |
Spacer (B-chain, non-specific bonding) |
3.2 writePackmolInput.py
— Packmol recipe
python3 writePackmolInput.py "$n" "$NA" "$NB" "$L" \
populate_tmp.inp IC_tmp.xyz
Creates populate_tmp.inp
containing two structure
blocks,
each requesting NA
or NB
copies inside the cube
\([-L, L]^3\) with 10 Å clearance.
3.3 Packmol — coordinate packing
packmol < populate_tmp.inp # → IC_tmp.xyz
Replicates monomers, randomises orientation, outputs one XYZ:
14000
comment line
2 -185.4 -92.7 305.1
1 220.0 44.8 161.9
…
3.4 writeSysLT.py
— system-level LT
python3 writeSysLT.py "$n" "$NA" "$NB" "$L" b70_N200_L<L>.lt
Imports the monomer LTs, instantiates NA + NB polymers, defines back-bone bond/angle types, and writes a Data Boundary block ± (L + 20) Å.
3.5 Moltemplate — LT + XYZ → LAMMPS Data
moltemplate.sh -xyz IC_tmp.xyz b70_N200_L<L>.lt -nocheck
Inputs
packed coordinates
IC_tmp.xyz
hierarchy
b70_N200_L<L>.lt
Outputs
b70_N200_L<L>.data
— canonical LAMMPS Data filesystem.in.settings
— auxiliary pair/bond/angle styles*.lt.tmp
— intermediate JSON (can be deleted)
The -nocheck
flag skips Moltemplate’s expensive overlap checker—we
trust Packmol.
3.6 updateColVar.py
— patch the colvars template
python3 updateColVar.py IC_tmp.xyz N400_Rg_L700.colvars \
"$L" "$n" "$NA" "$NB" "$seg"
Computes radius of gyration from all beads.
Sets
upperBoundary = Rg + 10
andupperWalls = Rg + 5
.Generates an
atomNumbers
list selecting half-chains.Writes
N200_Rg_L<L>.colvars
.
3.7 updateInput.py
— final .in & Slurm launcher
python3 updateInput.py Template_input.in "$L"
Performs three substitutions in the template:
variable fName
→b70_N200_L<L>
read_data
→ correct Data filenamefix CV_Rg
→ new.colvars
file
Creates
b70_N200_L<L>.in
— production inputsubmit_b70_N200_L<L>.sh
— batch script (28 MPI, 3 days)
3.8 fix_datafiles.py
— enable dynamic bonds
Search-replace
2 bond types
→3 bond types
Append
50 extra bond per atom
Required for LAMMPS’s fix bond/create/random
(EXTRA-BOND
package), which forms single-valency sticker–sticker bonds
(bond type 3).
3.9 Run LAMMPS
lmp_mpi -in b70_N200_L<L>.in
# or
sbatch submit_b70_N200_L<L>.sh
File cheat-sheet
File |
Created by |
Consumed by |
---|---|---|
|
|
|
|
|
|
|
|
Packmol |
|
Packmol |
|
|
|
Moltemplate |
|
Moltemplate |
|
|
|
|
|
|
LAMMPS |
|
|
HPC scheduler |