README news, bugs removal, ...

MAIN 2015

Deposition of MAIN refined files

To support deposition of free kick refined files directly from MAIN the PDB standard format was updated.

Parameters and data relevant for deposition are now SAVEd in the "SAVE_FILE.CIF" which can be inlcuded into the "cif" file produced by PDB validation tools or PDB extract. PDB stuff promissed to include MAIN on teh lists of refinement and model building programs in their tools.

Engh Huber parameters updated to the current version

To support deposition the EH 99 parameter set replaced the 91 set used so far. All hydrogen protein models are supported too.

Improved minimizer

The new minimizer is accesible by the keywords

 mini  any position

Extended tk_re_image GUI

Several function were added to the Tk_re_image: chain trace update, RGB color support, ...

Command centering

Change of syntax by adding the semgment name to the "image center sequence" command

 image cent seq 15 C

will center the image on the residue with the sequnece ID "15" and segmnet name "C".

Ramachandran plot

The active selection is now plotted on screen. While Ramachandran plot is ON, the residues can be picked by clicking on the seq ID or cross in the Ramachandran plot. To return to the model display, click again on "RAMACHAN" on teh "VALIDATION" menu page to swithc bakc to model manipulation.

Map display

Labels are replacing the old style "map_1" label list. In time user will be able to write their own in the GUI-s.

The mouse scroll middle button can now be configured by right click on the "MAP_SCROL" menu item and can be now applied also for functions such as box size, color, apart from the contour level. The step for each function is adjustable too.

MAIN 2014

FREE KICK refinement

The current release contains the FREE KICK maximum likelihood (ML) target, which uses WORK set of data to calculate error estimates for the ML function, which makes th estimates and solution more stable and independent of fluctuations of the TEST set. Important is that it does not require the TEST set nor RFREE.

FREE KICK maps can also be calculated and they proved superior to ML maps base on error estimates form the TEST set.

The ms "Free kick instead of cross validation in maximum likelihood refinement of macromolecular crystal structures" by Jure Praznikar, Dusan Turk was recently accepted in Acta Cryst D and will be available soon.

CTRL shortcuts

I have put a new mechanism in place which allows to call the menu items directly from keyboard. In general the menu items are composed of two words delimited by underscore. The first character of the first word is typed as CTRL character and followed by the first character of the second word.

For example, RE_IMAGE is called by<ctrl> r followed by i.

MAIN 2013

MAIN paper was published. Important for users is the Appendix, which is in fact users manual describing how to use and run the program with graphical interface and Tk GUI-s.

Paper exposed the score map tool, which can be used to identify helices and follow the chain trace in noisy maps.

RE_IMAGE conigurtaion obtained its own GUI. It is no more run through interpreter.

MAIN in 2011 - 2012

A number of features were coded - I have lost track of them though...

Tk GUI-s

Check them as they cover several additional features

Map calculations have been enhanced

REFMAC included as an option into refinement

Dynamic memory allocation

The crucial data arrays can be allocated at the begining of MAIN session

 mainps --help
GET_COMMAND_LINE> possible MAIN command line arguments:
  --atoms nn
  --residues nn
  --geometry x y width height


MAIN>show sizes
 Atoms arrays size ....    100000
 Residue arrays size ..     30000
 Pairs array size  ....    100000
 H-bonds array size ...     10000
 Points arrays size ...   1000000
 Topology library residues ...   150
 Topology library atoms ......  4500
 Paramter classes .....   300
 Paramter bonds .......   600
 Paramter angles ......  1000
 Paramter dihedrals....  1400
 Paramter impropers....  1000
 Number of maps ...................        10
 Total grid point size of maps .... dynamical
 Structure factors arrays size ....         0

or reallocated during a MAIN session. (What can be shown, can be set.)

MAIN>set sizes
  default   initiali  atoms     hbonds    pairs
  points    residues  topology  paramete  help

MAIN in 2010 - MAIN goes GUI with Tk scripts

Automati detection of NCS from the sequence

Changed so that the import of PDB files via "" automatically renames segment names of PDB. They can be extracted from segment names or chain IDs. The consequent comparison based on residue sequence finds identity and defines NCS groups for averaging and refinement.


"RE_IMAGE" configuration works now only through Tk interface.

Missing topology and parameter data for residue refinement

Automatic search for missing topology and parameters is part of the "" script. When "PURY" instalation is available on the running computer, the unrecognized residues from the PDB file are submitted to the local instalation otherwise the residues are submited to the "PURY" server

Side chain validation and fitting

The scripts "TEST_SID" searches for best possible fit of a side chain to density map. It includes the side chain flip "FLIP_SID" and minimization to find the optimal conformation. ILE, VAL, LEU, THR are tested for the better orientation of the sp3 carbon.

Hydrogen bond optimization

The side chains of "HIS", "ASN", "GLN", and "THR" are tested for their best imbedment into the hydrogen bonding network of the surrondings. The "HBON_OPT" click does it. A non-interactive procedure will appear shortly.

Refining and building at low resolution: H-bonds

Hydrogen bonds can be guessed from the secondary structure. Within the "MINIMIZE" page "HBO_SECO" item finds secondary structure elements - like helices and beta sheets and creates the list of hydrogen bonding restraints.

Hydrogen bond list is editable and is saved in the file "SAVE_FILE.HBOND"

Refining and building at low resolution: B-value sharpening

To enhance details at low resolution B-value sharpening has been included in map calculation and refinement. (B-value sharpening has been always part of DM and density averaging routines.)

Instruction is: Choose the most appropriate sharpening value by visualizing the map.

MAIN in 2009

A number of things have been improved or added - but quite a few things are still in transition stage.

Map calculation

The map calculation is on the move to a single menu item "CALC_MAP" configured via the "" and its "Tk" left mouse click.

Fcalc of the unmeasured reflections have been added to the 2Fobs-Fcalc maps to improve the map smoothness and thereby interpretability. To be able to do that the keyword for specifying the assymetric unit of the diffraction data "asymmetric" has been added.

This includes generation of the second generation kick maps (as published Praznikar et al., 2009)

Center list: Structure validation and map peaks

Validation page will be grately reduced in the future as most of validation is moving into the "GEN_LIST" menu item on the "BLD_RESI" page. Below are two scripts "" and "" amd its "Tk" left mouse click. They create sorted lists of positions in space based on a number of criteria (validation, maps, pdb files). This positions you can visit consecutively by clicking on "CENT_NEX" of pressing "g" (go) on the keyboard.

Creation of "re_image.cmds"

The script generating the "re_image.cmds" can now only be invoked via the "Tk" interface.

MAIN 2008(still beta release ) September 2008

Dynamic memory allocation

By moving to FORTRAN 95 it has been possible to start using dynamical memory allocation of arrays. Maps, structure factors and points are done. Proteasome and other large structures as ribosome, do not require special compilations. While the maps and structure factor space are allocated on the fly, the point array has to be enlarged when to small.

> show sizes
  Atoms array size .....    100000
  Residue array size ...     30000
  Points array size ....   1000000
  Number of maps ...................        10
  Total grid point size of maps .... dynamical

> set size point 10000000

By doing this the map memory is not a single block, so maps can be now created and deleted in any order. This has effected the macros. Many of them are not anymore backward compatible. The transition is not completed yet so more changes will come.

Dynamic allocation of atomic arrays will follow soon and will be possible from the command line.

More GUI-s

GUI for main configuration written in Tk-perl allows now interactive configurations and import of PDB and diffraction files (mtz, scalepack, PDB cif, shelx), however, only from the working directory.

This GUI is still bugy. (The multiple crystal forms part is not quite smooth yet.) Reports and cases are welcome.

GUI support for the "re_image.cmds" file configuration.

For "PLOT", "GEN_SURF", ....

PURY interface

the "" reads the PBD file, finds all residues and searches for appropriate topology files and asks PURY to generate topology and parameters files for the missing residues.

Atomic element in the PDB and topology files

The columns 77 and 78 are now used to stor and define atomic name from the periodic table. For compatibility also the topology libraries now contain the element name corresponding to each class. When a PDB file does not contain them a click on "DEFINE" will redefine them.

Through this also scattering factors are defined. The default scattering factors for each element have now been encoded into MAIN source. The complete list can be found in the MAIN_UTILS:scattering_factors.dat.

> write scatter

writes the list of current scattering factors.

Note: beacuse of this the current MAIN executable is not entiraly compatible with the previous PDB and topology files.

MAIN command line options

The command line options allow to start MAIN in no graphics mode, enable skipping of the ".main" file and specify the explicit display size and position:

 mainps --help
GET_COMMAND_LINE> possible MAIN command line arguments:
 --geometry x y width height
STOP<<< end of MAIN command line>>>

Use cif, shelx

The "" has been intorduced to enable conversion of PDB structure factors cif files into MAIN format.

Bug reports


