
# We define non-bonded and bonded (angular) interactions between atoms
# belonging to "2bead" molecules.
# We define the settings for angles or dihedrals which might be present 
# later when we connect multiple "2bead/H" and "2bead/P" molecules together to 
# build a polymer.


2bead {


  # LAMMPS supports a large number of force-field styles.  We must select
  # which ones we need.  This information belongs in the "In Init" section.
  # (Hybrid styles used for portability. These choices can be overridden later.)

  write_once("In Init") {
    # -- Default styles for "2bead" --
    # (Hybrid force fields were not necessary but are used for portability.)
    bond_style      hybrid harmonic
    angle_style     hybrid harmonic
    dihedral_style  hybrid charmm
    pair_style      hybrid lj/cut 11.0

    # If charges are needed, (assuming biopolymers), try one of:
    #dielectric      80.0
    #pair_style      hybrid lj/cut/coul/debye 0.1 11.0
    # or (for short distances, below a couple nm)
    #pair_style      hybrid lj/charmm/coul/charmm/implicit 9.0 11.0

    pair_modify     mix arithmetic
    special_bonds   lj 0.0 0.0 0.0
  }


  # OPTIONAL: Enclose these angle settings within the 2bead {...} environment.
  #           We do this for the same reason we enclosed "H" and "P" in "2bead".
  #           This does not overwrite the definition of 2bead.  Here we are only
  #         augmenting "2bead" to include the following force field information.

  # 2-body (non-bonded) interactions:
  #
  #   Uij(r) = 4*eps_ij * ( (sig_ij/r)^12 - (sig_ij/r)^6 )
  #
  # Hydrophobic side-chains are attractive (large epsilon parameter).
  # Polar side-chains and backbone atoms are not attractive (small epsilon).
  #
  #              i       j           pairstylename   eps sig
  #
  write_once("In Settings") {
    pair_coeff @atom:CA  @atom:CA    lj/cut         0.10 2.0
    pair_coeff @atom:H/R @atom:H/R   lj/cut         2.50 3.6
    pair_coeff @atom:P/R @atom:P/R   lj/cut         0.10 3.6
  }

  # (Interactions between different atom types use "arithmetic" mixing rules.)

  write_once("Data Bonds By Type") {
    @bond:backbone   @atom:CA @atom:CA
    @bond:sidechain  @atom:CA @atom:*/R
  }

  # 2-body (bonded) interactions:
  #
  #   Ubond(r) = (k/2)*(r-0)^2
  #
  #   The corresponding command is:
  #
  #   bond_coeff     bondType    bondstylename   k     r0
  #

  write_once("In Settings") {
    bond_coeff     @bond:sidechain  harmonic    30.0   3.4
    bond_coeff     @bond:backbone   harmonic    30.0   3.7
  }


  #  Rules for determining 3 and 4-body bonded interactions by type

  # angle-type      atomType1 atomType2 atomType3

  write_once("Data Angles By Type") {
    @angle:backbone  @atom:CA @atom:CA  @atom:CA
    @angle:sidechain @atom:CA @atom:CA  @atom:*/R
  }

  # dihedral-type AtomType1 AtomType2 AtomType3 AtomType4

  write_once("Data Dihedrals By Type") {
    @dihedral:CCCC @atom:CA  @atom:CA @atom:CA @atom:CA 
    @dihedral:RCCR @atom:*/R @atom:CA @atom:CA @atom:*/R
  }

  # 3-body interactions in this example are listed by atomType and bondType
  # The atomIDs involved are determined automatically.  The forumula used is:
  #
  # Uangle(theta) = (k/2)*(theta-theta0)^2   
  #     (k in kcal/mol/rad^2, theta0 in degrees)
  #
  # The corresponding command is:
  #
  #   angle_coeff  angleType  anglestylename   k   theta0

  write_once("In Settings") {
    angle_coeff @angle:backbone   harmonic   30.00  114
    angle_coeff @angle:sidechain  harmonic   30.00  123
  }


  # 4-body interactions in this example are listed by atomType and bondType
  # The atomIDs involved are determined automatically.  The forumula used is:
  #
  # Udihedral(phi) = K * (1 + cos(n*phi - d))
  #
  #     The d parameter is in degrees, K is in kcal/mol/rad^2.
  #
  # The corresponding command is 
  # dihedral_coeff dihedralType dihedralstylename  K  n   d  w
  #     "w" is the weight for 1-4 pair interactions, which we set to 0.0

  write_once("In Settings") {
    dihedral_coeff @dihedral:CCCC    charmm      -0.5 1 -180 0.0
    dihedral_coeff @dihedral:RCCR    charmm      -1.5 1 -180 0.0
  } # write_once("In Settings") 

}

