PARGEN and supporting routines corrected so that ex01.f and ex03.f are correctly...
authorilb@NIH.GOV <ilb@NIH.GOV@ba61647d-9d00-f842-95cd-605cb4296b96>
Wed, 7 Feb 2018 20:06:11 +0000 (20:06 +0000)
committerilb@NIH.GOV <ilb@NIH.GOV@ba61647d-9d00-f842-95cd-605cb4296b96>
Wed, 7 Feb 2018 20:06:11 +0000 (20:06 +0000)
git-svn-id: https://citdcbmipav.cit.nih.gov/repos-pub/mipav/trunk@15363 ba61647d-9d00-f842-95cd-605cb4296b96

mipav/src/gov/nih/mipav/model/algorithms/SymmsIntegralMapping.java

index 5bf635c..2fde9c7 100644 (file)
@@ -445,6 +445,7 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                String SIG[] = new String[] { "7", "8", "9", "10", "11", "12", "13", "14", "15", "16" };\r
                String WID[] = new String[] { "15", "16", "17", "18", "19", "20", "21", "22", "23", "24" };\r
                String REDD;\r
                String SIG[] = new String[] { "7", "8", "9", "10", "11", "12", "13", "14", "15", "16" };\r
                String WID[] = new String[] { "15", "16", "17", "18", "19", "20", "21", "22", "23", "24" };\r
                String REDD;\r
+               boolean writeReturn;\r
                // String FMT1;\r
                // String FMT2;\r
 \r
                // String FMT1;\r
                // String FMT2;\r
 \r
@@ -700,6 +701,7 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                                RGM[GMCO - 1] = Y;\r
                                        }\r
                                        for (J = 1; J <= 2; J++) {\r
                                                RGM[GMCO - 1] = Y;\r
                                        }\r
                                        for (J = 1; J <= 2; J++) {\r
+                                               // With spaces the output is correct but put on multiple lines.\r
                                                if (J == 1 && TYPE == 3) {\r
                                                        System.out.println("ENTER JAVA EXPRESSION WITH NO SPACES ENDING IN // FOR PARFUN");\r
                                                        System.out.println("PUT REAL PART ui IMAGINARY PART");\r
                                                if (J == 1 && TYPE == 3) {\r
                                                        System.out.println("ENTER JAVA EXPRESSION WITH NO SPACES ENDING IN // FOR PARFUN");\r
                                                        System.out.println("PUT REAL PART ui IMAGINARY PART");\r
@@ -795,7 +797,7 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                WRTAIL(6, 0, IER[0], null);\r
                                return;\r
                        }\r
                                WRTAIL(6, 0, IER[0], null);\r
                                return;\r
                        }\r
-                       System.out.println("\nN O T E : THE ORDER OF THE SYMMETRY GROUP IS " + ORDSG);\r
+                       System.out.println("\nN O T E : THE ORDER OF THE SYMMETRY GROUP IS " + ORDSG[0]);\r
                        if (REFLN) {\r
                                System.out.println("          ISYGP = " + (-ORDSG[0]));\r
                        } else {\r
                        if (REFLN) {\r
                                System.out.println("          ISYGP = " + (-ORDSG[0]));\r
                        } else {\r
@@ -807,10 +809,12 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                        } else {\r
                                CH = "TT";\r
                        }\r
                        } else {\r
                                CH = "TT";\r
                        }\r
-                       WRFUN1(NARCS, STAPT, ARCTY, PGM, RGM, PTX, NTX, DEFN, CHNL, "IB", CH, "ZETA  ", REDD, raFile);\r
+                       writeReturn = false;\r
+                       WRFUN1(NARCS, STAPT, ARCTY, PGM, RGM, PTX, NTX, DEFN, CHNL, "IB", CH, "ZETA", REDD, raFile, writeReturn);\r
                        WRSYM2(NARCS, ORDRG[0], CENSY, REFLN, CHNL, raFile);\r
                } else {\r
                        WRSYM2(NARCS, ORDRG[0], CENSY, REFLN, CHNL, raFile);\r
                } else {\r
-                       WRFUN1(NARCS, STAPT, ARCTY, PGM, RGM, PTX, NTX, DEFN, CHNL, "IA", "TT", "PARFUN", REDD, raFile);\r
+                       writeReturn = true;\r
+                       WRFUN1(NARCS, STAPT, ARCTY, PGM, RGM, PTX, NTX, DEFN, CHNL, "IA", "TT", "PARFUNANS", REDD, raFile, writeReturn);\r
                }\r
 \r
                try {\r
                }\r
 \r
                try {\r
@@ -832,13 +836,15 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                        } else {\r
                                CH = "TT";\r
                        }\r
                        } else {\r
                                CH = "TT";\r
                        }\r
