Installing MAIN

Executable files have abbreviations related to hardware and operating system:

Two files need to be downloaded:

In order to install MAIN, create a directory where MAIN shall reside:

> mkdir MAIN
> cd MAIN

"Untar" the downloaded "main_distribution.tar.gz" and gunzip the executable files into that directory.

> tar -zxvf main_distribution.tar.gz
> chmod 755 mainps*.gz

Addopt the "login_BASH" or "login_CSH" files using a text editor like Emacs.

for the first time users:

> cp login_BASH login_BASH_by_own
> cp login_CSH login_CSH_my_own

edit the login files for BASH environment. These environments need to be properly assigned. (I use /usr/local/progs/ for scientific software depository.) Note that LINUX and OSX require different "login_BASH..." files.


 export MAIN

 export PURY
 export PURY_EXE


alias mainps=$MAIN"mainps_2019.exe_LINUX_GFORT"

Compiling from the source using appropriate makefile. Choose the appropriate one in the source directory.

alias lgf='make -f $MAIN"source/makefile.LINUX_G95-64"

for CSH

> emacs login_CSH

setenv MAIN /disk/username/main/

then define appropriate aliases for the executables to be used:

alias mainps  $MAIN"mainps_2019.exe_LINUX...."

for compilation from the source

alias l95 'make -f $MAIN"source/makefile.LINUX_GFORT-64"

Integrate the "login_BASH" or "login_CSH" files into your working environment. BASH and CSH users insert appropriate line

 source /disk/username/main/login_BASH_my_own
 source /disk/username/main/login_CSH_my_own

into your local startup file. For personal installations this would be in ".bashrc" or ".cshrc" files, wheres for a larger user community the system manager will normally provide other solutions.

Reopen your command line terminal for the settings to take effect.

Now try to run to see if there are shared libraries missing from your installation.


On LINUX you need gfortran, X11, OpenGL libraries installed.

How to start a MAIN session is described in the MAIN_DOC:documentation.HTML

Configurations for specific platforms

Advices for LINUX

Use accelerated drivers. The graphics drivers that come with the system are unsuitable for work.

NVIDIA or ATI cards are in general OK. I used to preffer the ATI cards due to higher quality line antialiasing. However, recently ATI drivers cased too many installation problems in so that the ability to install a driver is now the major factor of choice - so I preffer NVIDIA.

Stereo works where ever it is supported.

If you have SG dials you can use them XFree 4.2 based X11 server.


If you have problems compiling the module get it from the anonymous server as well.


and copy it to the proper location:

 chmod +x dialbox_drv.o
 cp dialbox_drv.o /usr/X11R6/lib/modules/input/dialbox_drv.o

Macs (Apple computers)

MAIN is compiled for INTEL processors in 64 bit architecture

Compiling from the source

For the following platforms makefiles are made available in the source directory.


make -f my_makefile

will create a "new.exe_LINUX_GFORT-64", which you can rename to your favorable pet name you use for main.

GFORTAN can be used to, it does create some instability of the executable, due to the different compilation of the "if" statements.

Tk Perl

The Perl-Tk package (Tk-804.030.tar.gz or higher) needs to be installed in order to be able to configure your working environmnet using a Tk based GUI. (You can download from It works on MACs as well as on LINUX distributions. The 64bit architecture requires change of the library path "/usr/X11/lib" into "/usr/X11/lib64". The simplest way is to edit the "Makefile".

When not provided by your system, you can install it through CPAN.

 perl -MCPAN -e shell
 ...   (accept defaults)
 install Tk

or use "yum" or similar

 yum install perl-Tk

On many system including MAC OS X Tk installation exists with an error. In such cases do not use CPAN to install the Tk library. Instead download the tgz file, compile it, disregard the test out come and install it.

 perl Makefile.PL
 make install

occasionally the "Perl:LWP" module is missing and can be installed via CPAN.

 perl -MCPAN -e shell
 install LWP

Auxiliary software

These additional sofwtare needs to be in your PATH. (See also the main page "other used programs".)

The "FatCat" and "CE" need their own environment "CE_SUPERIMPOSE". This way it is set in the "login_BASH":


You can get "FatCat" and "CE" from"

In order to run them from MAIN "superimpose", the original macros "" and "" have to be modified accordingly:



 java -Xmx500M -cp $cpath $args

The graphic renderes you can find at: -<A HREF= TARGET="_blank>Rendering with RASTER3D</A> -<A HREF= TARGET="_blank>Rendering with POV-Ray</A>

Array sizes

MAIN use dynamical memory allocation. Default MAIN has allocated memory for 100 000 atoms, whereas maps and structure factors are allocated on the fly.

The show size command gives you the sizes of data arrays:

MAIN> show size
 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 ....     17009

From the listed only the number of maps is fixed to 10.

The array sizes can be modified also from the MAIN command line:

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

You can start MAIN with the modified sizes of ATOM and RESIDUE arrays

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

 $ mainps --atoms 500000 residues 40000

Tailoring your own documentation scripts

Documentation is part of your local distribution. The file tree is in a main/doc/.

The MAIN documentation is stored in the main/doc directory. Original files are editable ASCII text files "*.txt" and "*.HTML" found in the doc directory. They are converted via "Makefile" scripts into LaTeX (*.tex) and HTML *.html" files. You may wish to modify these scripts as well as documentation files. The command

> make

creates all missing ".tex" and ".html" files from their ".txt" and ".HTML" files,

> make latex

creates three dvi files via LaTeX (users_guide.dvi, dialog_manual.dvi, ref_manual.dvi) and converts them into corresponding PostScript files. The three major LaTeX files are users_guide.tex, dialog_manual.tex and ref_manual.tex. Their headers assign the main character and page sizes. If you have LaTeX installed on your system and you are not satisfied with the page size or anything else you may create the 'ps' files explicitly with other tools.

> make latex_US

is an adaptation of 'make latex' which creates 'ps' files in the US letter size on the basis of users_guide_US.tex, dialog_manual_US.tex and ref_manual_US.tex. The 'US.tex' files are created with a different head (latex_head_US.txt) in front of the LaTeX manual structure file (as is users_guide.txt). So all you have to do it to create your 'heads' and correspondingly modify the 'Makefile'.

> make clean

will delete every file that can be derived from the originals via the to_tex converters, LaTeX and dvips. (If you are using dvi2ps adapt the 'Makefile'.)