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

n

Segment repeat count (10 → chain length = 10 × len(seg))

seg

Sticker/spacer pattern 2212212 (2 = spacer, 1 = sticker)

NA / NB

Number of A-chains / B-chains (100 / 100)

L

Half-box length (500 Å) → Packmol cube \([-L, L]^3\)

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:

  1. LT_writer.py → monomer LT + XYZ

  2. writePackmolInput.py → Packmol recipe

  3. PackmolIC_tmp.xyz

  4. writeSysLT.py → system LT

  5. Moltemplateb70_N200_L<L>.data

  6. updateColVar.pyN200_Rg_L<L>.colvars

  7. updateInput.pyb70_N200_L<L>.in + Slurm script

  8. fix_datafiles.py → patch data file

  9. 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 file

  • system.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 and upperWalls = 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:

  1. variable fNameb70_N200_L<L>

  2. read_data → correct Data filename

  3. fix CV_Rg → new .colvars file

Creates

  • b70_N200_L<L>.in — production input

  • submit_b70_N200_L<L>.sh — batch script (28 MPI, 3 days)

3.8 fix_datafiles.py — enable dynamic bonds

  • Search-replace 2  bond types3  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

polyA_n<n>.lt / polyB_n<n>.lt

LT_writer.py

writeSysLT.py

polyA_n<n>_mono.xyz / polyB_n<n>_mono.xyz

LT_writer.py

writePackmolInput.py

populate_tmp.inp

writePackmolInput.py

Packmol

IC_tmp.xyz

Packmol

writeSysLT.py, updateColVar.py

b70_N200_L<L>.lt

writeSysLT.py

Moltemplate

b70_N200_L<L>.data

Moltemplate

fix_datafiles.py, updateInput.py

N200_Rg_L<L>.colvars

updateColVar.py

updateInput.py

b70_N200_L<L>.in

updateInput.py

LAMMPS

submit_b70_N200_L<L>.sh

updateInput.py

HPC scheduler