For a few local installations I have done in 2008 the minimizer tolerated only 0.5A kicks in refinement and minimization. Now this has been fixed and the kicks up and beyond 1.0A are working again.

ML refinement

There was a bug in ML refinement function (not in map calculations), which resulted in slightly mis scaled derivative maps. The test have shown that the final structure was not really effected.

Site chain fitting

There was a bug (or maybe a feature) in the "FIT_SIDE" routine. The last rotation along the side chain was not searched. Therefore occasionally rings wer not fitted properly. For other side chains this was not obvious.

Random clicking

If clicked on an empty space in the depp menu window MAIN could do strange things and even crash. Miha and Gregor spotted a number of problems which are hopefully fixed now.

MAIN 2006(beta release ) November 2007

I've spend quite some time fixing and adding new functions to the "create_config" scripts and fix a few source code problems. I do not exactly remember what I have done appart from the things listed below.

Center list created from structure validation

A new create_config-urable "GEN_LIST" item has been added to the "CENTER" menu block MAIN_MENU:center.html. It is visible on the "BLD_RESI" and "VALIDATE" pages. Its role is to analyse structure and generated a sorted center list, along which you can jump from one to another (from worse to better).

  -h|--help)      prints this message with available options and current status
  -o|--output)    set file name of the created macro [anal_center_list.cmds]
  -b|--by)        goto the next residue by [BOND/DENSITY/VDW/MAIN_CHAIN/B-VALUE] [BOND]
  -c|--cutoff)    sigma cutoff value for the list creation [3]
  -f|--field)     validation field to be examined [AVERAGE/RMS/MIN/MAX] [AVERAGE]
  -t|--top)       the top violators [50]
--doit)     create the macro "anal_center_list.cmds"

The "BY_RESID" and "BY_VALID" allow you to switch between the residue order list to the validation list.

Compilations from the source

"" has been generated in order to be able to keep up with a variety of platforms and configurations.

-a/--atom         atom size array>100000<
-m/--map          map size array>30000000<
-r/--reflection   reflection size array>600000<
-f/--makefile     make file name to be created>makefile.example<
-d/--debug        debug flags [ON/OFF]>OFF<
-o/--optimize     optimization level>-O2<
-p/--platform     platform for the make file>makefile.example<

Its purpose is to create makefiles for compilations on a variety of similar or different platforms. It does cover the listed platforms, and it is not a very clever scipt. It does however makes the life easier.

64 bit dialbox driver

Keywords: dialbox

The "O" community has updated the "64" bit linux driver which you can now download also from the MAIN web page (Forwarded by Jan Lowe.)

Use scalepack

The "" script has been generated to extract the cell constants, space group and Fobs and Sigmas from the "SCALEPACK" diffraction data files.

  -h|--help)    prints this message with available options and current status
  -f|--file)    scalepack output file []
  -t|--test)    TEST flag label fraction from the sca file [20]
--doit)    save extracted data in ""
                write cell constants and symmetry operators file

Auto start

The "" can now extract also segment names from the PDB files in the case they have them (CNS and X-plorer users) and write them into the "" for the use by other configuration tools.

Reading multiplle PDB files with multiple confirmations

PDB files with multiple conformations and partial occupancies is read in MAIN. Each additional conformation is stored in a new segment. The second in "B", the third in "C". (Up to 3 multiple conformations are extracted.)

You can also write this out by merging the composit models into a singkle PDB file using the syntax

 write file xx.pdb sele ... end arom pdb multiple

"RE_IMAGE" configuration enhanced

A variety of new options has been included to increase the variability of the "re_image.cmds" macro.
  -h|--help)      prints this message with available options and current status
  -o|--output)    set file name of the created macro [re_image.cmds]
  -a|--atoms)     display atom type style [BALL/NAME/CLASS/CROSS/NONE] [NONE]
  -b|--bonds)     display bond type style [LINE/STICK/NONE] [LINE]
  -c|--color)     starting color index for molecules [160]
  -n|--names)     dislpay by names of segments or chains  [SEGMENT/CHAIN] [SEGMENT]
  -x|--chains)    chain display [STICK/LINE/NONE] [NONE]
  -y|--hydrogens) display [ON/OFF] of hydrogen atoms [ON]
  -i|--increment) increment of next molecule color [5]
  -s|--style)     color styles [WEIGHTS/TYPES/N2C] of molecular images [WEIGHTS]
     --doit)    creates the macro


On validation page there was aproblem with VdW term. Interactions in the "ENERGY" mode included also neighboring atoms.

