Personal tools
Document Actions

Change Current Working Directory

This How-to applies to: Any version.
This How-to is intended for: Any audience.

Explains how to find and change current working directory.

To print current working directory, open a Python shell window, type the following command and hit Enter or Return:


To change working directory to, for instance, /home/foo/bar use:


Consult os module for more info on how to use these functions.

Changing working directory using application shortcuts

Your current working directory depends on how you started ADT and what have you done after. If you just started ADT, click on first button off the Toolbar () or use File → Read Molecule menu to open a file browser that shows files and folders in the current working directory. This directory is your default startup directory and there are a number of ways you can change a startup directory. When you start ADT from a command line shell, your startup directory, is your current working directory. If, on the other hand, you start ADT using Desktop/Application shortcut -- your startup directory depends on your Operating System.

Windows Users Linux Users
Right-click on ADT shortcut icon and select Properties. Enter full path for Start in: Right-click on ADT shortcut icon and select Properties. Enter full path for Work path:ADT_Desk_Linux.png

Mac Users

Control-click on AutoDockTools icon and select Show Package Contents. Navigate to Contents → Resources → Scripts and double-click on main script. Scroll down to the bottom until you see:

cd ~;
Replace ~ with the full path. Click on File → Save menu when done.

User Preferences - Startup Directory

UserPref.png You can also modify default Startup Directory using File → Preferences → Modify Defaults menu in ADT. Scroll down and type the full path under Startup Directory. When you click on Set, your current working directory is changed using os.chdir function (see  below). If the path does not exists, you'll be presented with Directory Chooser. Hint: you can intentionally type wrong path and press Set, if the path you are trying to reach is hard to type.
When you click on make default button, in addition to changing current working directory, the Startup Directory is changed too. This is because of a code similar to this one that is added to your _pmvrc file  located in ~/.mgltools/1.4.6/Pmv:

self.userpref.set('Startup Directory', '/home/foo/bar',)

Note that, no matter where you start ADT next time, if you clicked on make default button, your Startup Directory will change. If you'd rather change Startup Directory using one of the methods described in the beginning of this how-to, remove this code from your _pmvrc using your favorite text editor.

by Sargis Dallakyan last modified 2009-04-01 09:33 Molecular Graphics Laboratory, TSRI

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: