finding matches between multiple files from different directories

Hi all...
Can somebody pls help me with this...
I have a directory (dir1) which has many subdirectories(vr001,vr002,vr003..) with each subdir containing similar text file(say ras.txt).
I have another directory(dir2) which has again got some subdir(vr001c,vr002c,vr003c..) with each subdir containing three text files(r1.txt,r2.txt,r3.txt).
Now i want to do something like this for all the subdirectories in dir1:

comm -12<(ls ~/dir1/sub1/ras.txt) <(ls ~/dir2/sub1c/r1.txt)
comm -12<(ls ~/dir1/sub1/ras.txt) <(ls ~/dir2/sub1c/r2.txt)
comm -12<(ls ~/dir1/sub1/ras.txt) <(ls ~/dir2/sub1c/r3.txt)

(i do not know if its right!!)
I have two questions:
1)How to find the matched lines in the two text files
2) How to pipe the corresponding output to a new file(eg. newr1.txt,newr2.txt,newr3.txt) for all the subdirectories in dir1.
NOTE: the names of the subdirectories in dir1 and dir2 are similar(eg: vr001 and vr001clusters)

Pls help me!!

Sample content of files:

ras.txt

#!rasmol -script
zap
load inline
select all
exit
HEADER    Model of O957                 
REMARK 220  SCORE:       0.92                          
REMARK 220 ZDOPE:                       -0.7                          
REMARK 220 EVALUE:                               0                    
REMARK 220 TEMPLATE PDB:                2g38                          
REMARK 220 TEMPLATE CHAIN:              B                             
REMARK 220 TARGET LENGTH:               409                           
ATOM      1  N   PHE     1       9.735  29.148  72.991  1.00 41.06       1SG   2
ATOM      2  CA  PHE     1      10.609  27.961  72.870  1.00 41.06       1SG   3
ATOM      3  CB  PHE     1       9.958  26.763  73.577  1.00 41.06       1SG   4
ATOM      4  CG  PHE     1       9.871  27.129  75.019  1.00 41.06       1SG   5
ATOM      5  CD1 PHE     1      10.985  27.086  75.826  1.00 41.06       1SG  6
ATOM      6  CD2 PHE     1       8.667  27.510  75.564  1.00 41.06       1SG   7
ATOM      7  CE1 PHE     1      10.893  27.426  77.157  1.00 41.06       1SG  8
ATOM      8  CE2 PHE     1       8.570  27.850  76.893  1.00 41.06       1SG   9
ATOM      9  CZ  PHE     1       9.687  27.810  77.693  1.00 41.06       1SG  10
ATOM     10  C   PHE     1      10.823  27.638  71.429  1.00 41.06       1SG 11

r1.txt

ATOM      1  N   PHE     1       9.735  29.148  72.991  1.00 41.06       1SG   2
ATOM      2  CA  PHE     1      10.609  27.961  72.870  1.00 41.06       1SG   3
ATOM      3  CB  PHE     1       9.958  26.763  73.577  1.00 41.06       1SG   4
ATOM      4  CG  PHE     1       9.871  27.129  75.019  1.00 41.06       1SG   5
ATOM      6  CD2 PHE     1       8.667  27.510  75.564  1.00 41.06       1SG   7
ATOM      8  CE2 PHE     1       8.570  27.850  76.893  1.00 41.06       1SG   9
ATOM      9  CZ  PHE     1       9.687  27.810  77.693  1.00 41.06       1SG  10
ATOM     10  C   PHE     1      10.823  27.638  71.429  1.00 41.06       1SG 11
ATOM     11  O   PHE     1      11.653  26.802  71.077  1.00 41.06       1SG 12
ATOM     14  C   GLY     2      11.511  28.683  68.741  1.00 34.54       1SG 15
ATOM     15  O   GLY     2      12.041  28.302  67.700  1.00 34.54       1SG 16
ATOM     16  N   ALA     3      12.083  29.612  69.526  1.00 22.67       1SG 17
ATOM     17  CA  ALA     3      13.389  30.104  69.204  1.00 22.67       1SG18
ATOM     20  O   ALA     3      15.218  28.819  68.407  1.00 22.67       1SG 21
ATOM     21  N   LEU     4      14.259  28.124  70.328  1.00 86.18       1SG 22