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
b70_N200_L<L>.data — Data file
N200_Rg_L<L>.colvars — Colvars tuned to the system size
b70_N200_L<L>.in — Lammps Input (+optional Slurm input script)
The numbered sections below 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>.ltMoltemplate monomer (types 1 & 2)polyB_n<n>.ltMoltemplate 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-10), (L-10)]^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) Å.
3.5 Moltemplate — LT + XYZ → LAMMPS Data
moltemplate.sh -xyz IC_tmp.xyz b70_N200_L<L>.lt -nocheck
Inputs
packed coordinates
IC_tmp.xyzhierarchy
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 + 10andupperWalls = Rg + 5.Generates an
atomNumberslist selecting one bead from the center of each chain to experience metadynamics bias.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.colvarsfile
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 typesAppend
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 |