-                       WRFUN2(NARCS, MNARC, STAPT, ARCTY, PGM, RGM, PTX, NTX, DEFN, CHNL, "IB", CH, "ZETA  ", NUMDER, REDD,\r
-                                       raFile);\r
+                       writeReturn = false;\r
+                       WRFUN2(NARCS, MNARC, STAPT, ARCTY, PGM, RGM, PTX, NTX, DEFN, CHNL, "IB", CH, "ZETA", NUMDER, REDD,\r
+                                       raFile, writeReturn);\r
                        WRSYM3(NARCS, ORDRG[0], REFLN, CHNL, raFile);\r
                } // if (SYMTY)\r
                else {\r
                        WRSYM3(NARCS, ORDRG[0], REFLN, CHNL, raFile);\r
                } // if (SYMTY)\r
                else {\r
-                       WRFUN2(NARCS, MNARC, STAPT, ARCTY, PGM, RGM, PTX, NTX, DEFN, CHNL, "IA", "TT", "DPARFN", NUMDER, REDD,\r
-                                       raFile);\r
+                       writeReturn = true;\r
+                       WRFUN2(NARCS, MNARC, STAPT, ARCTY, PGM, RGM, PTX, NTX, DEFN, CHNL, "IA", "TT", "DPARFNANS", NUMDER, REDD,\r
+                                       raFile, writeReturn);\r
                }\r
 \r
                try {\r
                }\r
 \r
                try {\r
@@ -1255,21 +1261,21 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                        // FMT="(A7,"+REDD+",A1,"+REDD+",A2)";\r
 \r
                        if (ORDRG >= 2) {\r
                        // FMT="(A7,"+REDD+",A1,"+REDD+",A2)";\r
 \r
                        if (ORDRG >= 2) {\r
-                               raFile.writeBytes("double WW[] = new double[" + (ORDRG - 1) + "];\n");\r
+                               raFile.writeBytes("      double WW[][] = new double[" + (ORDRG - 1) + "][2];\n");\r
                                ZT[0] = 1.0;\r
                                ZT[1] = 0.0;\r
                                for (I = 0; I < ORDRG - 2; I++) {\r
                                        zmlt(ZT[0], ZT[1], RTUNI[0], RTUNI[1], cr, ci);\r
                                        ZT[0] = cr[0];\r
                                        ZT[1] = ci[0];\r
                                ZT[0] = 1.0;\r
                                ZT[1] = 0.0;\r
                                for (I = 0; I < ORDRG - 2; I++) {\r
                                        zmlt(ZT[0], ZT[1], RTUNI[0], RTUNI[1], cr, ci);\r
                                        ZT[0] = cr[0];\r
                                        ZT[1] = ci[0];\r
-                                       raFile.writeBytes("WW[" + I + "][0] = " + ZT[0] + ";\n");\r
-                                       raFile.writeBytes("WW[" + I + "][1] = " + ZT[1] + ";\n");\r
+                                       raFile.writeBytes("      WW[" + I + "][0] = " + ZT[0] + ";\n");\r
+                                       raFile.writeBytes("      WW[" + I + "][1] = " + ZT[1] + ";\n");\r
                                }\r
                                zmlt(ZT[0], ZT[1], RTUNI[0], RTUNI[1], cr, ci);\r
                                ZT[0] = cr[0];\r
                                ZT[1] = ci[0];\r
                                }\r
                                zmlt(ZT[0], ZT[1], RTUNI[0], RTUNI[1], cr, ci);\r
                                ZT[0] = cr[0];\r
                                ZT[1] = ci[0];\r
-                               raFile.writeBytes("WW[" + I + "][0] = " + ZT[0] + ";\n");\r
-                               raFile.writeBytes("WW[" + I + "][1] = " + ZT[1] + ";)\n");\r
+                               raFile.writeBytes("      WW[" + I + "][0] = " + ZT[0] + ";\n");\r
+                               raFile.writeBytes("      WW[" + I + "][1] = " + ZT[1] + ";\n");\r
                                raFile.writeBytes("//\n");\r
                        } // if (ORDRG >= 2)\r
 \r
                                raFile.writeBytes("//\n");\r
                        } // if (ORDRG >= 2)\r
 \r
@@ -1283,59 +1289,59 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                if (ORDRG > 1) {\r
                                        if (NARCS > 1) {\r
                                                I = 2 * NARCS;\r
                                if (ORDRG > 1) {\r
                                        if (NARCS > 1) {\r
                                                I = 2 * NARCS;\r
-                                               raFile.writeBytes("IB = IA%" + I + ";\n");\r
-                                               raFile.writeBytes("if (IB == 0) IB = " + I + ";\n");\r
+                                               raFile.writeBytes("      IB = IA%" + I + ";\n");\r
+                                               raFile.writeBytes("      if (IB == 0) IB = " + I + ";\n");\r
                                                I = I + 1;\r
                                                I = I + 1;\r
-                                               raFile.writeBytes("if (IB > " + NARCS + ") {\n");\r
-                                               raFile.writeBytes("    IB = " + I + " - IB;\n");\r
-                                               raFile.writeBytes("    TS[0] = -TT[0];\n");\r
-                                               raFile.writeBytes("    TS[1] = TT[1]);\n");\r
-                                               raFile.writeBytes("}\n");\r
-                                               raFile.writeBytes("else {\n");\r
-                                               raFile.writeBytes("    TS[0] = TT[0];\n");\r
-                                               raFile.writeBytes("    TS[1] = TT[1];\n");\r
-                                               raFile.writeBytes("}\n");\r
+                                               raFile.writeBytes("      if (IB > " + NARCS + ") {\n");\r
+                                               raFile.writeBytes("          IB = " + I + " - IB;\n");\r
+                                               raFile.writeBytes("          TS[0] = -TT[0];\n");\r
+                                               raFile.writeBytes("          TS[1] = TT[1]);\n");\r
+                                               raFile.writeBytes("      }\n");\r
+                                               raFile.writeBytes("      else {\n");\r
+                                               raFile.writeBytes("          TS[0] = TT[0];\n");\r
+                                               raFile.writeBytes("          TS[1] = TT[1];\n");\r
+                                               raFile.writeBytes("      }\n");\r
                                        } // if (NARCS > 1)\r
                                        else {\r
                                        } // if (NARCS > 1)\r
                                        else {\r
-                                               raFile.writeBytes("if ((IA%2) == 0) {\n");\r
-                                               raFile.writeBytes("    TS[0] = -TT[0];\n");\r
-                                               raFile.writeBytes("    TS[1] = TT[1];\n");\r
-                                               raFile.writeBytes("}\n");\r
-                                               raFile.writeBytes("else {\n");\r
-                                               raFile.writeBytes("    TS[0] = TT[0];\n");\r
-                                               raFile.writeBytes("    TS[1] = TT[1];\n");\r
-                                               raFile.writeBytes("}\n");\r
+                                               raFile.writeBytes("      if ((IA%2) == 0) {\n");\r
+                                               raFile.writeBytes("          TS[0] = -TT[0];\n");\r
+                                               raFile.writeBytes("          TS[1] = TT[1];\n");\r
+                                               raFile.writeBytes("      }\n");\r
+                                               raFile.writeBytes("      else {\n");\r
+                                               raFile.writeBytes("          TS[0] = TT[0];\n");\r
+                                               raFile.writeBytes("          TS[1] = TT[1];\n");\r
+                                               raFile.writeBytes("      }\n");\r
                                        } // else\r
                                } // if (ORDRG > 1)\r
                                else {\r
                                        if (NARCS > 1) {\r
                                                I = 2 * NARCS + 1;\r
                                        } // else\r
                                } // if (ORDRG > 1)\r
                                else {\r
                                        if (NARCS > 1) {\r
                                                I = 2 * NARCS + 1;\r
-                                               raFile.writeBytes("if (IA > " + NARCS + "){\n");\r
-                                               raFile.writeBytes("    IB = " + I + " -IA;\n");\r
-                                               raFile.writeBytes("    TS[0] = -TT[0];\n");\r
-                                               raFile.writeBytes("    TS[1] = TT[1]);\n");\r
-                                               raFile.writeBytes("}\n");\r
-                                               raFile.writeBytes("else {\n");\r
-                                               raFile.writeBytes("    IB = IA;\n");\r
-                                               raFile.writeBytes("    TS[0] = TT[0];\n");\r
-                                               raFile.writeBytes("    TS[1] = TT[1];\n");\r
-                                               raFile.writeBytes("}\n");\r
+                                               raFile.writeBytes("      if (IA > " + NARCS + "){\n");\r
+                                               raFile.writeBytes("          IB = " + I + " -IA;\n");\r
+                                               raFile.writeBytes("          TS[0] = -TT[0];\n");\r
+                                               raFile.writeBytes("          TS[1] = TT[1]);\n");\r
+                                               raFile.writeBytes("      }\n");\r
+                                               raFile.writeBytes("      else {\n");\r
+                                               raFile.writeBytes("          IB = IA;\n");\r
+                                               raFile.writeBytes("          TS[0] = TT[0];\n");\r
+                                               raFile.writeBytes("          TS[1] = TT[1];\n");\r
+                                               raFile.writeBytes("      }\n");\r
                                        } // if (NARCS)\r
                                        else {\r
                                        } // if (NARCS)\r
                                        else {\r
-                                               raFile.writeBytes("if (IA == 2) {\n");\r
-                                               raFile.writeBytes("    TS[0] = -TT[0];\n");\r
-                                               raFile.writeBytes("    TS[1] = TT[1]);\n");\r
-                                               raFile.writeBytes("}\n");\r
-                                               raFile.writeBytes("else {\n");\r
-                                               raFile.writeBytes("    TS[0] = TT[0];\n");\r
-                                               raFile.writeBytes("    TS[1] = TT[1];\n");\r
-                                               raFile.writeBytes("}\n");\r
+                                               raFile.writeBytes("      if (IA == 2) {\n");\r
+                                               raFile.writeBytes("          TS[0] = -TT[0];\n");\r
+                                               raFile.writeBytes("          TS[1] = TT[1]);\n");\r
+                                               raFile.writeBytes("      }\n");\r
+                                               raFile.writeBytes("      else {\n");\r
+                                               raFile.writeBytes("          TS[0] = TT[0];\n");\r
+                                               raFile.writeBytes("          TS[1] = TT[1];\n");\r
+                                               raFile.writeBytes("      }\n");\r
                                        } // else\r
                                } // else\r
                        } // if (REFLN)\r
                        else if (NARCS > 1) {\r
                                        } // else\r
                                } // else\r
                        } // if (REFLN)\r
                        else if (NARCS > 1) {\r
-                               raFile.writeBytes("IB = IA%" + NARCS + ";\n");\r
-                               raFile.writeBytes("if (IB == 0) IB = " + NARCS + ";\n");\r
+                               raFile.writeBytes("      IB = IA%" + NARCS + ";\n");\r
+                               raFile.writeBytes("      if (IB == 0) IB = " + NARCS + ";\n");\r
                        } // else if (NARCS > 1)\r
 \r
                        raFile.writeBytes("//\n");\r
                        } // else if (NARCS > 1)\r
 \r
                        raFile.writeBytes("//\n");\r
