diff --git a/tracy/tools/soltracy.cc b/tracy/tools/soltracy.cc
index 647db9fa33699b2099fff2c731588ee6bcd69543..a07b1768e8333af501bdec49f5f909c2fc752812 100644
--- a/tracy/tools/soltracy.cc
+++ b/tracy/tools/soltracy.cc
@@ -711,6 +711,49 @@ int main(int argc, char *argv[]) {
       fclose(outf);
     }
 
+  }
+  
+  /*
+To do ID correction.
+Based on parts of functions get_param( ) & ID_corr(), etc in nsls-ii_lib.cc 
+*/
+  else if(strcmp(CommandStr,"IDCorrFlag") == 0) {
+   
+    int k = 0;
+  
+  printf("Begin ID matching:................ \n");
+    
+  // read the family index of quadrupoles used for ID correction
+    if (N_calls > 0) {
+      if (N_Fam > N_Fam_max) {
+        printf("get_param: N_Fam > N_Fam_max: %d (%d)\n",
+	       N_Fam, N_Fam_max);
+        exit_(0);
+      }
+
+    for (k = 0; k < N_Fam; k++)
+      Q_Fam[k] = ElemIndex(IDCq_name[k]);
+    }
+
+    // ID correction
+    for (int k = 0; k < 11; k++)
+    printf("%d\n",Q_Fam[k]);
+
+
+    ini_ID_corr();
+    printlatt("linlat00.out");
+
+    ID_corr0();
+    printlatt("linlat01.out");
+
+  // exit(0);
+
+    ini_ID_corr();
+    printlatt("linlat0.out");
+
+    ID_corr(N_calls,N_steps);
+    printlatt("linlat1.out");
+
   }
   else
     printf("Wrong!!!!!");