This program performs MBAR analysis (see Sec. 5.3 of ORAC manual) 
of a multi-ensemble simulation run, REM or SGE

  Syntax: mbar [scaling_factors_file [energies_file [Temperature] ] ]

The command-line arguments default to:
             `scaling_factors.dat'  `mbar.ene'    298.

See top of program source for file format specifications. File formats
respect those used by ORAC:

  scaling factors:  `REM.set'
  energies:         `*.rem'

Outputs weights to `mbar.weights', one line per configuration read
from energies_file.

Dimensionless free energies (simple Bennett and MBAR) are printed to
standard output.

------------------------------------------------------------------------

An MBAR analysis typically consists of the following steps:

 (0) [perform an REM or SGE run with ORAC;
   make sure to write the trajectories either in dcd, pdb, or xyz 
   format; see documentation in the $ORAC_DIR/tests/REM_tests or 
   $ORAC_DIR/tests/SGE_tests]    

 (1) Prepare MBAR input files (scaling_factors_file and energies_file)
  and .pdb molecular configurations from the REM run. You may use
  either the dcd2pdb or xyz2pdb auxiliary programs in the directory
  $ORAC_DIR/tools to produce a large pdb file for the whole
  generalized ensemble.  This step is exemplified in the script
  'rem2mbar.sh' if REM trajectories have been saved with the DCD
  sub-command of environment &REM

 (2) calculate mbar weights with program mbar
  [see syntax above] 

 (3) extract one conformational variable from configurations (.pdb)
  file (To this end, you may use the auxiliary analysis program 
  in the $ORAC_DIR/tools; see documentation therein) 

 (4) match each value of the conformational variable to MBAR weights
   [this can be done with a "paste" command; see example in test-mbar.sh] 
 
 (5) finally, make a MBAR-weighted histogram of variable (To this end,
  if the variable is two-dimensional such as a Ramachandran plot, you
  may use the auxiliary hist2d program in the $ORAC_DIR/tools)

These steps are exemplified in the script 'test-mbar.sh'. 

------------------------------------------------------------------------


To compile, run `make'

To run a sample calculation starting from step (2), using already
prepared input and configuration files, run `make test'

To run a sample calculation starting from results of REM test 1, first
run that test, then run `make test-from-rem' in this directory.


At the end of the test, 2-D MBAR-weighted histogram of Ramachandran
angles is printed to 'mbar.plt' in a format suitable for gnuplot. For
comparison, a histogram of the bottom ensemble only is printed to
'mbar.r01.plt'. To plot, run `gnuplot fes-plot.gp' and type <RET> to
go to the next plot or to exit.

