This is a sample CHAIN session. It contains a few simple instructions, enough to get you started using chain. Comments are in italics and are NOT to be typed into the program!
% setup chain
% chain

it will ask for a session file.  If this is the first time you have used 
the program, or want to start a new session, then give it a new session 
name.  Otherwise, enter the name of an existing session to pick up where 
you left off.  Here we start a new session


>>> example.sess
>>> disp 1           set up the first display, there can be up to 4 which
                      you can toggle on and off

>>> file example     it will create a file called example.atm

>>> expand 10000     add space for an extra 10000 residues, as this is
                      a huge protein.  For a small protein, you may not 
                      need this.
>>> read file whatever.pdb
                     read in an existing PDB file.  If the program
                      complains that there isn't enough space, use the 
                      expand command again.
>>> range all        select the entire thing
>>> list res all     show all residues, note the naming convention
>>> center 55        center on residue number 55
>>> show             pop up the display.  The program will take complete 
                      control of the screen - you can't easily drop into
                      another application.  Select options with the CENTER
                      mouse button.  Click on TERM to get back to the 
                      terminal window.

                      Options are color coded:
                        Yellow = you may select this
                        Grey   = you may not select this
                        Green  = you MUST select on of these to exit the 
                                 current mode

                      The small menu on the left has a big button on top.
                      Click on it to toggle through different 
                      interpretations of what the dials do.

                      There are a set of buttons along the bottom, they
                      change the "mode", so for instance, if you click on 
                      MAPS it will then redo the buttons so that you can 
                      toggle maps on and off.

click on an atom with the center button
click on CENTER - the molecule is centered on that atom

click on two atoms
click on BOND - forms a bond if none present, breaks a bond if present

click on TERM to go back to the text window

now make a mutation

>> replace 55 TYR   mutate 55 to a TYR
>> zone 55          select just this residue
>> reg              fix up all the atoms in it - when you mutate a
                     residue you usually add atoms which are new, so 
                     their positions must be forced, that's what reg,
                     short for regularize, does here.
>> zone 52 62       select a region around the new residue
>> anchor 52 62     lock the ends down, this is optional
>> reg              regularize the bonds and bond angles.  Fixes up 
                     problems that the mutation might have caused along the
                     chain.
>> show             to see the changes, then click on TERM
>> current display 1 
                    show what is in display 1

Now turn on some maps to go with this model.  (Normally, of course,
you would start with maps and build the model, but map operations are
shown later here because many people will use CHAIN primarily for modifying
existing models, not building new ones de novo.)

>> map 1            
                    now load some maps
MAP_1>> file junk
                    map will be stored in file JUNK
MAP_1>> read map.xplor xplor
                    load XPLOR map data into program and JUNK
MAP_1>> level 1.0 color blue volume 20 20 20
                    how to draw the map in the display
>> map 2 file junk  all map commands can go on one line
                     no need to read it from XPLOR map as it is
                     already stored in JUNK
MAP_2>> level 2.0 color red volume 20 20 20
                    draw another map represntation
>> show             look at the maps, not in the right place? Click on 
                     TERM
>> center 25 30 -14 position in Angstroms
>> show             see if this is better

Now for a few more modeling commands, click TERM to get back to the 
interactive window.  Here we're going to begin modeling a new strand.
We already know the sequence of this strand, and we have previously 
entered this text into a file "make_bstrand.txt"

insert START B105 gly
insert START B104 his
insert START B103 tyr
insert START B102 ile
insert START B101 pro

(Note that these are inserted in reverse order using START as the name
of the residue immediately before the residue to be inserted, otherwise,
to build out in order, it would have been like this:

insert START B101 pro
insert B101  B102 ile
insert B102  B103 tyr
insert B103  B104 his
insert B104  B105 gly )

Then cause these commands to be executed with


>> @make_bstrand.txt
>> moveatom B103 20 30 40
                    Move one atom to about where it should be
>> zone B101 B105   Select the whole strand
>> anchor B103      Lock the one residue that is in the right plac 
>> regularize       Drag the lot ofthem over to where B103 is 

For subsequent moves of an entire strand use the MENU command 
FRAGMENT, which causes all residues/atoms attached to the one that is 
selected to move with it as a unit.


Most model changes are performed using the MENU options.  These let 
you break and form bonds, rotate around bonds, and so forth.  When you are 
done hit TERM to return to the interactive window, then do.

>> writeatoms FILE alldone.pdb FORMAT PDB RANGE all
                    write out all parts of the model
>> end              end the chain session