# Description.
# This is a simulation of pyramid-like objects made of particles stacked 
# and arranged like cannon-balls, or fruit-stands.  Ordinarilly, the stack 
# does not collapse because the particles at the ground layer are immobilized.
# However given an initial perterbation the pyramids collapse in an avalanche.
# (This can happen, for example when you do not minimize the system beforehand.)
# The particles roll down the pyramid and bounce off the "ground". The bouncing
# is due to a repulsive external force which is added artificially.
# (See the "run.in" file.)  The simulation looks weird without something 
# to bounce off of.  So I added a graphene surface at the bottom as scenery. 
# The ground does not serve any purpose except to look pretty.
#
# (Because there is no damping, I suspect that the distribution of heights of 
#  the particles in a small area should approach the Boltzmann distribution, 
#  if you run the simulation long enough.)


# ----------------- Pyramids: -----------------

import "pyramids.lt"

# Move the pyramids into their locations in Giza (approximate)

pyramidKhufu    = new    PyramidKhufu.move(210, 215, 1)
pyramidKhafre   = new   PyramidKhafre.move(150, 150, 1)
pyramidMenkaure = new PyramidMenkaure.move(105, 082, 1)
PyramidQueens1  = new  PyramidQueens1.move(089, 059, 1)
PyramidQueens2  = new  PyramidQueens2.move(100, 059, 1)
PyramidQueens3  = new  PyramidQueens3.move(111, 059, 1)


# --------------- Scenery: --------------------

import "graphene_wall.lt"

graphene_wall = new GrapheneWall

write_once("In Settings") {
  # Turn off all interactions with the graphene atoms by setting epsilon to 0.
  # (We will use a different repulsive barrier to represent the ground instead.)
  #  These atoms are just "for show".                     epsilon     sigma
  pair_coeff  @atom:Graphene/C @atom:Graphene/C  lj/cut   0.00000     3.407

  # Optional: Add the graphene atoms to the "gImmobile" group. Later freeze them
  group gImmobile type @atom:Graphene/C
}

# Unfortunately, the ground still looks kind of ugly because moltemplate does
# not yet know how to automatically connect nearby carbon atoms with C-C bonds 
# (based on distance).  (As of 2013-4-29, moltemplate is not good at 
# generating crystalline objects containing explicit bonds.)  
# If you want bonds between atoms, use VMD's "carbon-nanotube-builder plugin"
# (which creates data files with bonds) and then merge the two data files 
# manually later.  (This is not done here.)


# -------- override earlier settings ----------

write_once("In Init") {
  # Override any earlier style settings
  atom_style      full
  units           lj
  pair_style      hybrid lj/cut 1.0
  bond_style      none
  angle_style     none
  dihedral_style  none
  improper_style  none
  pair_modify     mix arithmetic
  special_bonds   lj 0.0 0.0 0.0
}

# ------------ boundary conditions ------------

write_once("Data Boundary") {
  -1.842033 398.493813              xlo xhi
  -0.708994 399.167013              ylo yhi
   0.0             400.0            zlo zhi
}
# ---------------------------------------------