@@ -1348,7 +1354,8 @@ public class SymmsIntegralMapping extends AlgorithmBase {
        }\r
 \r
        private void WRFUN1(int NARCS, double STAPT[][], int ARCTY[], int PGM[], double RGM[], int PTX[], int NTX[],\r
        }\r
 \r
        private void WRFUN1(int NARCS, double STAPT[][], int ARCTY[], int PGM[], double RGM[], int PTX[], int NTX[],\r
-                       String DEFN[], int CHNL, String CHIA, String CHTT, String VAR, String REDD, RandomAccessFile raFile) {\r
+                       String DEFN[], int CHNL, String CHIA, String CHTT, String VAR, String REDD, RandomAccessFile raFile,\r
+                       boolean writeReturn) {\r
                // COMPLEX STAPT(*)\r
                // CHARACTER DEFN(*)*72,CHIA*2,CHTT*2,VAR*6,REDD*6\r
 \r
                // COMPLEX STAPT(*)\r
                // CHARACTER DEFN(*)*72,CHIA*2,CHTT*2,VAR*6,REDD*6\r
 \r
@@ -1403,7 +1410,7 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                        DEFN2 = null;\r
                                }\r
                                if (NARCS == 1) {\r
                                        DEFN2 = null;\r
                                }\r
                                if (NARCS == 1) {\r
-                                       PTFUN1(ARCTY[IA - 1], STAPT2, RGM2, NTX[IA - 1], DEFN2, CHNL, CHTT, VAR, REDD, raFile);\r
+                                       PTFUN1(ARCTY[IA - 1], STAPT2, RGM2, NTX[IA - 1], DEFN2, CHNL, CHTT, VAR, REDD, raFile, writeReturn);\r
                                } else {\r
                                        if (IA == 1) {\r
                                                raFile.writeBytes(TX1 + IA + ") {\n");\r
                                } else {\r
                                        if (IA == 1) {\r
                                                raFile.writeBytes(TX1 + IA + ") {\n");\r
@@ -1412,7 +1419,7 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                        } else {\r
                                                raFile.writeBytes(TX2 + IA + ") {\n");\r
                                        }\r
                                        } else {\r
                                                raFile.writeBytes(TX2 + IA + ") {\n");\r
                                        }\r
-                                       PTFUN1(ARCTY[IA - 1], STAPT2, RGM2, NTX[IA - 1], DEFN2, CHNL, CHTT, VAR, REDD, raFile);\r
+                                       PTFUN1(ARCTY[IA - 1], STAPT2, RGM2, NTX[IA - 1], DEFN2, CHNL, CHTT, VAR, REDD, raFile, writeReturn);\r
                                        if (IA == NARCS)\r
                                                raFile.writeBytes("      }\n");\r
                                } // else\r
                                        if (IA == NARCS)\r
                                                raFile.writeBytes("      }\n");\r
                                } // else\r
@@ -1426,7 +1433,7 @@ public class SymmsIntegralMapping extends AlgorithmBase {
        } // private void WRFUN1\r
 \r
        private void PTFUN1(int TYPE, double STAPT[][], double RGM[], int NTX, String TXT[], int CHNL, String CHTT,\r
        } // private void WRFUN1\r
 \r
        private void PTFUN1(int TYPE, double STAPT[][], double RGM[], int NTX, String TXT[], int CHNL, String CHTT,\r
-                       String VAR, String REDD, RandomAccessFile raFile) {\r
+                       String VAR, String REDD, RandomAccessFile raFile, boolean writeReturn) {\r
         // When TT goes from -1,0 to 1,0 T[0] traces out the original parameterization of the curve\r
                // COMPLEX STAPT(*)\r
                // CHARACTER TXT(*)*72,CHTT*2,VAR*6,REDD*6\r
         // When TT goes from -1,0 to 1,0 T[0] traces out the original parameterization of the curve\r
                // COMPLEX STAPT(*)\r
                // CHARACTER TXT(*)*72,CHTT*2,VAR*6,REDD*6\r
@@ -1469,9 +1476,9 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                C2[1] = 0.5 * (STAPT[1][1] - STAPT[0][1]);\r
                                raFile.writeBytes("//\n");\r
                                raFile.writeBytes(\r
                                C2[1] = 0.5 * (STAPT[1][1] - STAPT[0][1]);\r
                                raFile.writeBytes("//\n");\r
                                raFile.writeBytes(\r
-                                               PAD + VAR + "ANS[0] = " + C1[0] + "+" + CHTT + "[0]*(" + C2[0] + ") - " + CHTT + "[1]*(" + C2[1] + ");\n");\r
+                                               PAD + VAR + "[0] = " + C1[0] + "+" + CHTT + "[0]*(" + C2[0] + ") - " + CHTT + "[1]*(" + C2[1] + ");\n");\r
                                raFile.writeBytes(\r
                                raFile.writeBytes(\r
-                                               PAD + VAR + "ANS[1] = " + C1[1] + "+" + CHTT + "[0]*(" + C2[1] + ") + " + CHTT + "[1]*(" + C2[0] + ");\n");\r
+                                               PAD + VAR + "[1] = " + C1[1] + "+" + CHTT + "[0]*(" + C2[1] + ") + " + CHTT + "[1]*(" + C2[0] + ");\n");\r
                                raFile.writeBytes("//\n");\r
                        } // if (TYPE == 1)\r
                        else if (TYPE == 2) {\r
                                raFile.writeBytes("//\n");\r
                        } // if (TYPE == 1)\r
                        else if (TYPE == 2) {\r
@@ -1483,9 +1490,9 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                MD = Math.atan2(C1[1], C1[0]) + HA;\r
                                RAD = zabs(C1[0], C1[1]);\r
                                raFile.writeBytes("//\n");\r
                                MD = Math.atan2(C1[1], C1[0]) + HA;\r
                                RAD = zabs(C1[0], C1[1]);\r
                                raFile.writeBytes("//\n");\r
-                               raFile.writeBytes(PAD + VAR + "ANS[0] = " + CENTR[0] + "+" + RAD + " * " + "Math.exp(-" + CHTT + "[1]*(" + HA\r
+                               raFile.writeBytes(PAD + VAR + "[0] = " + CENTR[0] + "+" + RAD + " * " + "Math.exp(-" + CHTT + "[1]*(" + HA\r
                                                + "))*" + "Math.cos(" + MD + "+" + CHTT + "[0]*(" + HA + "));\n");\r
                                                + "))*" + "Math.cos(" + MD + "+" + CHTT + "[0]*(" + HA + "));\n");\r
-                               raFile.writeBytes(PAD + VAR + "ANS[1] = " + CENTR[1] + "+" + RAD + " * " + "Math.exp(-" + CHTT + "[1]*(" + HA\r
+                               raFile.writeBytes(PAD + VAR + "[1] = " + CENTR[1] + "+" + RAD + " * " + "Math.exp(-" + CHTT + "[1]*(" + HA\r
                                                + "))*" + "Math.sin(" + MD + "+" + CHTT + "[0]*(" + HA + "));\n");\r
                                raFile.writeBytes("//\n");\r
                        } // else if (TYPE == 2)\r
                                                + "))*" + "Math.sin(" + MD + "+" + CHTT + "[0]*(" + HA + "));\n");\r
                                raFile.writeBytes("//\n");\r
                        } // else if (TYPE == 2)\r