MAIN 2006(beta release ) September 2007


The G95 version (64 bit) runs faster on 64 bit architecture than the G77.

Flip peptides

Finally flipping of peptides has been included (flip means rotation for 180 degerees.)

Active last

Behavior of the active last option ("ACT_LAST") has been changed. When the "ACT_LAS" is chosen, each time when an atom is clicked the key "active" is redefined to the residue the last clicked atom belongs to.

B-factor refinement

Border term (restraining B-values to the range specified) was lost in some earlier versions.

B_ADD may improve the refinement in general. Default was changed from 12 to 30. However, when average B is already high - like 70 - then B_ADD should be set to 0.

> fourier b_add 0

You will notice the problem if B-overall refine results in an average B-value as high as 70, the individual B-factor refinement however tries to lower it to 30 or so and the BORD energy term keeps kicking in.

Bulk solvent correction term - bug

Due to the wrong order of mask extension and symmetry generation during the bulk solvent mask generation procedure (the mask extension preceeded the symmetry elements generation), the space between symmetry related molecules has not been included in the mask. Since the previous procedure was grid size dependent, its parameters have been now changed to real (floating point) numbers and a new command introduced (and positioned in the "re_phase.cmds").

 make map MAP_MASK bulk \
          ( select segm name SEGMENTS end/usr/local/apache/share/htdocs/dist/ \
            solvent 0.0 fill 1.8 shrink 1.25 )

Bulk solvent correction, B-overall anisotropy optimization targets

Bulk solvent and anisotropic B over scaling have been reinspected and the algorithms modified. No it is possible to choose besides the least sqaure target (R-value minimization) aslo the maximum likelyhood target in both optimizations.

> refl aniso max-like
> refl sele REFL_WORK end r-val ( aniso bulk test TEST )

Image group names

The historical technical titles of images you can click on for removal , include, color, reflect has obtained an additional layer between the label seen in the 3D graphic window and displaying of objects.

After IMAGE GROUP organization is ON then only the names of groups of images appearon the screen and cen be removed or included form the display list.

Some of the macros generate the names automatically (usually from segment names given during the main_config step.) You can however provide your own.

> image group on
> image group name SEG_A
> image group name SEG_B

Anisotropic correction term - bug

Due to (recent) changes the anisotropic correction term has been used twice during the refinement...

MAIN 2006(beta release ) July 2007

G95 1. august

Using Fedora 6 it became obvious that GFROTRAN does not compile MAIN properly. The bug is in IF sentences. G95 Fortran does have however have no problems. Therefore GFORTRAN version has been withdrawn from further distribution.

MAIN 2006(beta release ) June 2007

G77 versus GFORTRAN

GFORTRAN runs back to FEDORA CORE 4, whereas it is not so for the G77, which is gone in most newer distributions.

First I've screwed it up, forgeting that does not exist for non G77 distributions and I have linked it with the executable.

Second, the various versions of GFORTRAN have different library names (versions) and appripritae links should be introduced in the /usr/lib64 directory.

When is missing then this link is necessary

 ln -s

When is missing then this link is necessary

 ln -s

The version on the server has been compiled under FEDORA 7.

MAIN 2006(beta release ) March 2007

Manual is on the way to catch up with the current state of the art of the program. Also home page has been changed.

Perl Tk config

The "" script is a
front end of the "create_.."pl"confing tools"confing tools:
    -h|-help|--help) prints this message with available options and current status
    -m|--macro)     file name of the created macro []

You only need to provide a macro name: -m

The can be invoked directly from the "depp pages" by clicking the right mouse button on configurable menu items ( "RE_IMAGE", "SYMMETRY", "SYMM_CA", "REFINE", "REFINE_B", "GEN_SOLV", and a few more).

"" does not provide a GUI to "" yet.

Auto fit button

"AUTO_FIT" button has been added to the MAIN_MENU:build_resi_auto.html. The button is the beginning of "objective" (userless) automatic model rebuilding.

Currently it is a manually written procedure, it will become configurable in the future.

Bug fixes

The "", which configures the procedure for placing and checking of solvent molecules has been fixed. (MAIN_DOC:gen_solvent/gen_solvent.html).

MAIN 2006(beta release ) February 2007

Current release is MAIN 2006 in its "beta" distribution. It si quite reliable. To fulfill the regular release the multiple model merging procedure has to be finished.

Platform support

PC Linux and Mac (Power and Intel) platforms are supported.

SGI, ALPHA True Unix platforms are not supported any more.

New minimizer

