difference_matrix 1.1

REQUIREMENTS: VMD Version 1.7 or greater 
        (new version uses uses lsort now instead of TclX luniq)

	This makes a matrix of all center of mass distances between
	the individual residues of two proteins.  It saves the
	output to a file in the format
		residue_id1 residue_id2 distance
	The input options are:
		sel1 -- the first set of atoms to compare (the
		        reference atoms)
		sel2 -- the second set of atoms (the comparison atoms)
	    filename -- the output file name (the default is "diffplot.dat")
        Because one will usually like to compare all the residues of
	two systems, a simple interface to difference_matrix is
	also included.  This interface is called whole_difference_matrix
	and it takes as arguments the two molecule ids to compare.
	See examples below for usage.

	difference_matrix - calculates the difference matrix between
			    the residues specified in two selections
	whole_difference_matrix - calculates the difference matrix
			    between the residues of two specified

	If you have only two loaded molecules, then they will have ids
	0 and 1.  Then the following computes the difference matrix
		whole_difference_matrix 0 1
	Suppose instead you wanted to be more specific; you want the
	distance matrix between segment A of the first molecule and
	segment QQ of the second.  Then you'll have to use the atom 
	selection command, which is fully described in the VMD manual.
		set sel1 [atomselect 0 "segname A"]
		set sel2 [atomselect 1 "segname QQ"]
		difference_matrix $sel1 $sel2
	If you want the output saved to the file "output.matrix" then
	change the last line to
		difference_matrix $sel1 $sel2 output.matrix
	If you want to compute the difference matrix between the
	first and last frames of a protein after a complete MD trajectory
	has been loaded into molecule 4, 
		set first_frame [atomaelect 4 "protein" frame first]
	        set last_frame [atomselect 4 "protein" frame last]
	        difference_matrix $sel1 $sel2 trajectory_difference.dat]

        The final output file can be viewed using a plotting package
        such as Gnuplot.  The sequence of commands to load the output in
        gnuplot is:   
           set parametric
           set data style points
           splot "diff_matrix.data"


	Andrew Dalke (dalke@ks.uiuc.edu)