MODULE KEYS
  ! keyword parameters that are globally used in many different places in the code
  IMPLICIT NONE

   ! -------- Other ---------------
  CHARACTER*100 :: ACTION
  INTEGER :: RNGSEED
  LOGICAL :: VERBOSE
  
  ! ----------------------
  ! chain geometry and energetics
  ! ---------------------
  LOGICAL :: SHEARABLE, STRETCHABLE, COUPLED, FINITEXT, USESTERICS
  DOUBLE PRECISION :: LP, LS, EC, EPERP, EPAR, GAM, FINITSHEAR, CONSTMOD,STERRAD
  INTEGER :: STARTNPT, MAXNPT,STERSKIP
  DOUBLE PRECISION :: STERMOD
  INTEGER :: NEDGESEG
  DOUBLE PRECISION :: EDGELS, EDGELP, EDGEGAM, EDGEEPAR, EDGEEPERP,EDGEEC
  

  ! --------- Output / input-------------
  CHARACTER*100 :: OUTFILE, SNAPSHOTFILE, RESTARTFILE, STRESSFILE
  LOGICAL :: DUMPSNAPSHOTS, RESTART, APPENDSNAPSHOTS, STARTEQUIL
  INTEGER :: SNAPSHOTEVERY, SKIPREAD, EQUILSAMPLETYPE
  LOGICAL :: EQUILBEADROD, PARAMFROMSNAPSHOT
  DOUBLE PRECISION :: STARTEQUILLP  

  ! Monte Carlo
  INTEGER :: MCPRINTFREQ, MCTOTSTEPS, MCINITSTEPS, MCSTATSTEPS,MCOUTPUTFREQ, ADJUSTEVERY
  DOUBLE PRECISION :: FACCTARGET, FACCTOL, ADJUSTSCL, INITRANGE(4)
  LOGICAL :: DOREDISC, OUTPUTBEADWEIGHT
  DOUBLE PRECISION :: MINSEGLEN, MAXSEGLEN
  INTEGER :: INTUWEIGHTNPT, INTRWEIGHTNPT

  ! brownian dynamics
  DOUBLE PRECISION :: FRICTR, FRICTU, DELTSCL
  LOGICAL :: FRICTPERLEN
  INTEGER :: BDSTEPS, RUNGEKUTTA
  LOGICAL :: LOGRTERM,FIXBEAD1,FIXBEADMID
  DOUBLE PRECISION :: BDPRINTEVERY
  LOGICAL :: BDPRINTLOG, GAUSSIANCHAIN, USEBDENERGY, DOBROWN, USEPSEUDOFORCE
  DOUBLE PRECISION :: BRCRELAX
  LOGICAL :: TRACKLOOPING
  CHARACTER*100 :: LOOPFILE
  DOUBLE PRECISION :: LOOPRAD

  ! obstacles
  DOUBLE PRECISION :: RADOB, MODOB, FRICTOB

  double precision :: mu

  ! ------------ groups of chains ------------
  INTEGER :: NFORCE, NCONNECT, NCHAIN
  INTEGER, PARAMETER :: MAXNFORCE=100
  INTEGER, PARAMETER :: MAXNCONNECT = 1000
  DOUBLE PRECISION :: FORCE(MAXNFORCE,3)
  INTEGER :: FORCEBEAD(MAXNFORCE,2)
  INTEGER :: CONNECTIONS(MAXNCONNECT,4)
  LOGICAL :: CONNECTPOS, CONNECTUVEC, SQUARELATTICE, FIXCONNECT
  DOUBLE PRECISION :: CONPOSMOD, CONUVECMOD
  INTEGER :: TRACKDIST(4) ! track distance between which two points (bead&chain)?

  LOGICAL :: DIAMONDLATTICE ! set up a diamon lattice
  INTEGER :: NDIAMOND(2) ! number of diamonds across and down
  DOUBLE PRECISION :: WIDTHDIAMOND ! Width of each diamond initially
  INTEGER :: LENDIAMOND ! number of chain segments along diamond side

  ! for each fixed bead list: bead, chain, fix position, fix orientation 
  ! (0 for not, >0 for yes)
  INTEGER, PARAMETER :: MAXFIXBEAD = 100
  INTEGER :: NFIXBEAD
  INTEGER :: FIXBEAD(MAXFIXBEAD,4)
  ! fix all bead positions for top/bottom and or side boundaries
  ! 1) top/bottom fixed 2) sides fixed
  ! 3) fix positions 4) fix orientations
  LOGICAL :: FIXBOUNDARY(4)
  ! force a shear deformation
  LOGICAL :: SETSHEAR
  DOUBLE PRECISION :: SHEARGAMMA
  ! start with collapsed structure
  LOGICAL :: STARTCOLLAPSE

  LOGICAL :: DOLOCALMOVES
END MODULE KEYS
