Explanation:

   Generate a moltemplate file containing a definition of a Polymer 
   molecule containing monomers located at the positions specified in 
   "coords.raw" (a 3-column text file).  Monomers will be rotated so
   that they point along the polymer axis direction (see "-dir-indices")
   with an optional helical twist added (see "-helix").  Users can 
   specify one or more bonds connecting each monomer to the next monomer
   (see "-bond").  Similarly, 3-body and 4-body angular interactions between
   atoms in different monomers can either be generated automatically 
   (using the standard moltemplate "Angle By Type" rules) 
   OR generated manually (using "-angle", "-dihedral", "-improper" arguments).

Usage:

   genpoly_lt.py  \\
      [-bond btype a1 a2] \\
      [-helix deltaphi] \\
      [-axis x,y,z] \\
      [-circular yes/no/connected] \\
      [-dir-indices ia ib] \
      [-angle    atype a1 a2 a3 i1 i2 i3] \\
      [-dihedral dtype a1 a2 a3 a4 i1 i2 i3 i4] \\
      [-improper itype a1 a2 a3 a4 i1 i2 i3 i4] \\
      [-monomer-name mname] \\
      [-sequence sequence.txt] \\
      [-polymer-name pname] \\
      [-inherits ForceFieldObject] \\
      [-header "import \"monomer.lt\""] \\
      [-cuts cuts.txt] \\
      [-box paddingX,paddingY,paddingZ] \\
      < coords.raw > polymer.lt