@@ -1497,12 +1504,12 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                raFile.writeBytes(PAD + "T[1] = " + CHTT + "[1] * (" + HA + ");\n");\r
 \r
                                if (TXT[0].toLowerCase().indexOf("ui") == 0) {\r
                                raFile.writeBytes(PAD + "T[1] = " + CHTT + "[1] * (" + HA + ");\n");\r
 \r
                                if (TXT[0].toLowerCase().indexOf("ui") == 0) {\r
-                                   raFile.writeBytes(PAD + VAR + "ANS[0] = 0.0;\n");\r
+                                   raFile.writeBytes(PAD + VAR + "[0] = 0.0;\n");\r
                                }\r
                                else {\r
                                        // NTX = 1 if statements are entered without newlines for\r
                                        // multiple lines\r
                                }\r
                                else {\r
                                        // NTX = 1 if statements are entered without newlines for\r
                                        // multiple lines\r
-                                       raFile.writeBytes(PAD + VAR + "ANS[0] = ");\r
+                                       raFile.writeBytes(PAD + VAR + "[0] = ");\r
                                        for (I = 1; I <= NTX; I++) {\r
                                                int index = TXT[I - 1].toLowerCase().indexOf("ui");\r
                                                if (index == 0) {\r
                                        for (I = 1; I <= NTX; I++) {\r
                                                int index = TXT[I - 1].toLowerCase().indexOf("ui");\r
                                                if (index == 0) {\r
@@ -1536,7 +1543,7 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                        int index = TXT[I-1].toLowerCase().indexOf("ui");\r
                                            if (index >= 0) {\r
                                                uifound = true;\r
                                        int index = TXT[I-1].toLowerCase().indexOf("ui");\r
                                            if (index >= 0) {\r
                                                uifound = true;\r
-                                               raFile.writeBytes(PAD + VAR + "ANS[1] = ");\r
+                                               raFile.writeBytes(PAD + VAR + "[1] = ");\r
                                                if (index + 2 < TXT[I-1].length()) {\r
                                                        imagString = TXT[I - 1].substring(index + 2);\r
                                                            raFile.writeBytes(imagString);\r
                                                if (index + 2 < TXT[I-1].length()) {\r
                                                        imagString = TXT[I - 1].substring(index + 2);\r
                                                            raFile.writeBytes(imagString);\r
@@ -1562,7 +1569,7 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                    }\r
                                } // for (I = 1; I <= NTX; I++)\r
                                if (!uifound) {\r
                                    }\r
                                } // for (I = 1; I <= NTX; I++)\r
                                if (!uifound) {\r
-                                   raFile.writeBytes(PAD + VAR + "ANS[1] = 0.0;\n");\r
+                                   raFile.writeBytes(PAD + VAR + "[1] = 0.0;\n");\r
                                }\r
                                raFile.writeBytes("//\n");\r
                        } // else if (TYPE == 3)\r
                                }\r
                                raFile.writeBytes("//\n");\r
                        } // else if (TYPE == 3)\r
@@ -1640,11 +1647,13 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                if (!uifound) {\r
                                    raFile.writeBytes(PAD + "ZRAD[1] = 0.0;\n");\r
                                }\r
                                if (!uifound) {\r
                                    raFile.writeBytes(PAD + "ZRAD[1] = 0.0;\n");\r
                                }\r
-                               raFile.writeBytes(PAD + VAR + "ANS[0] = ZRAD[0]*Math.exp(-T[1])*Math.cos(T[0]) - ZRAD[1]*Math.exp(-T[1])*Math.sin(T[0]);\n");\r
-                               raFile.writeBytes(PAD + VAR + "ANS[1] = ZRAD[0]*Math.exp(-T[1])*Math.sin(T[0]) + ZRAD[1]*Math.exp(-T[1])*Math.cos(T[0]);\n");\r
+                               raFile.writeBytes(PAD + VAR + "[0] = ZRAD[0]*Math.exp(-T[1])*Math.cos(T[0]) - ZRAD[1]*Math.exp(-T[1])*Math.sin(T[0]);\n");\r
+                               raFile.writeBytes(PAD + VAR + "[1] = ZRAD[0]*Math.exp(-T[1])*Math.sin(T[0]) + ZRAD[1]*Math.exp(-T[1])*Math.cos(T[0]);\n");\r
                                raFile.writeBytes("//\n");\r
                        }\r
                                raFile.writeBytes("//\n");\r
                        }\r
-                       raFile.writeBytes(PAD + "return " + VAR + "ANS;\n");\r
+                       if (writeReturn) {\r
+                           raFile.writeBytes(PAD + "return " + VAR + ";\n");\r
+                       }\r
                } // try\r
                catch (IOException e) {\r
                        MipavUtil.displayError("IOException " + e + " in PTFUN1");\r
                } // try\r
                catch (IOException e) {\r
                        MipavUtil.displayError("IOException " + e + " in PTFUN1");\r
@@ -1678,102 +1687,103 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                if (ORDRG > 1) {\r
                                        I = 2 * NARCS;\r
                                        if (NARCS > 1) {\r
                                if (ORDRG > 1) {\r
                                        I = 2 * NARCS;\r
                                        if (NARCS > 1) {\r
-                                               raFile.writeBytes("IS = (IA-IB)%" + I + ";\n");\r
-                                               raFile.writeBytes("IR = (IA-IB-IS)/" + I + ";\n");\r
+                                               raFile.writeBytes("      IS = (IA-IB)%" + I + ";\n");\r
+                                               raFile.writeBytes("      IR = (IA-IB-IS)/" + I + ";\n");\r
                                        } // if (NARCS > 1)\r
                                        else {\r
                                        } // if (NARCS > 1)\r
                                        else {\r
-                                               raFile.writeBytes("IS = (IA-1)%2;\n");\r
-                                               raFile.writeBytes("IR = (IA-1-IS)/2;\n");\r
+                                               raFile.writeBytes("      IS = (IA-1)%2;\n");\r
+                                               raFile.writeBytes("      IR = (IA-1-IS)/2;\n");\r
                                        }\r
                                        }\r
-                                       raFile.writeBytes("if ((IR == 0) && (IS == 0)) {\n");\r
-                                       raFile.writeBytes("    PARFUN[0] = ZETA[0];\n");\r
-                                       raFile.writeBytes("    PARFUN[1] = ZETA[1];\n");\r
-                                       raFile.writeBytes("}\n");\r
-                                       raFile.writeBytes("else if ((IR > 0) && (IS == 0)) {\n");\r
+                                       raFile.writeBytes("      if ((IR == 0) && (IS == 0)) {\n");\r
+                                       raFile.writeBytes("          PARFUNANS[0] = ZETA[0];\n");\r
+                                       raFile.writeBytes("          PARFUNANS[1] = ZETA[1];\n");\r
+                                       raFile.writeBytes("      }\n");\r
+                                       raFile.writeBytes("      else if ((IR > 0) && (IS == 0)) {\n");\r
                                        if (NEEDC) {\r
                                        if (NEEDC) {\r
-                                               raFile.writeBytes("    PARFUN[0] = ZCEN[0] + WW[IR-1][0]*(ZETA[0] - ZCEN[0]) - "\r
+                                               raFile.writeBytes("          PARFUNANS[0] = ZCEN[0] + WW[IR-1][0]*(ZETA[0] - ZCEN[0]) - "\r
                                                                + "WW[IR-1][1]*(ZETA[1] - ZCEN[1]);\n");\r
                                                                + "WW[IR-1][1]*(ZETA[1] - ZCEN[1]);\n");\r
-                                               raFile.writeBytes("    PARFUN[1] = ZCEN[1] + WW[IR-1][0]*(ZETA[1] - ZCEN[1]) + "\r
+                                               raFile.writeBytes("          PARFUNANS[1] = ZCEN[1] + WW[IR-1][0]*(ZETA[1] - ZCEN[1]) + "\r
                                                                + "WW[IR-1][1]*(ZETA[0] - ZCEN[0]);\n");\r
                                        } // if (NEEDC)\r
                                        else {\r
                                                                + "WW[IR-1][1]*(ZETA[0] - ZCEN[0]);\n");\r
                                        } // if (NEEDC)\r
                                        else {\r
-                                               raFile.writeBytes("PARFUN[0] = WW[IR-1][0]*ZETA[0] - WW[IR-1][1]*ZETA[1];\n");\r
+                                               raFile.writeBytes("      PARFUNANS[0] = WW[IR-1][0]*ZETA[0] - WW[IR-1][1]*ZETA[1];\n");\r
                                        }\r
                                        }\r
-                                       raFile.writeBytes("else if ((IR == 0) && (IS > 0)) {\n");\r
+                                       raFile.writeBytes("      else if ((IR == 0) && (IS > 0)) {\n");\r
                                        if (NEEDC) {\r
                                                raFile.writeBytes(\r
                                        if (NEEDC) {\r
                                                raFile.writeBytes(\r
-                                                               "    PARFUN[0] = ZCEN[0] + U2[0]*(ZETA[0]-ZCEN[0]) + " + "U2[1]*(ZETA[1]-ZCEN[1]);\n");\r
+                                                               "          PARFUNANS[0] = ZCEN[0] + U2[0]*(ZETA[0]-ZCEN[0]) + " + "U2[1]*(ZETA[1]-ZCEN[1]);\n");\r
                                                raFile.writeBytes(\r
                                                raFile.writeBytes(\r
-                                                               "    PARFUN[1] = ZCEN[1] - U2[0]*(ZETA[1]-ZCEN[1]) + " + "U2[1]*(ZETA[0]-ZCEN[0]);\n");\r
+                                                               "          PARFUNANS[1] = ZCEN[1] - U2[0]*(ZETA[1]-ZCEN[1]) + " + "U2[1]*(ZETA[0]-ZCEN[0]);\n");\r
                                        } else {\r
                                        } else {\r
-                                               raFile.writeBytes("    PARFUN[0] = U2[0]*ZETA[0] + U2[1]*ZETA[1];\n");\r
-                                               raFile.writeBytes("    PARFUN[1] = -U2[0]*ZETA[1] + U2[1]*ZETA[0];\n");\r
+                                               raFile.writeBytes("          PARFUNANS[0] = U2[0]*ZETA[0] + U2[1]*ZETA[1];\n");\r
+                                               raFile.writeBytes("          PARFUNANS[1] = -U2[0]*ZETA[1] + U2[1]*ZETA[0];\n");\r
                                        }\r
                                        }\r
-                                       raFile.writeBytes("}\n");\r
-                                       raFile.writeBytes("else {\n");\r
+                                       raFile.writeBytes("      }\n");\r
+                                       raFile.writeBytes("      else {\n");\r
                                        if (NEEDC) {\r
                                        if (NEEDC) {\r
-                                               raFile.writeBytes("double realPart = U2[0]*WW[IR-1][0] - U2[1]*WW[IR-1][1];\n");\r
-                                               raFile.writeBytes("double imagPart = U2[0]*WW[IR-1][1] + U2[1]*WW[IR-1][0];\n");\r
-                                               raFile.writeBytes("PARFUN[0] = ZCEN[0] + realPart*(ZETA[0]-ZCEN[0]) + "\r
+                                               raFile.writeBytes("      double realPart = U2[0]*WW[IR-1][0] - U2[1]*WW[IR-1][1];\n");\r
+                                               raFile.writeBytes("      double imagPart = U2[0]*WW[IR-1][1] + U2[1]*WW[IR-1][0];\n");\r
+                                               raFile.writeBytes("      PARFUNANS[0] = ZCEN[0] + realPart*(ZETA[0]-ZCEN[0]) + "\r
                                                                + "imagPart*(ZETA[1]-ZCEN[1]);\n");\r
                                                                + "imagPart*(ZETA[1]-ZCEN[1]);\n");\r
-                                               raFile.writeBytes("PARFUN[1] = ZCEN[1] - realPart*(ZETA[1]-ZCEN[1]) + "\r
+                                               raFile.writeBytes("      PARFUNANS[1] = ZCEN[1] - realPart*(ZETA[1]-ZCEN[1]) + "\r
                                                                + "imagPart*(ZETA[0]-ZCEN[0]);\n");\r
                                        } else {\r
                                                                + "imagPart*(ZETA[0]-ZCEN[0]);\n");\r
                                        } else {\r
-                                               raFile.writeBytes("double realPart = U2[0]*WW[IR-1][0] - U2[1]*WW[IR-1][1];\n");\r
-                                               raFile.writeBytes("double imagPart = U2[0]*WW[IR-1][1] + U2[1]*WW[IR-1][0];\n");\r
-                                               raFile.writeBytes("PARFUN[0] = realPart * ZETA[0] + imagPart * ZETA[1];\n");\r
-                                               raFile.writeBytes("PARFUN[1] = -realPart * ZETA[1] + imagPart * ZETA[0];\n");\r
+                                               raFile.writeBytes("      double realPart = U2[0]*WW[IR-1][0] - U2[1]*WW[IR-1][1];\n");\r
+                                               raFile.writeBytes("      double imagPart = U2[0]*WW[IR-1][1] + U2[1]*WW[IR-1][0];\n");\r
+                                               raFile.writeBytes("      PARFUNANS[0] = realPart * ZETA[0] + imagPart * ZETA[1];\n");\r
+                                               raFile.writeBytes("      PARFUNANS[1] = -realPart * ZETA[1] + imagPart * ZETA[0];\n");\r
                                        }\r
                                        raFile.writeBytes("}\n");\r
                                } // if (ORDRG > 1)\r
                                else { // ORDRG <= 1\r
                                        if (NARCS > 1) {\r
                                        }\r
                                        raFile.writeBytes("}\n");\r
                                } // if (ORDRG > 1)\r
                                else { // ORDRG <= 1\r
                                        if (NARCS > 1) {\r
-                                               raFile.writeBytes("IS = IA - IB;\n");\r
+                                               raFile.writeBytes("      IS = IA - IB;\n");\r
                                        } else {\r
                                        } else {\r
-                                               raFile.writeBytes("IS = IA - 1;\n");\r
+                                               raFile.writeBytes("      IS = IA - 1;\n");\r
                                        }\r
                                        }\r
-                                       raFile.writeBytes("if (IS == 0) {\n");\r
-                                       raFile.writeBytes("    PARFUN[0] = ZETA[0];\n");\r
-                                       raFile.writeBytes("    PARFUN[1] = ZETA[1];\n");\r
-                                       raFile.writeBytes("}\n");\r
-                                       raFile.writeBytes("else {\n");\r
+                                       raFile.writeBytes("      if (IS == 0) {\n");\r
+                                       raFile.writeBytes("          PARFUNANS[0] = ZETA[0];\n");\r
+                                       raFile.writeBytes("          PARFUNANS[1] = ZETA[1];\n");\r
+                                       raFile.writeBytes("      }\n");\r
+                                       raFile.writeBytes("      else {\n");\r
                                        if (NEEDC) {\r
                                                raFile.writeBytes(\r
                                        if (NEEDC) {\r
                                                raFile.writeBytes(\r
-                                                               "    PARFUN[0] = ZCEN[0] + U2[0]*(ZETA[0]-ZCEN[0]) + " + "U2[1]*(ZETA[1]-ZCEN[1]);\n");\r
+                                                               "          PARFUNANS[0] = ZCEN[0] + U2[0]*(ZETA[0]-ZCEN[0]) + " + "U2[1]*(ZETA[1]-ZCEN[1]);\n");\r
                                                raFile.writeBytes(\r
                                                raFile.writeBytes(\r
-                                                               "    PARFUN[1] = ZCEN[1] - U2[0]*(ZETA[1]-ZCEN[1]) + " + "U2[1]*(ZETA[0]-ZCEN[0]);\n");\r
+                                                               "          PARFUNANS[1] = ZCEN[1] - U2[0]*(ZETA[1]-ZCEN[1]) + " + "U2[1]*(ZETA[0]-ZCEN[0]);\n");\r
                                        } else {\r
                                        } else {\r
-                                               raFile.writeBytes("    PARFUN[0] = U2[0]*(ZETA[0]-ZCEN[0]) + " + "U2[1]*(ZETA[1]-ZCEN[1]);\n");\r
+                                               raFile.writeBytes("          PARFUNANS[0] = U2[0]*(ZETA[0]-ZCEN[0]) + " + "U2[1]*(ZETA[1]-ZCEN[1]);\n");\r
                                                raFile.writeBytes(\r
                                                raFile.writeBytes(\r
-                                                               "    PARFUN[1] =  -U2[0]*(ZETA[1]-ZCEN[1]) + " + "U2[1]*(ZETA[0]-ZCEN[0]);\n");\r
+                                                               "          PARFUNANS[1] =  -U2[0]*(ZETA[1]-ZCEN[1]) + " + "U2[1]*(ZETA[0]-ZCEN[0]);\n");\r
                                        }\r
                                        }\r
-                                       raFile.writeBytes("}\n");\r
+                                       raFile.writeBytes("      }\n");\r
                                } // else ORDRG <= 1\r
                        } // if (REFLN)\r
                        else { // !REFLN\r
                                if (NARCS > 1) {\r
                                } // else ORDRG <= 1\r
                        } // if (REFLN)\r
                        else { // !REFLN\r
                                if (NARCS > 1) {\r
-                                       raFile.writeBytes("IR = (IA - IB)/" + NARCS + ";\n");\r
+                                       raFile.writeBytes("      IR = (IA - IB)/" + NARCS + ";\n");\r
                                } else {\r
                                } else {\r
-                                       raFile.writeBytes("IR = IA - 1;\n");\r
+                                       raFile.writeBytes("      IR = IA - 1;\n");\r
                                }\r
                                }\r
-                               raFile.writeBytes("if (IR == 0) {\n");\r
-                               raFile.writeBytes("PARFUN[0] = ZETA[0]);\n");\r
-                               raFile.writeBytes("PARFUN[1] = ZETA[1]);\n");\r
-                               raFile.writeBytes("}\n");\r
-                               raFile.writeBytes("else {\n");\r
+                               raFile.writeBytes("      if (IR == 0) {\n");\r
+                               raFile.writeBytes("          PARFUNANS[0] = ZETA[0];\n");\r
+                               raFile.writeBytes("          PARFUNANS[1] = ZETA[1];\n");\r
+                               raFile.writeBytes("      }\n");\r
+                               raFile.writeBytes("      else {\n");\r
                                if (NEEDC) {\r
                                if (NEEDC) {\r
-                                       raFile.writeBytes("    PARFUN[0] = ZCEN[0] + WW[IR-1][0]*(ZETA[0] - ZCEN[0]) - "\r
+                                       raFile.writeBytes("          PARFUNANS[0] = ZCEN[0] + WW[IR-1][0]*(ZETA[0] - ZCEN[0]) - "\r
                                                        + "WW[IR-1][1]*(ZETA[1] - ZCEN[1]);\n");\r
                                                        + "WW[IR-1][1]*(ZETA[1] - ZCEN[1]);\n");\r
-                                       raFile.writeBytes("    PARFUN[1] = ZCEN[1] + WW[IR-1][0]*(ZETA[1] - ZCEN[1]) + "\r
+                                       raFile.writeBytes("          PARFUNANS[1] = ZCEN[1] + WW[IR-1][0]*(ZETA[1] - ZCEN[1]) + "\r
                                                        + "WW[IR-1][1]*(ZETA[0] - ZCEN[0]);\n");\r
                                } else {\r
                                                        + "WW[IR-1][1]*(ZETA[0] - ZCEN[0]);\n");\r
                                } else {\r
-                                       raFile.writeBytes("    PARFUN[0] = WW[IR-1][0]*(ZETA[0] - ZCEN[0]) - "\r
-                                                       + "WW[IR-1][1]*(ZETA[1] - ZCEN[1]);\n");\r
-                                       raFile.writeBytes("    PARFUN[1] = WW[IR-1][0]*(ZETA[1] - ZCEN[1]) + "\r
-                                                       + "WW[IR-1][1]*(ZETA[0] - ZCEN[0]);\n");\r
+                                       raFile.writeBytes("          PARFUNANS[0] = WW[IR-1][0]*ZETA[0] - "\r
+                                                       + "WW[IR-1][1]*ZETA[1];\n");\r
+                                       raFile.writeBytes("          PARFUNANS[1] = WW[IR-1][0]*ZETA[1] + "\r
+                                                       + "WW[IR-1][1]*ZETA[0];\n");\r
                                }\r
                                }\r
-                               raFile.writeBytes("}\n");\r
+                               raFile.writeBytes("      }\n");\r
                        } // else !REFLN\r
                        } // else !REFLN\r
