Coding tips DOCK 3.7: Difference between revisions

From DISI
Jump to navigation Jump to search
(Created page with " == Adding an INDOCK parameter: == To add an option to the INDOCK file that will be parsed and read into DOCK edit the following files: Add a declaration of the variable th...")
 
Line 24: Line 24:
             options0%dockovalent = .false.
             options0%dockovalent = .false.
         endif
         endif
</code>
== Debugging with pgf ==
On sgehead (or anywhere you have access to the pgf tools), from your run dir, type:
<code> pgdbg .../dock64 </code> where the parameter is the binary result of your compilation
while in the debugger, you can type 'help' to get all available commands.
you can type 'help command'  (e.g. 'help break') to get specific usage for that function.
Below are a couple of useful scenarios:
<code>
pgdbg> run          !run the binary
!-- program segfaults but you don't know where --!
pgdbg> stacktrace ! gives you the call stack to identify the crash site
</code>
<code>
pgdbg> break run_search !set a break point at the beginning of the function run_search
pgdbg> run ! runs until hits break point
pgdbg> s    ! steps through the different functions (use n to skip over function calls)
pgdbg> c    ! continues the run until hits the next break point
</code>
</code>

Revision as of 16:42, 3 April 2014

Adding an INDOCK parameter:

To add an option to the INDOCK file that will be parsed and read into DOCK edit the following files:

Add a declaration of the variable that will contain your parameter to optionstype.f

logical :: dockovalent

Set the default value for your variable in setdef.f

options0%dockovalent = .false.

Parse input value (or keyword value) from INDOCK in dokw.f

   else if (keywrd .eq. 'dockovalent') then
        call tolow(args)
        if (nf .lt. 1) then
           options0%dockovalent = .false. !off by default
        else if (args(1:1) .eq. 'y') then
           options0%dockovalent = .true.
        else
           options0%dockovalent = .false.
       endif

Debugging with pgf

On sgehead (or anywhere you have access to the pgf tools), from your run dir, type: pgdbg .../dock64 where the parameter is the binary result of your compilation while in the debugger, you can type 'help' to get all available commands. you can type 'help command' (e.g. 'help break') to get specific usage for that function. Below are a couple of useful scenarios:

pgdbg> run !run the binary !-- program segfaults but you don't know where --! pgdbg> stacktrace ! gives you the call stack to identify the crash site

pgdbg> break run_search !set a break point at the beginning of the function run_search pgdbg> run ! runs until hits break point pgdbg> s  ! steps through the different functions (use n to skip over function calls) pgdbg> c  ! continues the run until hits the next break point