Arguments (optional):

    -axis x,y,z  direction of the polymer axis in the original monomer object.
             These three numbers (separated by commas with no spaces)
             define the direction that the monomer subunit is pointing in.  
             By default, the three numbers are 1 0 0 (ie, the X axis)

    -helix deltaphi = Optionally, rotate each monomer around it's axis by
             angle deltaphi (in degrees) beforehand

    -circular keyword
       keyword must be one of these:
             "no"          The polymer is a linear chain with the two ends
                           not connected.
             "yes"         The polymer is a circular loop with the two ends
                           connected pointing in similar directions.
             "connected"   Connect the two ends together with bonds (and angles,
                           and dihedrals, if applicable) to make a closed loop.
                           But do not adjust the orientation of the first and 
                           last monomers so that they point towards eachother.
                           (Use this if you plan to simulate an "infinitely" 
                           long polymer using periodic boundary conditions,
                           with the two ends are connected on opposite sides.)

    -dir-indices ia ib
             The program attempts to orient each monomer in a direction that
             the polymer is pointing.  By default, the program will
             orient monomer i in the direction connecting the monomers before
             and after it (monomers i-1 and i+1).  The user can override this
             using the -dir-indices command line argument.  The ia and ib
             arguments are integer offsets.  To point monomer i in the direction
             connecting it to the following monomer (i+1), use -dir-indices 0 1
	     (For circular polymers, the indices will be wrapped appropriately.)

    -bond btype a1 a2
             Add a bond between successive monomers of type btype.
             between atoms named a1 and a2 (all three arguments are strings and
             omit the @bond: and $atom: prefixes in moltemplate variables)
             Multiple bonds between successive monomers can be added by having
             "-bond bt a1 a2" appear several times in the argument list.
             For example, double-stranded DNA can be implemented as a polymer 
             with 2 bonds connecting separate monomers (if each "monomer 
             corresponds to a base pair).

    -angle atype a1 a2 a3 i1 i2 i3
             Add a 3-body angle interaction between atoms a1 a2 a3 in monomers
             i1 i2 and i3.  (The aname atype a1, a2, a3 arguments are strings 
             containing moltemplate variable names. The standard moltemplate
             prefixes "$angle:", "@angle:", and "$atom:" should be omitted.
             The i1, i2, i3 arguments are integer indices indicating the monomer
             that each atom belongs to.
                0 corresponds to the current monomer
                1 corresponds to the next monomer
                2 corresponds to the following monomer, etc...
	     (For circular polymers, the indices will be wrapped appropriately.)
             Multiple angles per monomer can be added by having:
             "-angle aname atype a1 a2 a3 i1 i2 i3" 
             appear several times in the argument list.


    -dihedral dtype a1 a2 a3 a4 i1 i2 i3 i4
             Add a 4-body dihedral interaction between atoms a1 a2 a3 a4 in 
             monomers i1 i2 and i3.  (The dname dtype a1, a2, a3, a4, arguments
             are strings containing moltemplate variable names. The moltemplate
             prefixes "$dihedral:", "@dihedral:", and "$atom:" should be omitted
             The i1, i2, i3, i4 arguments are integer indices indicating the
             monomer that each atom belongs to.  (See explanation above.)
             Multiple dihedrals per monomer can be added by having:
             "-dihedral dname dtype a1 a2 a3 a4 i1 i2 i3 i4" 
             appear several times in the argument list.

    -improper itype a1 a2 a3 a4 i1 i2 i3 i4
             Add a 4-body improper interaction between atoms a1 a2 a3 a4 in 
             monomers i1 i2 and i3.  (The iname itype a1, a2, a3, a4, arguments
             are strings containing moltemplate variable names. The moltemplate
             prefixes "$improper:", "@improper:", and "$atom:" should be omitted
             The i1, i2, i3, i4 arguments are integer indices indicating the 
             that each atom belongs to.  (See explanation above.)
             Multiple impropers per monomer can be added by having:
             "-improper iname itype a1 a2 a3 a4 i1 i2 i3 i4" 
             appear several times in the argument list.

    -monomer-name name
                   Name of the moltemplate object that will be created.
                   (By default "Monomer")  Note: You can include 1 or more 
                   coordinate transformations added to the monomer subunit
                   before it is moved into position.  For example, it is 
                   often useful to to use a modified version of the monomer
                   whose initial coordinates are compressed to avoid collisions
                   with other monomers.  To do this, use something like 
                   "Monomer.scale(0.5,0.7,0.7)" instead of "Monomer".
                   This typically would compress each monomer lengthwise by 0.5
                   and 0.7 laterally. (After minimization, each monomer should
                   expand back to its ordinary size and shape.)

    -header 'some text'
                   This is a way to add text at the beginning of the file.
                   It was intended to be used to define the force fields and
                   the monomer subunits you are using.  For example:
                   -header 'import "FILE_WHICH_DEFINES_Monomer.lt"'

    -sequence sequence.txt
                   If you are building a heteropolymer this argument allows 
                   you to specify the sequence of monomers in the polymer.
                   Here "sequence.txt" file contains the sequence of monomers
                   you want in your polymer.  Each line of this file should
                   be the name of a moltemplate object for the monomer subunit
                   you want at that location.  The number of lines in this file
                   should match the number of lines in the coordinate file.
                   As before, you can include coordinate transforms in each
                   monomer's name.

    -polymer-name name 
                   Name of the moltemplate object that will be created.
                   (By default "Polymer")

    -inherits ForceFieldObject
                   "ForceFieldObject" is the name of a moltemplate object which
                   defines any rules for creating angles, dihedrals, impropers
                   which you want to be generated automatically.  Hopefully
                   this is object was defined somewhere in the file that
                   you imported using the "-header" argument.

    -cuts cut_locations.txt
                   Cut the polymer in several places along its length.
                   This can be useful if your goal is to create many
                   polymers of different lenthgs.  Rather than being forced 
                   to define a new Polymer object for each polymer, simply 
                   cut the polymer N times along its length.  The file 
                   "cut_locations.txt" is a text file containing a list of
                   positive integers (one per line) indicating where you would 
                   like the polymer to be cut.  For each integer, i, which 
                   appears in this file, a cut is made between monomers
                   i-1 and i (Indexing begins at 0, so a value of 1
                   corresonds to a cut between the first and second monomers.)
                   A separate polymer object will be created for each polymer,
                   and an integer suffix will be added to the name, to
                   distinguish them from eachother.  (Each of these 
                   polymers will be part of a larger object defined by this
                   program.  Instantiating that object will create all of the
                   individual polymers.)

    -box paddingX,paddingY,paddingZ
                  This will cause the program to attempt to estimate the size
                  of the smallest rectangular box which encloses all of the
                  coordinates in the coordinate file.  The user must supply
                  3 comma-separated numbers (no spaces) which indicate how much
                  extra room is needed in the x,y,z directions, at both ends.


Examples:

   1) Make a simple polymer, adding "@bond:Backbone" type bonds between 
   "$atom:c2" from each monomer with "$atom:c1" from the next monomer.

   genpoly_lt.py -bond Backbone c2 c1 < crds.raw > poly.lt

   2) Make a circular twisted double-stranded DNA model, treating each base-pair
   as a monomer, and connecting each base-pair monomer with 2 bonds
   with the next base-pair.  This is done using 2 "-bond"
   commands connecting the "O3p_a" atom with the "P_a" atom (in strand A),
   and the "P_b" atom with the "O3p_b" atom (from the opposite strand, B).

   genpoly_lt.py -circular yes -helix 34.2857 \
                 -header 'import "basepair.lt"   #<--defines "BasePair"' \
                 -monomer-name "BasePair" \
                 -polymer-name "Plasmid" \
                 -bond Backbone O3p_a   P_a \
                 -bond Backbone P_b   O3p_b \
                 < dna_basepair_CM_coords.raw \
                 > chromosome.lt
   If you want to control the sequence of the polymer, replace the 
   "-monomer-name" argument with "-sequence sequence.txt".