+                       raFile.writeBytes("      return PARFUNANS;\n");\r
                } // try\r
                catch (IOException e) {\r
                        MipavUtil.displayError("IOException " + e + " in WRSYM2");\r
                } // try\r
                catch (IOException e) {\r
                        MipavUtil.displayError("IOException " + e + " in WRSYM2");\r
@@ -1784,7 +1794,7 @@ public class SymmsIntegralMapping extends AlgorithmBase {
 \r
        private void WRFUN2(int NARCS, int MNARC, double STAPT[][], int ARCTY[], int PGM[], double RGM[], int PTX[],\r
                        int NTX[], String DEFN[], int CHNL, String CHIA, String CHTT, String VAR, boolean NUMDER[], String REDD,\r
 \r
        private void WRFUN2(int NARCS, int MNARC, double STAPT[][], int ARCTY[], int PGM[], double RGM[], int PTX[],\r
                        int NTX[], String DEFN[], int CHNL, String CHIA, String CHTT, String VAR, boolean NUMDER[], String REDD,\r
-                       RandomAccessFile raFile) {\r
+                       RandomAccessFile raFile, boolean writeReturn) {\r
 \r
                // COMPLEX STAPT(*)\r
                // CHARACTER DEFN(*)*72,CHIA*2,CHTT*2,VAR*6,REDD*6\r
 \r
                // COMPLEX STAPT(*)\r
                // CHARACTER DEFN(*)*72,CHIA*2,CHTT*2,VAR*6,REDD*6\r
@@ -1856,7 +1866,7 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                }\r
                                if (NARCS == 1) {\r
                                        PTFUN2(ARCTY[IA - 1], STAPT2, RGM2, N1, DEFN2, N2, DEFN3, CHNL, CHTT, VAR, " 1", NUMDER[IA - 1],\r
                                }\r
                                if (NARCS == 1) {\r
                                        PTFUN2(ARCTY[IA - 1], STAPT2, RGM2, N1, DEFN2, N2, DEFN3, CHNL, CHTT, VAR, " 1", NUMDER[IA - 1],\r
-                                                       REDD, raFile);\r
+                                                       REDD, raFile, writeReturn);\r
                                } else {\r
                                        if (IA == 1) {\r
                                                raFile.writeBytes(TX1 + IA + ") {\n");\r
                                } else {\r
                                        if (IA == 1) {\r
                                                raFile.writeBytes(TX1 + IA + ") {\n");\r
@@ -1866,7 +1876,7 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                                raFile.writeBytes(TX2 + IA + ") {\n");\r
                                        }\r
                                        PTFUN2(ARCTY[IA - 1], STAPT2, RGM2, N1, DEFN2, N2, DEFN3, CHNL, CHTT, VAR, CHIA, NUMDER[IA - 1],\r
                                                raFile.writeBytes(TX2 + IA + ") {\n");\r
                                        }\r
                                        PTFUN2(ARCTY[IA - 1], STAPT2, RGM2, N1, DEFN2, N2, DEFN3, CHNL, CHTT, VAR, CHIA, NUMDER[IA - 1],\r
-                                                       REDD, raFile);\r
+                                                       REDD, raFile, writeReturn);\r
                                        if (IA == NARCS) {\r
                                                raFile.writeBytes("      }\n");\r
                                        }\r
                                        if (IA == NARCS) {\r
                                                raFile.writeBytes("      }\n");\r
                                        }\r
@@ -1881,7 +1891,8 @@ public class SymmsIntegralMapping extends AlgorithmBase {
        } // private void WRFUN2\r
 \r
        private void PTFUN2(int TYPE, double STAPT[][], double RGM[], int NTX1, String TXT1[], int NTX2, String TXT2[],\r
        } // private void WRFUN2\r
 \r
        private void PTFUN2(int TYPE, double STAPT[][], double RGM[], int NTX1, String TXT1[], int NTX2, String TXT2[],\r
-                       int CHNL, String CHTT, String VAR, String CHIA, boolean NUMDER, String REDD, RandomAccessFile raFile) {\r
+                       int CHNL, String CHTT, String VAR, String CHIA, boolean NUMDER, String REDD, RandomAccessFile raFile,\r
+                       boolean writeReturn) {\r
                // COMPLEX STAPT(*)\r
                // CHARACTER TXT1(*)*72,TXT2(*)*72,CHTT*2,VAR*6,CHIA*2,REDD*6\r
 \r
                // COMPLEX STAPT(*)\r
                // CHARACTER TXT1(*)*72,TXT2(*)*72,CHTT*2,VAR*6,CHIA*2,REDD*6\r
 \r
@@ -1923,8 +1934,8 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                raFile.writeBytes("//\n");\r
                                R = C1[0];\r
                                A = C1[1];\r
                                raFile.writeBytes("//\n");\r
                                R = C1[0];\r
                                A = C1[1];\r
-                               raFile.writeBytes(PAD + VAR + "ANS[0] = " + R + ";\n");\r
-                               raFile.writeBytes(PAD + VAR + "ANS[1] = " + A + ";\n");\r
+                               raFile.writeBytes(PAD + VAR + "[0] = " + R + ";\n");\r
+                               raFile.writeBytes(PAD + VAR + "[1] = " + A + ";\n");\r
                                raFile.writeBytes("//\n");\r
                        } // if (TYPE == 1)\r
                        else if (TYPE == 2) {\r
                                raFile.writeBytes("//\n");\r
                        } // if (TYPE == 1)\r
                        else if (TYPE == 2) {\r
@@ -1937,14 +1948,14 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                RAD = zabs(C1[0], C1[1]);\r
                                raFile.writeBytes("//\n");\r
                                raFile.writeBytes(\r
                                RAD = zabs(C1[0], C1[1]);\r
                                raFile.writeBytes("//\n");\r
                                raFile.writeBytes(\r
-                                               PAD + VAR + "ANS[0] = (-" + RAD + ")*(" + HA + ")*Math.exp((-"+CHTT + "[1])*(" + HA +"))*Math.sin(" + MD + "+" + CHTT + "[0]*(" + HA + "));\n");\r
-                               raFile.writeBytes(PAD + VAR + "ANS[1] = (" + RAD + ")*(" + HA + ")*Math.exp((-"+CHTT + "[1])*Math.cos(" + MD + "+" + CHTT + "[0]*(" + HA + "));\n");\r
+                                               PAD + VAR + "[0] = (-" + RAD + ")*(" + HA + ")*Math.exp((-"+CHTT + "[1])*(" + HA +"))*Math.sin(" + MD + "+" + CHTT + "[0]*(" + HA + "));\n");\r
+                               raFile.writeBytes(PAD + VAR + "[1] = (" + RAD + ")*(" + HA + ")*Math.exp((-"+CHTT + "[1])*Math.cos(" + MD + "+" + CHTT + "[0]*(" + HA + "));\n");\r
                                raFile.writeBytes("//\n");\r
                        } // else if (TYPE == 2)\r
                        else if (NUMDER) {\r
                                // Use numerical derivative if no analytical expression is supplied for TYPE == 3 or TYPE == 4.\r
                                raFile.writeBytes("//\n");\r
                                raFile.writeBytes("//\n");\r
                        } // else if (TYPE == 2)\r
                        else if (NUMDER) {\r
                                // Use numerical derivative if no analytical expression is supplied for TYPE == 3 or TYPE == 4.\r
                                raFile.writeBytes("//\n");\r
-                               raFile.writeBytes(PAD + VAR + "ANS = ZDPARF(" + CHIA + "," + CHTT + ");\n");\r
+                               raFile.writeBytes(PAD + VAR + " = ZDPARF(" + CHIA + "," + CHTT + ");\n");\r
                                raFile.writeBytes("//\n");\r
                        } // else if (NUMDER)\r
                        else if (TYPE == 3) {\r
                                raFile.writeBytes("//\n");\r
                        } // else if (NUMDER)\r
                        else if (TYPE == 3) {\r
@@ -1954,12 +1965,12 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                raFile.writeBytes(PAD + "T[0] = " + MD + "+" + CHTT + "[0]*(" + HA + ");\n");\r
                                raFile.writeBytes(PAD + "T[1] = " + CHTT + "[1]*(" + HA + ");\n");\r
                                if (TXT2[0].toLowerCase().indexOf("ui") == 0) {\r
                                raFile.writeBytes(PAD + "T[0] = " + MD + "+" + CHTT + "[0]*(" + HA + ");\n");\r
                                raFile.writeBytes(PAD + "T[1] = " + CHTT + "[1]*(" + HA + ");\n");\r
                                if (TXT2[0].toLowerCase().indexOf("ui") == 0) {\r
-                                   raFile.writeBytes(PAD + VAR + "ANS[0] = 0.0;\n");\r
+                                   raFile.writeBytes(PAD + VAR + "[0] = 0.0;\n");\r
                                }\r
                                else {\r
                                        // NTX2 = 1 if statements are entered without newlines for\r
                                        // multiple lines\r
                                }\r
                                else {\r
                                        // NTX2 = 1 if statements are entered without newlines for\r
                                        // multiple lines\r
-                                       raFile.writeBytes(PAD + VAR + "ANS[0] = " + HA + "*(");\r
+                                       raFile.writeBytes(PAD + VAR + "[0] = " + HA + "*(");\r
                                        for (I = 1; I <= NTX2; I++) {\r
                                                int index = TXT2[I - 1].toLowerCase().indexOf("ui");\r
                                                if (index == 0) {\r
                                        for (I = 1; I <= NTX2; I++) {\r
                                                int index = TXT2[I - 1].toLowerCase().indexOf("ui");\r
                                                if (index == 0) {\r
@@ -1993,7 +2004,7 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                        int index = TXT2[I-1].toLowerCase().indexOf("ui");\r
                                            if (index >= 0) {\r
                                                uifound = true;\r
                                        int index = TXT2[I-1].toLowerCase().indexOf("ui");\r
                                            if (index >= 0) {\r
                                                uifound = true;\r
-                                               raFile.writeBytes(PAD + VAR + "ANS[1] = " + HA + "*(");\r
+                                               raFile.writeBytes(PAD + VAR + "[1] = " + HA + "*(");\r
                                                if (index + 2 < TXT2[I-1].length()) {\r
                                                        imagString = TXT2[I - 1].substring(index + 2);\r
                                                            raFile.writeBytes(imagString);\r
                                                if (index + 2 < TXT2[I-1].length()) {\r
                                                        imagString = TXT2[I - 1].substring(index + 2);\r
                                                            raFile.writeBytes(imagString);\r
@@ -2019,7 +2030,7 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                    }\r
                                } // for (I = 1; I <= NTX2; I++)\r
                                if (!uifound) {\r
                                    }\r
                                } // for (I = 1; I <= NTX2; I++)\r
                                if (!uifound) {\r
-                                   raFile.writeBytes(PAD + VAR + "ANS[1] = 0.0;\n");\r
+                                   raFile.writeBytes(PAD + VAR + "[1] = 0.0;\n");\r
                                }\r
                                raFile.writeBytes("//\n");\r
                        } // else if (TYPE == 3)\r
                                }\r
                                raFile.writeBytes("//\n");\r
                        } // else if (TYPE == 3)\r
@@ -2168,11 +2179,13 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                }\r
                                \r
                                \r
                                }\r
                                \r
                                \r
-                               raFile.writeBytes(PAD + VAR + "ANS[0] = ((ZDER[0] - ZRAD[1])* Math.cos(T[0]) - (ZRAD[0] + ZDER[1])* Math.sin(T[0]))*Math.exp(-T[1])*(" + HA + ");\n");\r
-                               raFile.writeBytes(PAD + VAR + "ANS[1] = ((ZDER[0] - ZRAD[1])* Math.sin(T[0]) + (ZRAD[0] + ZDER[1])* Math.cos(T[0]))*Math.exp(-T[1])*(" + HA + ");\n");\r
+                               raFile.writeBytes(PAD + VAR + "[0] = ((ZDER[0] - ZRAD[1])* Math.cos(T[0]) - (ZRAD[0] + ZDER[1])* Math.sin(T[0]))*Math.exp(-T[1])*(" + HA + ");\n");\r
+                               raFile.writeBytes(PAD + VAR + "[1] = ((ZDER[0] - ZRAD[1])* Math.sin(T[0]) + (ZRAD[0] + ZDER[1])* Math.cos(T[0]))*Math.exp(-T[1])*(" + HA + ");\n");\r
                                raFile.writeBytes("//\n");\r
                        } // else\r
                                raFile.writeBytes("//\n");\r
                        } // else\r
-                       raFile.writeBytes(PAD + "return " + VAR + "ANS;\n");\r
+                       if (writeReturn) {\r
+                           raFile.writeBytes(PAD + "return " + VAR + ";\n");\r
+                       }\r
                } // try\r
                catch (IOException e) {\r
                        MipavUtil.displayError("IOException " + e + " in PTFUN2");\r
                } // try\r
                catch (IOException e) {\r
                        MipavUtil.displayError("IOException " + e + " in PTFUN2");\r
@@ -2208,22 +2221,22 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                                raFile.writeBytes("      IR=(IA-1-IS)/2;\n");\r
                                        }\r
                                        raFile.writeBytes("      if ((IR == 0) && (IS == 0)) {\n");\r
                                                raFile.writeBytes("      IR=(IA-1-IS)/2;\n");\r
                                        }\r
                                        raFile.writeBytes("      if ((IR == 0) && (IS == 0)) {\n");\r
-                                       raFile.writeBytes("          DPARFN[0] =ZETA[0];\n");\r
-                                       raFile.writeBytes("          DPARFN[1] =ZETA[1];\n");\r
+                                       raFile.writeBytes("          DPARFNANS[0] =ZETA[0];\n");\r
+                                       raFile.writeBytes("          DPARFNANS[1] =ZETA[1];\n");\r
                                        raFile.writeBytes("      }\n");\r
                                        raFile.writeBytes("      else if ((IR > 0) && (IS == 0)) {\n");\r
                                        raFile.writeBytes("      }\n");\r
                                        raFile.writeBytes("      else if ((IR > 0) && (IS == 0)) {\n");\r
-                                       raFile.writeBytes("          DPARFN[0] = WW[IR-1][0]*ZETA[0] - WW[IR-1][1]*ZETA[1];\n");\r
-                                       raFile.writeBytes("          DPARFN[1] = WW[IR-1][0]*ZETA[1] + WW[IR-1][1]*ZETA[0];\n");\r
+                                       raFile.writeBytes("          DPARFNANS[0] = WW[IR-1][0]*ZETA[0] - WW[IR-1][1]*ZETA[1];\n");\r
+                                       raFile.writeBytes("          DPARFNANS[1] = WW[IR-1][0]*ZETA[1] + WW[IR-1][1]*ZETA[0];\n");\r
                                        raFile.writeBytes("      }\n");\r
                                        raFile.writeBytes("       else if ((IR == 0 && (IS > 0)) {\n");\r
                                        raFile.writeBytes("      }\n");\r
                                        raFile.writeBytes("       else if ((IR == 0 && (IS > 0)) {\n");\r
-                                       raFile.writeBytes("           DPARFN[0] = -U2[0]*ZETA[0] -U2[1]*ZETA[1];\n");\r
-                                       raFile.writeBytes("           DPARFN[1] = U2[0]*ZETA[1] -U2[1]*ZETA[0];\n");\r
+                                       raFile.writeBytes("           DPARFNANS[0] = -U2[0]*ZETA[0] -U2[1]*ZETA[1];\n");\r
+                                       raFile.writeBytes("           DPARFNANS[1] = U2[0]*ZETA[1] -U2[1]*ZETA[0];\n");\r
                                        raFile.writeBytes("       }\n");\r
                                        raFile.writeBytes("       else {\n");\r
                                        raFile.writeBytes("           double realPart = -U2[0]*WW[IR-1][0] + U2[1]*WW[IR-1][1]);\n");\r
                                        raFile.writeBytes("           double imagPart = -U2[0]*WW[IR-1][1] + U2[1]*WW[IR-1][0]);\n");\r
                                        raFile.writeBytes("       }\n");\r
                                        raFile.writeBytes("       else {\n");\r
                                        raFile.writeBytes("           double realPart = -U2[0]*WW[IR-1][0] + U2[1]*WW[IR-1][1]);\n");\r
                                        raFile.writeBytes("           double imagPart = -U2[0]*WW[IR-1][1] + U2[1]*WW[IR-1][0]);\n");\r
-                                       raFile.writeBytes("           DPARFN[0] = realPart*ZETA[0] + imagPart*ZETA[1]);\n");\r
-                                       raFile.writeBytes("           DPARFN[1] = imagPart*ZETA[0] - realPart*ZETA[1]);\n");\r
+                                       raFile.writeBytes("           DPARFNANS[0] = realPart*ZETA[0] + imagPart*ZETA[1]);\n");\r
+                                       raFile.writeBytes("           DPARFNANS[1] = imagPart*ZETA[0] - realPart*ZETA[1]);\n");\r
                                        raFile.writeBytes("       }\n");\r
                                } // if (ORDRG > 1)\r
                                else {\r
                                        raFile.writeBytes("       }\n");\r
                                } // if (ORDRG > 1)\r
                                else {\r
@@ -2233,12 +2246,12 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                                raFile.writeBytes("      IS=IA-1;\n");\r
                                        }\r
                                        raFile.writeBytes("      if (IS == 0) {\n");\r
                                                raFile.writeBytes("      IS=IA-1;\n");\r
                                        }\r
                                        raFile.writeBytes("      if (IS == 0) {\n");\r
-                                       raFile.writeBytes("          DPARFN[0] = ZETA[0]\n");\r
-                                       raFile.writeBytes("          DPARFN[0] = ZETA[0]\n");\r
+                                       raFile.writeBytes("          DPARFNANS[0] = ZETA[0]\n");\r
+                                       raFile.writeBytes("          DPARFNANS[0] = ZETA[0]\n");\r
                                        raFile.writeBytes("      }\n");\r
                                        raFile.writeBytes("         else {\n");\r
                                        raFile.writeBytes("      }\n");\r
                                        raFile.writeBytes("         else {\n");\r
-                                       raFile.writeBytes("             DPARFN[0] = -U2[0]*ZETA[0] + U2[1]*ZETA[1]);\n");\r
-                                       raFile.writeBytes("             DPARFN[1] = U2[0]*ZETA[1] - U2[1]*ZETA[0]);\n");\r
+                                       raFile.writeBytes("             DPARFNANS[0] = -U2[0]*ZETA[0] + U2[1]*ZETA[1]);\n");\r
+                                       raFile.writeBytes("             DPARFNANS[1] = U2[0]*ZETA[1] - U2[1]*ZETA[0]);\n");\r
                                        raFile.writeBytes("         }\n");\r
                                } // else\r
                        } // if (REFLN)\r
                                        raFile.writeBytes("         }\n");\r
                                } // else\r
                        } // if (REFLN)\r
@@ -2249,14 +2262,15 @@ public class SymmsIntegralMapping extends AlgorithmBase {
                                        raFile.writeBytes("      IR=IA-1;\n");\r
                                }\r
                                raFile.writeBytes("      if (IR == 0) {\n");\r
                                        raFile.writeBytes("      IR=IA-1;\n");\r
                                }\r
                                raFile.writeBytes("      if (IR == 0) {\n");\r
-                               raFile.writeBytes("          DPARFN[0] = ZETA[0];\n");\r
-                               raFile.writeBytes("          DPARFN[1] = ZETA[1];\n");\r
+                               raFile.writeBytes("          DPARFNANS[0] = ZETA[0];\n");\r
+                               raFile.writeBytes("          DPARFNANS[1] = ZETA[1];\n");\r
                                raFile.writeBytes("      }\n");\r
                                raFile.writeBytes("      else {\n");\r
                                raFile.writeBytes("      }\n");\r
                                raFile.writeBytes("      else {\n");\r
-                               raFile.writeBytes("          DPARFN[0]= WW[IR-1][0]*ZETA[0] - WW[IR-1][1]*ZETA[1];\n");\r
-                               raFile.writeBytes("          DPARFN[1]= WW[IR-1][0]*ZETA[1] + WW[IR-1][1]*ZETA[0];\n");\r
+                               raFile.writeBytes("          DPARFNANS[0]= WW[IR-1][0]*ZETA[0] - WW[IR-1][1]*ZETA[1];\n");\r
+                               raFile.writeBytes("          DPARFNANS[1]= WW[IR-1][0]*ZETA[1] + WW[IR-1][1]*ZETA[0];\n");\r
                                raFile.writeBytes("      }\n");\r
                        }\r
                                raFile.writeBytes("      }\n");\r
                        }\r
+                       raFile.writeBytes("      return DPARFNANS;\n");\r
                } // try\r
                catch (IOException e) {\r
                        MipavUtil.displayError("IOException " + e + " in WRSYM3");\r
                } // try\r
                catch (IOException e) {\r
                        MipavUtil.displayError("IOException " + e + " in WRSYM3");\r