Generating Initial Data File

I am new to molecular dynamics. On the forum, despite many posts on tools like moltemplate/packmol/vmd topotools/cmp2lmp etc, there are many suggestions to write own code to do the initial data file part. If I am to write the code to generate the initial file, how do I go about it?

Systems I want to model are two.

  1. A coarse-grained polymer (polystyrene) melt on a substrate (model adhesion, as a learning exercise).
  2. An all-atom simulation of a polymer before polymerization. The monomer unit of this polymer is a large molecule, with benzene rings etc.

How do I go about generating initial configuration? I want to run the simulation with LAMMPS. (Are there any alternatives available?)

You’re asking more of a programming Q than
a LAMMPS Q. The format of the LAMMPS data
file is pretty simple. If you have one or more
polymer chains in your model, then writing a program
to output the chains in the LAMMPS data file format
is a programming task. If you’re asking how
to get a densely packed collection of polymer
chains that don’t overlap, that’s a hard problem.
If you don’t know how to tackle it then you should
be using one of the tools you mentioned.