The current minimizer has been replaced by Polak- Ribiere conjugated gradient procedure, which has stunning effects on the robustness and convergence of reciprocal space refinement and real space minimization.

For real space minimization (targeting 2Fo-Fc maps using "ENERGY DENS POLY 2" function) kicks over 1.0A are still manageable. (Previous minimizer tolerated up to 0.3A kicks.)

The reproducibility of the result, the large convergence radius and the speed of the minimization procedure have made possible to declare the model building procedure objective, thus human independent. The role of a user has essentially shrink to the detection of hot spots (atoms landed on the wrong side of peptide bond after substantial kicks, peptide bond and side chain flips as well as cis peptide bond creation). Occasionally user should help to shift a trapped part from the local minima to the one behind.

Actually there is not much difference between the real space minimized structure and reciprocal space structure. On my ferredoxin test case after applying kick of 1.0 the model minimized against the map phased by the originally refined model resulted in R-value of 0.18 essentially equal to the starting model, after fixing one peptide bond which got stuck and was fixed with the "FIX_PEPT" and "FIT_PEPT" functions.

Auto scaling of X-ray, density energy terms versus chemistry terms

It greatly improved stability of minimization and refinement. The scale of X-ray versus chemistry terms is adjusted at each start of procedure and updates . The command "MINI ADJUST" does it:

MAIN>mini adj ?
  (         )         bond      bval_bon  chemistr
  gradient  none      steps     help

It has default values: "BOND" 0.02 for real space and 0.01 for reciprocal space positional refinement and BVAL_BON 2.0 for B-value refinement. Scales are updated each 100 "STEPS" ), meaning that the target values are set to reach the specified sigmas of bond deviations.

It is included in the "create_refine" scripts.

Multi crystal forms: refinement and averaging

Config scripts now cover also cross crystal averaging and refinement using real and reciprocal space target functions. MAIN:doc/2crys/2crys.html. Cross crystal refinement is based on use of Non-Crystallographic-Symmetry restraints.

Enriched keyboard shortcuts

Several new shortcust have been introduced: MAIN_MENU:keyboard.html


The algorith for the "AUTO_WEI" item has been moved from a macro into MAIN source. The process is now much much faster plus the out of denisty "CB" atom does not set weight of ring side chains to 0 anymore.

IMAGES: Connoly surfaces

Kweyword: surfaces

The procedure for generation of smooth solid surfaces based on the Connolly algorith is working properly now. Coloring schemes covering properties (as electrostaic potential) still need to be incorporated.

The simplest way to generate it is via the "GEN_SURF" (MAIN_MENU:image_data.html) on the menu page "IMAGE ("depp_pages.txt") and to display it on the same page using "SURFACE" and "SURF_RGB" itesm of the "IMAGE_DO" menu (""MAIN_MENU:image_do.txt")").

IMAGES: Solid maps

The solid area presentation of maps has been modifed so that the normals provide impression of a smooth surface. Made transparent they seem a better choice of presentation than the usual wire frame way.

Bugs report

Error in energy calculation

The versions form a certain date on - probaly since october 2006 - have a bug in the minimization target function. X-ray and density terms are added twice, therefore the gradients did not correspond to the energy changes and minimization did not really work.

Error in B-value refinement

B-value refinement had a error (unfortunately since it has been introduced into MAIN in the 90s). Radii for the summation of B-value gradients on atoms have been incorrectly estimated. Therefore B-value refinement was choppy and non convergent.

MAIN 2006, alpha release, May

Alpha release is available - for now for LINUX only.

Documentation has mostly not been updated. Rearangements and updates are on the way. Their updates will not be announced.

DEPP pages have two layers

Depp pages have two layers. MAIN_DOC:menu/depp_pages.html

Support of multicrystal averaging

"" scripts support now also multicrystal averaging and refinement.

Removed tools

Menu "main_config" scripts written in "SHELL" command language are history.


Maximum likelyhood maps and target functions are available. Bulk solvent and overall anisotripic corrections are functioning too. See "MAPS" menus on the depp page.

Changes of map contouring levels can be "scrolled" with middle mouse button.

Auto tracing

Main as well as the side chains can be traced automaticaly from a map only. See "TRACE" depp page. Click in the direction from top menu items downwards.


Previous README files:


 Dusan Turk
 Dept. of Biochem. Mol. and Struct. Biol.
 Jozef Stefan Institute
 Jamova 39
 1 111 Ljubljana

 phone +386 1 477 3857
 fax   +386 1 477 3984