.. include:: ../substitutions
.. include:: ../../apps-substitutions

.. _coot_install:

.. program:: coot 

***************************
Installing Coot Interface
***************************

====
Coot
====

The coot script file "flynn.scm" is included in your FLYNN
distribution in the "etc" directory.  The following steps are
required to integrate FLYNN with coot.

The current default version of COOT is 0.9.5, to install another
version please look for the files with the appropriate extension.

1. Install coot (at least version 0.3.3)

2. Install flynn and writedict somewhere in your path.  
   If you can't run FLYNN from the command line, neither can Coot.

3. Place *flynn.scm* to the coot extensions directory.  This is
   the directory where the files *extensions.scm* and *coot.scm*
   are located.

   This directory may be one of the following:

    /usr/local/coot/scheme
    /usr/local/xtal/coot64/share/coot/scheme/
    /my_coot_installation/share/coot/scheme/
    /ccp4-7.0/share/coot/scheme/ for the cpp4 installation

   on OSX the install for Coot 0.7/0.8 is most likely
     /Library/Coot/share/coot/scheme/

   Typing **which coot** may help locate these directories.

4. Copy *flynn.scm* to the extension list in *coot.scm* which is
   in the same directory as *extensions.scm*.  Please use the
   appropriate file for your version of coot.

   To accomplish this, change the following code in *coot.scm* for coot 0.7

   .. code-block:: scheme

     (define load-all-scheme
       (lambda (use-gui?)
         (let ((pre-list (list "filter.scm" 
			  "coot-utils.scm"))
              (post-list (list "coot-lsq.scm"
                               "shelx.scm"

   to look like this:

   .. code-block:: scheme

     (define load-all-scheme
       (lambda (use-gui?)
         (let ((pre-list (list "filter.scm" 
                "coot-utils.scm"))
                (post-list (list "coot-lsq."
                                 "shelx.scm"
                                 "flynn.scm"

5. Finally, make the following changes to *extensions.scm*

   For coot 0.3.3 to 0.5 near the top of the file, change:

   .. code-block:: scheme

     (if (defined? 'coot-main-menubar)
        (let ((menu (coot-menubar-menu "Extensions")))

   to become:

   .. code-block:: scheme

    (if (defined? 'coot-main-menubar)
       (let ((menu (coot-menubar-menu "Extensions")))
         (add-simple-coot-menu-menuitem menu "Flynn..."           
           (lambda () (do-flynn-gui)))
         (add-simple-coot-menu-menuitem menu "Make Dictionary..." 
           (lambda () (do-flynn-gendict-gui)))
        (add-simple-coot-menu-menuitem menu "Fit Sidechains..." 
           (lambda () (do-flynn-fitsidechains-gui)))


   For coot 0.6.x, near the top of the file, change:

   .. code-block:: scheme

     (if (defined? 'coot-main-menubar)
         ;; ---------------------------------------------
         ;;           extensions
         ;; ---------------------------------------------
         ;; 
        (let ((menu (coot-menubar-menu "Extensions")))

   to become:

   .. code-block:: scheme

    (if (defined? 'coot-main-menubar)
         ;; ---------------------------------------------
         ;;           extensions
         ;; ---------------------------------------------
         ;; 
      (let ((menu (coot-menubar-menu "Extensions")))
         (add-simple-coot-menu-menuitem menu "Flynn..."           
           (lambda () (do-flynn-gui)))
         (add-simple-coot-menu-menuitem menu "Make Dictionary..." 
           (lambda () (do-flynn-gendict-gui)))
        (add-simple-coot-menu-menuitem menu "Fit Sidechains..." 
           (lambda () (do-flynn-fitsidechains-gui)))


   For coot 0.8 you should make the change to the "Modules"
   section as shown below:

   .. code-block:: scheme

	;; ---------------------------------------------------------------------
	;;     Modules
	;; ---------------------------------------------------------------------

        (add-simple-coot-menu-menuitem
         submenu-modules "Fit Ligand..."
         (lambda ()
           (do-flynn-gui)))

        (add-simple-coot-menu-menuitem
         submenu-modules "Make cif..."
         (lambda ()
           (do-flynn-gendict-gui)))

        (add-simple-coot-menu-menuitem
         submenu-modules "Fit sidechains..."
         (lambda ()
           (do-flynn-fitsidechains-gui)))

================
WinCoot 0.9.4.1+
================

WinCoot does not support writing extensions in GUILE.  Extensions may
be written in PYTHON, however.

The WinCoot scheme script file *flynn.py* is included in your FLYNN
distribution in the *Data/wincoot* directory.  The
following steps are required to integrate FLYNN with *WinCoot*.

1. Install *WinCoot* (at least version 0.9.4.1)

2. Install flynn and writedict somewhere in your path.  If you can't run FLYNN
   from the command line, neither can *WinCoot*.

3. Place this file *flynn.py* in the coot extensions directory where
   *extensions.py* is located.

   Typically, this directory is C:\\WinCoot\\lib\\python-2.7\\site-packages\\coot.

4. Add *flynn.py* to the extension list in *coot_load_modules.py*.
   (same directory as above) *before* *extensions.py*

   For example:

   .. code-block:: python

      ...
      "get_recent_pdbe.py",
      "flynn.py",
      "extensions.py",
      ...


5.	Modify the file named enhanced_ligand.py 

   To add Flynn and MakeDict, find the last menu item in enhanced_ligand.py and add the following menu items below it:

   .. code-block:: python

      add_simple_coot_menu_menuitem(menu, "Use Flynn to Fit Ligand...", lambda func: do_flynn_gui())
      add_simple_coot_menu_menuitem(menu, "Use WriteDict to generate CIF...", lambda func: do_writedict_gui())

   For example, if "Display Ligand Distortions" is the last menu time, it would look like this:

   .. code-block:: python

      add_simple_coot_menu_menuitem(menu, "Display Ligand Distortions", lambda func: display_ligand_distortions_func())
      add_simple_coot_menu_menuitem(menu, "Use Flynn to Fit Ligand...", lambda func: do_flynn_gui())
      add_simple_coot_menu_menuitem(menu, "Use WriteDict to generate CIF...", lambda func: do_writedict_gui())

   This results in the Ligand menu being updated to include Flynn's functionality


========================
WinCoot 0.3.3 to 0.8.9.2
========================

WinCoot does not support writing extensions in GUILE.  Extensions may
be written in PYTHON, however.

The WinCoot scheme script file *flynn.py* is included in your FLYNN
distribution in the *utilities/flynn/wincoot* directory.  The
following steps are required to integrate FLYNN with *WinCoot*.


1. Install *WinCoot* (at least version 0.3.3)

2. Install flynn and writedict somewhere in your path.  If you can't run FLYNN
   from the command line, neither can *WinCoot*.

3. Place this file *flynn.py* in the coot extensions directory where
   *extensions.py* is located.

   Typically, this directory is *C:\WinCoot\share\coot\scheme*.

4. Add *flynn.py* to the extension list in *coot\_load\_modules+gui.py*.
   (same directory as extensions.py) *before* *extensions.py*

   For example:

   .. code-block:: python

      "coot-gui.py",
      "flynn.py",
      "extensions.py",


5. Add the following lines to the file named extensions.scm (this
   will be in your coot distribution) 
  
   The easiest place to put this right after the line

   .. code-block:: python

       menu = coot_menubar_menu("Extensions")


   here are the lines to add:

   .. code-block:: python

       add_simple_coot_menu_menuitem(menu, "Fit Ligand...", do_flynn_gui)
       add_simple_coot_menu_menuitem(menu, "Make CIF...", do_writedict_gui)
       add_simple_coot_menu_menuitem(menu, "Fit Sidechains...", 
         do_fitsidechains_gui)
