Personal tools
You are here: Home FAQs & Help How-tos How to compile autodock as native 64 bit windows application
Document Actions

How to compile autodock as native 64 bit windows application

This How-to applies to: AutoDock 4
This How-to is intended for: User, Developer

This Guide explains the compilation of the autodock software, resulting in the executable that will be executed faster than the standard 32 bit application. To use the resulting faster application you will need 64 bit Windows installed such as Windows 7 X64, Windows Vista X64, Windows XP X64 or Windows Server X64.
Please note, that as of today (2010-01-21) the resulting application should be used only for test purposes, as it has not been oficially tested yet. Please help us and compare results with the 32 bits one and share your experience

Why bother?

Well, because it will speed up execution with minimal effort! Why compiling autodock as native 64 bit application will make it faster?

All modern Intel and AMD CPUs (starting from Pentium 4 and Opteron chips) have new 64 bit mode, activated on 64 bit OS such as Windows 7 X64, Windows Vista X64, Windows XP X64 or Windows Server X64.

When activated, applications compiled as 64 bit can use new features of CPU and OS such as:

  1. Doubled number of registers. In x64 mode CPU has not only wider (64bit) registers, but has also double number of them - 16 instead of 8. C++ compiler and optimizer uses extra registers to decrease numeber of stack operations, which are much slower. Register usage is an order of magnitude faster than usage of the CPU cache and memory.
  2. Number of SSE registers (used for vector operations) are doubled, but I am not sure if those will be used by compiler.
  3. Compiler uses SSE for floating point operations which are slightly faster than x87 operations.
  4. OS calls are using faster calls that use arguments stored in registers instead of stack.
  5. 64 bit windows run 32 bit application in emulated mode called WOW64. It eats around 2% of application speed. By compiling native 64bit application this emulation is gone.

So all in all there will be speed increase, similar applications get up to 15-20% of speed increase just by 64 bit recompilation. People recompiling Autodock for Linux in 64bit got 10-15% speed improvement. I had not performed speed increase tests yet, I am looking for test cases to perform the accuracy and speed tests. Please drop by in Forum section and find 64 bit thread if  you would like to provide tests or help in testing 64 bit windows autodock.

Tools needed

Some background information: CygWin environment emulates Unix like environment on windows. It is able to compile autodock, but only in 32 bit mode. To compile 64 bit native application you will need mingw-w64. The mingw has only subset of full unix compilation environment, so we will need also some small tricks to let it compile autodock.

  1. Download CygWin environment by executing setup installer from I have used 1.7.1 version. When started, select Install from Internet, leave default route C:\cygwin and Install for all user option as selected. Select download site (for me the portugeese .pt server was the quickest one), and let it discover all packages by presssing next. Select at least: Admin, Devel, Shell, System. Let it download and install all. This environment will be actually used only for the scripts to be able to run, actual compilation will be done using the next tool.
  2. Download mingw-w64 environment by downloading the package. I have used mingw-w64-bin_x86_64-mingw_20091224_sezero. At the moment the newest one is: Unpack it to C leaving directory C:\mingw64.
  3. We must be sure that commands from MingW will be executed by system instead of the ones in the cygwin in your PATH environment variable. Go to System/Properties/Advanced System settings/Environment Variables, select PATH and change the sequence, so that MINGW Bin will be before Cygwin. On my PC it is set as: "<here all other paths are listed>;C:\mingw64\bin;C:\CYGWIN\BIN". Modify C:\cygwin\etc\profile file to have: "PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin". This to be sure that cygwin bin will be taken in to consideration only AFTER the paths define is System PATH variable, that we modified before.

Preparing the compilation

The MINGW compiler is missing some of the methods that autodock uses. Those methods may be easilly replaced with other calls. I opted to keep autodock source code without any modification, and instead modify .h files used by mingw to define those missing functions. This way I am sure that I will not destroy the autodock algoritm. You can also change autodock source code directly using the replacement methods that I used in .h.

NOTE: Mingw will use include from it´s directory NOT the ones from the CYGWIN.

1. Sys/times.h

Entire file and its methods is missing. I reused the general file structure from cygwin, and then defined the missing times() method as:

---begin ---

//clock_t _EXFUN(times,(struct tms *));

 __CRT_INLINE clock_t __cdecl times( struct tms *buffer )


buffer->tms_utime         = clock();

buffer->tms_stime         = clock();

buffer->tms_cutime = clock();

buffer->tms_cstime = clock();

return clock();


--- end ---

As you can see, we always return the current time. Autodock uses only the return value and only to calculate the difference between two point times, so you can also replace call to times() direclty by clock() method.

2.  In file Unistd.h:

add the following missing code

--- begin ---

#include <sys/locking.h>


#include <time.h>

#define _SC_CLK_TCK 1


__CRT_INLINE long sysconf(int name)


if(name == _SC_CLK_TCK)


return CLK_TCK;




//printf("Only _SC_CLK_TCK can be used in simulated sysconf");





#ifdef __MINGW32__


#include <windows.h>

//int gethostname_mingw (char *, size_t);


__CRT_INLINE int  __cdecl gethostname_mingw (char *name, size_t len)


  DWORD dlen = len;

  return (GetComputerName (name, &dlen) ? 0 : -1);


#define gethostname gethostname_mingw


--- end --- 


3. In file  locking.h

/* mappings for lockf */


#define lockf _locking


#define F_ULOCK _LK_UNLCK /* Unlock locked sections. */
#define F_LOCK  _LK_LOCK  /* Lock a section for exclusive use. */
#define F_TLOCK _LK_NBLCK /* Test and lock a section for exclusive use */
#define F_TEST  _LK_RLCK  /* Test section for locks by other processes. */


Edit the file, to force 64 bit compilation. Add -m64 to line with: "AM_CXXFLAGS = -m64 -O3 -Wall -Wno-write-strings # increase compatibility \

with pre 4.x compilers for string handling".

Now that we have all setup, lets compile.

  1. Open Cygwin console, from the cygwin icon on your desktop. cd to the directory where the autodock source code is.
  2. type "./configure" . This will recreate file, used when compiling. It will use the line that we changed and pass -m64 parameters to the

  3. type "make" . This will compile the application.

Thats it, the resulting exe will be native 64 bit application and will work only under 64 bit windows.

Next steps

The natural step would be to improve Autodock source code to use more common methods instead of the old ones. For example use clock() instead of times().

Other possibility is to use this guide and compile 64 bit Vina application to speed it up even futher.

I would be happy to provide modified source code and compiled application for others to use it or test.

by Wojciech — last modified 2010-01-22 06:32

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: