Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

lmt_to_ubvri.C

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 // version 1:  Okt 1998     Simon Portegies Zwart
00014 //                          e-mail: spz@grape.c.u-tokyo.ac.jp
00015 //                          Department of General System Studies
00016 //                          College of Arts and Science, 
00017 //                          University of Tokyo, 3-8-1 Komaba,    
00018 //                          Meguro-ku, Tokyo 153, Japan
00019 
00020 #include "dyn.h"
00021 #include "stdfunc.h"
00022 #include "sstar_to_dyn.h"
00023 #include "star_support.h"
00024 
00025 #ifndef TOOLBOX
00026 
00027 void ltm_to_ubvri(const real logl,
00028                   const real logt,
00029                   const real mass,
00030                   real& U,
00031                   real& B,
00032                   real& V,
00033                   real& R,
00034                   real& I) {
00035 
00036   real bc[4], ub[4], ri[4], bv[4], vr[4];
00037   real mv, uminb, bminv, vminr, rmini;
00038 
00039 
00040        real table_Tg_to_BC[34][13] = {
00041          {-5.006, -4.855, -4.703, -4.551, -4.400, -4.248, 
00042           -4.096, -3.945, -3.793, -3.642, -3.490, -3.339, -3.187},
00043          {-4.024, -3.915, -3.805, -3.696, -3.587, -3.478, 
00044           -3.369, -3.260, -3.150, -3.041, -2.932, -2.823, -2.714},
00045          {-2.965, -2.900, -2.834, -2.769, -2.704, -2.639, 
00046           -2.573, -2.508, -2.443, -2.378, -2.312, -2.247, -2.182},
00047          {-2.081, -2.051, -2.021, -1.992, -1.962, -1.933, 
00048           -1.903, -1.873, -1.844, -1.814, -1.785, -1.755, -1.726},
00049          {-1.378, -1.375, -1.372, -1.370, -1.367, -1.364, 
00050           -1.361, -1.357, -1.352, -1.348, -1.344, -1.340, -1.336},
00051          {-.855, -.871, -.887, -.903, -.918, -.934, 
00052           -.949, -.965, -.980, -.996, -1.012, -1.028, -1.043},
00053          {-.523, -.544, -.564, -.583, -.600, -.617, 
00054           -.638, -.668, -.703, -.737, -.768, -.798, -.827},
00055          {-.331, -.348, -.363, -.376, -.384, -.392, 
00056           -.410, -.449, -.500, -.546, -.587, -.626, -.661},
00057          {-.019, -.043, -.064, -.083, -.098, -.112, 
00058           -.135, -.178, -.232, -.281, -.321, -.356, -.384},
00059          {.238, .199, .159, .121, .082, .045, 
00060           .007, -.036, -.083, -.125, -.157, -.182, -.199},
00061          {.369, .325, .277, .229, .177, .125, 
00062           .077, .032, -.011, -.050, -.079, -.101, -.115},
00063          {.353, .320, .283, .242, .197, .150, 
00064           .104, .060, .017, -.022, -.056, -.085, -.108},
00065          {.297, .272, .245, .216, .186, .151, 
00066           .114, .074, .033, -.006, -.043, -.079, -.112},
00067          {.234, .218, .201, .182, .163, .139, 
00068           .112, .079, .043, .004, -.033, -.071, -.109},
00069          {.093, .113, .123, .126, .118, .104, 
00070           .085, .062, .034, .002, -.032, -.067, -.105},
00071          {-.144, -.062, -.005, .031, .038, .033, 
00072           .024, .011, -.006, -.027, -.052, -.080, -.112},
00073          {-.380, -.249, -.156, -.092, -.071, -.068, 
00074           -.070, -.074, -.081, -.091, -.104, -.120, -.140},
00075          {-.572, -.414, -.299, -.220, -.189, -.181, 
00076           -.179, -.178, -.178, -.179, -.183, -.188, -.194},
00077          {-.728, -.554, -.426, -.336, -.299, -.288, 
00078           -.285, -.283, -.281, -.279, -.278, -.277, -.276},
00079          {-.979, -.786, -.644, -.544, -.501, -.487, 
00080           -.485, -.484, -.483, -.482, -.481, -.480, -.479},
00081          {-1.196, -.995, -.847, -.742, -.695, -.680, 
00082           -.678, -.679, -.680, -.681, -.683, -.684, -.687},
00083          {-1.398, -1.197, -1.048, -.943, -.896, -.881, 
00084           -.879, -.881, -.883, -.885, -.887, -.890, -.893},
00085          {-1.602, -1.405, -1.260, -1.159, -1.115, -1.103, 
00086           -1.104, -1.107, -1.109, -1.111, -1.114, -1.117, -1.121},
00087          {-1.831, -1.631, -1.483, -1.381, -1.338, -1.328, 
00088           -1.333, -1.340, -1.343, -1.346, -1.349, -1.352, -1.356},
00089          {-2.022, -1.815, -1.663, -1.557, -1.513, -1.505, 
00090           -1.512, -1.521, -1.527, -1.530, -1.533, -1.535, -1.537},
00091          {-2.340, -2.112, -1.945, -1.830, -1.783, -1.777, 
00092           -1.791, -1.806, -1.816, -1.821, -1.824, -1.824, -1.822},
00093          {-2.605, -2.345, -2.153, -2.022, -2.020, -2.016, 
00094           -2.024, -2.050, -2.070, -2.083, -2.084, -2.084, -2.083},
00095          {-2.886, -2.608, -2.402, -2.284, -2.284, -2.284, 
00096           -2.284, -2.322, -2.353, -2.375, -2.375, -2.375, -2.375},
00097          {-3.124, -2.846, -2.640, -2.522, -2.522, -2.522, 
00098           -2.522, -2.567, -2.599, -2.628, -2.648, -2.648, -2.648},
00099          {-3.566, -3.288, -3.082, -2.964, -2.964, -2.964, 
00100           -2.964, -2.964, -3.010, -3.048, -3.070, -3.070, -3.070},
00101          {-3.978, -3.700, -3.494, -3.376, -3.376, -3.376, 
00102           -3.376, -3.376, -3.361, -3.382, -3.404, -3.404, -3.404},
00103          {-4.366, -4.088, -3.882, -3.764, -3.764, -3.764, 
00104           -3.764, -3.764, -3.764, -3.752, -3.748, -3.748, -3.748},
00105          {-4.732, -4.454, -4.248, -4.130, -4.130, -4.130, 
00106           -4.130, -4.130, -4.130, -4.130, -4.124, -4.124, -4.124},
00107          {-5.076, -4.789, -4.592, -4.474, -4.474, -4.474, 
00108           -4.474, -4.474, -4.474, -4.474, -4.472, -4.472, -4.472}
00109       };
00110        real table_Tg_to_UminB[34][13] = {
00111          {4.680, 4.362, 4.044, 3.725, 3.407, 3.089, 
00112           2.771, 2.453, 2.134, 1.816, 1.498, 1.180, .862},
00113          {4.156, 3.874, 3.593, 3.312, 3.031, 2.749, 
00114           2.468, 2.187, 1.906, 1.624, 1.343, 1.062, .781},
00115          {3.535, 3.304, 3.073, 2.842, 2.611, 2.381, 
00116           2.150, 1.919, 1.688, 1.457, 1.226, .995, .764},
00117          {2.934, 2.756, 2.578, 2.399, 2.221, 2.043, 
00118           1.865, 1.687, 1.509, 1.331, 1.153, .975, .796},
00119          {2.357, 2.241, 2.124, 2.006, 1.887, 1.768, 
00120           1.647, 1.527, 1.406, 1.285, 1.162, 1.039, .915},
00121          {1.782, 1.723, 1.665, 1.606, 1.547, 1.487, 
00122           1.428, 1.368, 1.308, 1.248, 1.187, 1.127, 1.066},
00123          {1.324, 1.281, 1.245, 1.216, 1.196, 1.184, 
00124           1.175, 1.168, 1.164, 1.168, 1.179, 1.198, 1.223},
00125          {1.062, .991, .939, .905, .892, .898, 
00126           .915, .935, .966, 1.018, 1.088, 1.176, 1.282},
00127          {.774, .680, .607, .554, .522, .512, 
00128           .518, .535, .568, .630, .715, .824, .956},
00129          {.583, .508, .441, .384, .334, .297, 
00130           .274, .264, .272, .301, .350, .420, .510},
00131          {.440, .394, .345, .295, .239, .187, 
00132           .142, .108, .087, .081, .093, .121, .165},
00133          {.309, .306, .289, .261, .217, .167, 
00134           .114, .063, .019, -.017, -.043, -.059, -.065},
00135          {.190, .237, .263, .269, .252, .216, 
00136           .167, .110, .050, -.009, -.066, -.122, -.177},
00137          {.039, .134, .202, .246, .262, .254, 
00138           .224, .175, .114, .045, -.032, -.116, -.209},
00139          {-.222, -.063, .058, .146, .194, .216, 
00140           .215, .191, .146, .082, -.002, -.104, -.226},
00141          {-.571, -.325, -.137, .002, .074, .117, 
00142           .142, .147, .128, .084, .013, -.083, -.206},
00143          {-.871, -.554, -.314, -.136, -.046, .008, 
00144           .046, .070, .075, .059, .024, -.029, -.101},
00145          {-1.075, -.723, -.454, -.253, -.149, -.087, 
00146           -.042, -.010, .009, .013, .012, .000, -.019},
00147          {-1.231, -.857, -.570, -.355, -.241, -.174, 
00148           -.125, -.088, -.061, -.045, -.033, -.027, -.027},
00149          {-1.449, -1.052, -.748, -.520, -.396, -.324, 
00150           -.273, -.231, -.198, -.173, -.155, -.143, -.139},
00151          {-1.600, -1.194, -.881, -.647, -.520, -.446, 
00152           -.396, -.356, -.323, -.297, -.277, -.265, -.259},
00153          {-1.743, -1.322, -.999, -.757, -.624, -.548, 
00154           -.498, -.461, -.430, -.407, -.389, -.377, -.371},
00155          {-1.922, -1.472, -1.124, -.863, -.718, -.636, 
00156           -.585, -.549, -.522, -.501, -.486, -.477, -.475},
00157          {-2.147, -1.649, -1.263, -.973, -.807, -.713, 
00158           -.660, -.625, -.599, -.581, -.568, -.562, -.563},
00159          {-2.331, -1.796, -1.379, -1.066, -.884, -.781, 
00160           -.725, -.691, -.666, -.649, -.638, -.633, -.636},
00161          {-2.695, -2.078, -1.595, -1.231, -1.014, -.890, 
00162           -.826, -.791, -.768, -.752, -.743, -.741, -.748},
00163          {-3.028, -2.329, -1.777, -1.360, -1.105, -.958, 
00164           -.904, -.859, -.833, -.818, -.809, -.804, -.813},
00165          {-3.400, -2.610, -1.980, -1.504, -1.207, -1.034, 
00166           -.968, -.921, -.893, -.878, -.869, -.863, -.871},
00167          {-3.733, -2.861, -2.162, -1.633, -1.298, -1.102, 
00168           -1.023, -.978, -.948, -.931, -.923, -.918, -.921},
00169          {-4.310, -3.295, -2.477, -1.856, -1.455, -1.220, 
00170           -1.083, -1.070, -1.036, -1.021, -1.012, -1.010, -1.010},
00171          {-4.797, -3.662, -2.744, -2.045, -1.588, -1.319, 
00172           -1.122, -1.122, -1.102, -1.086, -1.076, -1.076, -1.076},
00173          {-5.219, -3.980, -2.974, -2.209, -1.704, -1.405, 
00174           -1.131, -1.131, -1.131, -1.124, -1.120, -1.120, -1.120},
00175          {-5.591, -4.261, -3.178, -2.353, -1.805, -1.481, 
00176           -1.141, -1.141, -1.141, -1.141, -1.139, -1.139, -1.139},
00177          {-5.924, -4.512, -3.360, -2.482, -1.896, -1.549, 
00178           -1.153, -1.153, -1.153, -1.153, -1.151, -1.151, -1.151},
00179       };
00180        real table_Tg_to_BminV[34][13] = {
00181          {3.126, 2.999, 2.871, 2.744, 2.617, 2.490, 
00182           2.363, 2.236, 2.108, 1.981, 1.854, 1.727, 1.600},
00183          {2.785, 2.679, 2.573, 2.466, 2.360, 2.254, 
00184           2.147, 2.041, 1.934, 1.828, 1.722, 1.615, 1.509},
00185          {2.395, 2.314, 2.233, 2.153, 2.073, 1.992, 
00186           1.912, 1.831, 1.751, 1.670, 1.590, 1.509, 1.428},
00187          {2.041, 1.984, 1.927, 1.870, 1.813, 1.757, 
00188           1.700, 1.643, 1.586, 1.529, 1.472, 1.415, 1.358},
00189          {1.704, 1.677, 1.649, 1.620, 1.589, 1.558, 
00190           1.526, 1.493, 1.459, 1.424, 1.390, 1.356, 1.321},
00191          {1.436, 1.423, 1.411, 1.398, 1.385, 1.372, 
00192           1.359, 1.345, 1.331, 1.317, 1.303, 1.289, 1.274},
00193          {1.380, 1.324, 1.278, 1.242, 1.219, 1.201, 
00194           1.192, 1.193, 1.198, 1.206, 1.214, 1.225, 1.237},
00195          {1.468, 1.336, 1.230, 1.149, 1.097, 1.061, 
00196           1.047, 1.056, 1.078, 1.104, 1.134, 1.169, 1.209},
00197          {1.294, 1.150, 1.035, .946, .888, .850, 
00198           .838, .853, .883, .919, .963, 1.015, 1.076},
00199          {.839, .781, .733, .697, .670, .657, 
00200           .660, .680, .708, .741, .784, .834, .893},
00201          {.398, .422, .440, .455, .462, .473, 
00202           .491, .516, .545, .577, .615, .659, .708},
00203          {.111, .170, .220, .263, .296, .326, 
00204           .356, .385, .415, .445, .477, .510, .544},
00205          {.046, .067, .095, .128, .171, .214, 
00206           .252, .287, .318, .347, .376, .403, .430},
00207          {.122, .064, .037, .033, .069, .111, 
00208           .155, .197, .235, .268, .301, .333, .364},
00209          {.253, .114, .027, -.020, -.004, .029, 
00210           .069, .113, .158, .197, .238, .278, .319},
00211          {.380, .182, .048, -.035, -.042, -.023, 
00212           .007, .045, .088, .130, .176, .225, .276},
00213          {.450, .227, .070, -.032, -.056, -.051, 
00214           -.033, -.004, .031, .069, .116, .171, .234},
00215          {.461, .236, .076, -.032, -.065, -.070, 
00216           -.061, -.041, -.014, .018, .065, .124, .196},
00217          {.451, .229, .070, -.039, -.075, -.085, 
00218           -.082, -.068, -.047, -.019, .028, .088, .165},
00219          {.425, .207, .050, -.059, -.096, -.110, 
00220           -.112, -.105, -.091, -.068, -.027, .027, .098},
00221          {.412, .192, .033, -.077, -.116, -.130, 
00222           -.134, -.129, -.119, -.101, -.070, -.029, .025},
00223          {.403, .183, .023, -.091, -.132, -.148, 
00224           -.152, -.148, -.139, -.124, -.100, -.069, -.029},
00225          {.395, .175, .015, -.100, -.145, -.164, 
00226           -.169, -.165, -.156, -.142, -.122, -.096, -.063},
00227          {.387, .167, .007, -.108, -.155, -.178, 
00228           -.184, -.181, -.172, -.159, -.140, -.117, -.088},
00229          {.380, .160, .000, -.115, -.163, -.190, 
00230           -.197, -.194, -.185, -.173, -.156, -.136, -.111},
00231          {.367, .147, -.013, -.128, -.176, -.206, 
00232           -.217, -.214, -.206, -.194, -.180, -.162, -.141},
00233          {.355, .135, -.025, -.140, -.188, -.214, 
00234           -.228, -.226, -.218, -.206, -.191, -.173, -.151},
00235          {.342, .122, -.038, -.153, -.201, -.235, 
00236           -.235, -.241, -.238, -.231, -.203, -.185, -.162},
00237          {.330, .110, -.050, -.165, -.213, -.248, 
00238           -.248, -.257, -.255, -.250, -.213, -.195, -.172},
00239          {.310, .090, -.070, -.185, -.233, -.281, 
00240           -.281, -.281, -.286, -.282, -.247, -.229, -.206},
00241          {.293, .073, -.087, -.202, -.250, -.281, 
00242           -.281, -.281, -.298, -.304, -.274, -.256, -.233},
00243          {.278, .058, -.102, -.217, -.265, -.305, 
00244           -.305, -.305, -.305, -.311, -.284, -.266, -.243},
00245          {.265, .045, -.115, -.230, -.278, -.318, 
00246           -.318, -.318, -.318, -.318, -.292, -.274, -.251},
00247          {.253, .033, -.127, -.242, -.290, -.324, 
00248           -.324, -.324, -.324, -.324, -.298, -.280, -.257},
00249       };
00250 
00251        real table_Tg_to_VminR[34][13] = {
00252          {2.050, 1.999, 1.949, 1.898, 1.847, 1.796, 
00253           1.746, 1.695, 1.645, 1.594, 1.543, 1.493, 1.442},
00254          {1.752, 1.712, 1.671, 1.630, 1.590, 1.549, 
00255           1.508, 1.467, 1.427, 1.386, 1.345, 1.305, 1.264},
00256          {1.424, 1.397, 1.370, 1.343, 1.317, 1.289, 
00257           1.262, 1.235, 1.209, 1.182, 1.155, 1.128, 1.101},
00258          {1.138, 1.124, 1.111, 1.097, 1.084, 1.070, 
00259           1.056, 1.042, 1.029, 1.016, 1.002, .988, .975},
00260          {.895, .897, .900, .902, .904, .906, 
00261           .907, .908, .909, .910, .911, .913, .915},
00262          {.694, .708, .723, .738, .752, .767, 
00263           .781, .795, .810, .824, .838, .853, .867},
00264          {.570, .582, .596, .611, .627, .645, 
00265           .665, .689, .715, .740, .761, .781, .799},
00266          {.514, .513, .516, .523, .533, .546, 
00267           .568, .596, .628, .659, .682, .701, .714},
00268          {.395, .391, .391, .395, .402, .413, 
00269           .432, .458, .487, .517, .538, .556, .567},
00270          {.259, .269, .280, .293, .307, .322, 
00271           .341, .361, .383, .407, .428, .447, .464},
00272          {.149, .170, .191, .211, .231, .251, 
00273           .270, .288, .306, .326, .346, .367, .388},
00274          {.075, .099, .122, .145, .167, .188, 
00275           .208, .226, .244, .262, .280, .299, .317},
00276          {.033, .049, .067, .085, .107, .128, 
00277           .149, .169, .189, .206, .223, .237, .251},
00278          {.040, .032, .033, .040, .057, .076, 
00279           .096, .117, .137, .156, .174, .191, .207},
00280          {.112, .063, .033, .018, .024, .038, 
00281           .054, .072, .090, .110, .132, .155, .179},
00282          {.227, .128, .059, .016, .009, .015, 
00283           .026, .037, .051, .068, .088, .111, .137},
00284          {.314, .181, .087, .024, .006, .004, 
00285           .008, .014, .022, .032, .045, .061, .079},
00286          {.351, .207, .102, .030, .005, -.002, 
00287           -.003, -.001, .002, .007, .014, .023, .034},
00288          {.369, .218, .108, .032, .003, -.008, 
00289           -.012, -.013, -.012, -.010, -.007, -.002, .005},
00290          {.381, .223, .108, .027, -.006, -.019, 
00291           -.025, -.028, -.030, -.031, -.031, -.030, -.028},
00292          {.367, .211, .097, .017, -.015, -.028, 
00293           -.034, -.038, -.041, -.043, -.043, -.043, -.041},
00294          {.354, .200, .087, .007, -.024, -.037, 
00295           -.043, -.047, -.050, -.052, -.052, -.052, -.050},
00296          {.354, .197, .082, .000, -.032, -.046, 
00297           -.052, -.056, -.058, -.060, -.061, -.062, -.063},
00298          {.375, .208, .085, -.003, -.039, -.054, 
00299           -.060, -.064, -.066, -.067, -.069, -.070, -.071},
00300          {.395, .219, .089, -.004, -.044, -.061, 
00301           -.067, -.070, -.072, -.073, -.075, -.077, -.079},
00302          {.452, .254, .105, -.001, -.049, -.071, 
00303           -.078, -.080, -.081, -.082, -.083, -.084, -.085},
00304          {.532, .305, .134, .011, -.049, -.076, 
00305           -.085, -.086, -.087, -.087, -.086, -.085, -.083}, // last valid value
00306          {-0.83, -0.83, -0.83, -0.83, -0.83, -0.83, 
00307           -0.83, -0.83, -0.83, -0.83, -0.83, -0.83, -0.83},
00308          {-0.83, -0.83, -0.83, -0.83, -0.83, -0.83, 
00309           -0.83, -0.83, -0.83, -0.83, -0.83, -0.83, -0.83},
00310          {-0.83, -0.83, -0.83, -0.83, -0.83, -0.83, 
00311           -0.83, -0.83, -0.83, -0.83, -0.83, -0.83, -0.83},
00312          {-0.83, -0.83, -0.83, -0.83, -0.83, -0.83, 
00313           -0.83, -0.83, -0.83, -0.83, -0.83, -0.83, -0.83},
00314          {-0.83, -0.83, -0.83, -0.83, -0.83, -0.83, 
00315           -0.83, -0.83, -0.83, -0.83, -0.83, -0.83, -0.83},
00316          {-0.83, -0.83, -0.83, -0.83, -0.83, -0.83, 
00317           -0.83, -0.83, -0.83, -0.83, -0.83, -0.83, -0.83},
00318          {-0.83, -0.83, -0.83, -0.83, -0.83, -0.83, 
00319           -0.83, -0.83, -0.83, -0.83, -0.83, -0.83, -0.83},
00320      };
00321 #if 0
00322          {9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 
00323           9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 9.999},
00324          {9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 
00325           9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 9.999},
00326          {9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 
00327           9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 9.999},
00328          {9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 
00329           9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 9.999},
00330          {9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 
00331           9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 9.999},
00332          {9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 
00333           9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 9.999},
00334          {9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 
00335           9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 9.999},
00336      };
00337 #endif
00338        real table_Tg_to_RminI[34][13] = {
00339          {3.046, 2.939, 2.831, 2.723, 2.615, 2.508, 
00340           2.400, 2.293, 2.185, 2.077, 1.969, 1.861, 1.754},
00341          {2.460, 2.388, 2.315, 2.242, 2.169, 2.097, 
00342           2.024, 1.951, 1.879, 1.806, 1.733, 1.660, 1.587},
00343          {1.835, 1.795, 1.757, 1.718, 1.679, 1.640, 
00344           1.601, 1.562, 1.523, 1.484, 1.445, 1.406, 1.367},
00345          {1.325, 1.312, 1.298, 1.285, 1.272, 1.259, 
00346           1.245, 1.232, 1.219, 1.206, 1.193, 1.179, 1.166},
00347          {.932, .934, .936, .937, .939, .941, 
00348           .943, .945, .947, .948, .950, .952, .954},
00349          {.665, .676, .687, .697, .708, .719, 
00350           .730, .741, .752, .762, .773, .784, .795},
00351          {.516, .530, .544, .557, .570, .583, 
00352           .596, .611, .627, .642, .656, .668, .679},
00353          {.448, .461, .472, .483, .493, .503, 
00354           .515, .530, .546, .562, .573, .582, .587},
00355          {.368, .376, .384, .392, .399, .407, 
00356           .415, .426, .439, .451, .459, .465, .467},
00357          {.300, .306, .313, .320, .328, .337, 
00358           .345, .354, .364, .374, .381, .387, .391},
00359          {.243, .245, .250, .256, .265, .275, 
00360           .284, .293, .302, .310, .318, .324, .329},
00361          {.196, .195, .196, .200, .206, .215, 
00362           .224, .235, .245, .255, .264, .273, .282},
00363          {.153, .154, .155, .157, .159, .163, 
00364           .171, .181, .192, .203, .217, .233, .250},
00365          {.114, .119, .122, .124, .123, .123, 
00366           .127, .134, .143, .155, .171, .190, .213},
00367          {.087, .094, .097, .098, .095, .092, 
00368           .092, .096, .101, .110, .123, .139, .160},
00369          {.080, .080, .078, .076, .071, .067, 
00370           .064, .064, .066, .070, .077, .086, .099},
00371          {.081, .071, .062, .054, .049, .044, 
00372           .040, .036, .035, .034, .036, .039, .043},
00373          {.073, .056, .043, .033, .027, .022, 
00374           .018, .013, .009, .005, .002, -.001, -.004},
00375          {.062, .042, .027, .015, .008, .004, 
00376           .000, -.005, -.010, -.015, -.020, -.025, -.031},
00377          {.051, .025, .005, -.010, -.018, -.022, 
00378           -.026, -.031, -.035, -.040, -.044, -.048, -.053},
00379          {.050, .017, -.008, -.026, -.037, -.042, 
00380           -.046, -.050, -.054, -.058, -.061, -.065, -.068},
00381          {.045, .009, -.020, -.041, -.053, -.059, 
00382           -.063, -.066, -.070, -.073, -.077, -.080, -.084},
00383          {.035, -.003, -.033, -.055, -.068, -.074, 
00384           -.077, -.080, -.084, -.086, -.089, -.092, -.095},
00385          {.033, -.010, -.043, -.067, -.081, -.088, 
00386           -.090, -.093, -.096, -.098, -.101, -.104, -.107},
00387          {.043, -.006, -.045, -.074, -.091, -.099, 
00388           -.101, -.103, -.106, -.108, -.111, -.113, -.115},
00389          {.084, .014, -.040, -.081, -.105, -.116, 
00390           -.119, -.120, -.121, -.123, -.125, -.128, -.130},
00391          {.161, .062, -.016, -.074, -.110, -.126, 
00392           -.129, -.129, -.130, -.131, -.133, -.135, -.137}, // last valid value
00393          {-.137, -.137, -.137, -.137, -.137, -.137, 
00394           -.137, -.137, -.137, -.137, -.137, -.137, -.137},
00395          {-.137, -.137, -.137, -.137, -.137, -.137, 
00396           -.137, -.137, -.137, -.137, -.137, -.137, -.137},
00397          {-.137, -.137, -.137, -.137, -.137, -.137, 
00398           -.137, -.137, -.137, -.137, -.137, -.137, -.137},
00399          {-.137, -.137, -.137, -.137, -.137, -.137, 
00400           -.137, -.137, -.137, -.137, -.137, -.137, -.137},
00401          {-.137, -.137, -.137, -.137, -.137, -.137, 
00402           -.137, -.137, -.137, -.137, -.137, -.137, -.137},
00403          {-.137, -.137, -.137, -.137, -.137, -.137, 
00404           -.137, -.137, -.137, -.137, -.137, -.137, -.137},
00405          {-.137, -.137, -.137, -.137, -.137, -.137, 
00406           -.137, -.137, -.137, -.137, -.137, -.137, -.137},
00407      };
00408 #if 0
00409          {9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 
00410           9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 9.999},
00411          {9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 
00412           9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 9.999},
00413          {9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 
00414           9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 9.999},
00415          {9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 
00416           9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 9.999},
00417          {9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 
00418           9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 9.999},
00419          {9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 
00420           9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 9.999},
00421          {9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 
00422           9.999, 9.999, 9.999, 9.999, 9.999, 9.999, 9.999},
00423      };
00424 #endif
00425          
00426        real table_tgr[34] = {2800.,3000.,3250.,3500.,3750.,4000.,4250.,4500.,
00427               5000.,5500.,6000.,6500.,7000.,7500.,8000.,8500.,9000.,
00428               9500.,10000.,11000.,12000.,13000.,14000.,15000.,16000.,
00429               18000.,20000.,22500.,25000.,30000.,35000.,40000.,
00430                 45000.,50000.};
00431 
00432   // modify static tgr table to log10
00433   for(int i=0; i<34; i++) 
00434       table_tgr[i] = log10(table_tgr[i]);
00435 
00436   real ggr[13] = {0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0};
00437 
00438      //     real ***table = allocate_terrible_table();
00439 
00440      //     real* Tg_to_BC = table_Tg_to_BC();
00441      //     real* Tg_to_UminB = table_Tg_to_UminB();
00442      //     real* Tg_to_BminV = table_Tg_to_BminV();
00443 
00444     real gconst=-10.6071;
00445 
00446       if (logl==0 || logt==0) {
00447         mv=20;
00448 
00449         bminv=0;
00450         uminb=0;
00451         return;
00452       }
00453       
00454       real logm = log10(mass);
00455       real logg = logm + 4*logt - logl + gconst;
00456 
00457       int int1, ing1 = 2*dynamic_cast(int, rint(logg)) - 1;
00458       int int2, ing2 = ing1+1;
00459       
00460       if (ing1 < 1) {
00461         ing1 = 0;
00462         ing2 = 1;
00463       }
00464       if (ing2>12) {
00465         ing1 = 11;
00466         ing2 = 12;
00467       }
00468       real logg1 =ggr[ing1];
00469       real logg2 =ggr[ing2]; // values of log g to interpolate between
00470 
00471       if (logt > table_tgr[33]) {
00472         int1 = 32;
00473         int2 = 33;
00474       } 
00475       else if (logt <= table_tgr[0]) {
00476         int1 = 0;
00477         int2 = 1;
00478       }
00479       else
00480         for (int i=0; i<34; i++) {
00481           if (logt <= table_tgr[i]) {
00482             int1 = i-1;
00483             int2 = i;
00484             break;
00485           }
00486         }
00487       
00488 // Compute which two lines from the file ubvri.sol correspond with the two
00489 // logT-logg pairs.
00490 
00491       real logt1 = table_tgr[int1];
00492       real logt2 = table_tgr[int2];
00493       
00494       int k0, k1, k2;
00495       for (int k=0; k<2; k++) 
00496         for (int l=0; l<2; l++) {
00497           
00498           k0 = 2*k + l;
00499           k1 = int1 + k;
00500           k2 = ing1 + l;
00501           bc[k0] = table_Tg_to_BC[k1][k2];
00502           ub[k0] = table_Tg_to_UminB[k1][k2];
00503           bv[k0] = table_Tg_to_BminV[k1][k2];
00504           vr[k0] = table_Tg_to_VminR[k1][k2];
00505           ri[k0] = table_Tg_to_RminI[k1][k2];
00506           //      bc[k0] = table[k1][k2][1];
00507           //      ub[k0] = table[k1][k2][2];
00508           //      bv[k0] = table[k1][k2][3];
00509         }
00510 
00511       real fracg = (logg2-logg)/(logg2-logg1);
00512       real bc1 = bc[1] - fracg * (bc[1]-bc[0]);
00513       real ub1 = ub[1] - fracg * (ub[1]-ub[0]);
00514       real bv1 = bv[1] - fracg * (bv[1]-bv[0]);
00515       real vr1 = vr[1] - fracg * (vr[1]-vr[0]);
00516       real ri1 = ri[1] - fracg * (ri[1]-ri[0]);
00517       real bc2 = bc[3] - fracg * (bc[3]-bc[2]);
00518       real ub2 = ub[3] - fracg * (ub[3]-ub[2]);
00519       real bv2 = bv[3] - fracg * (bv[3]-bv[2]);
00520       real vr2 = vr[3] - fracg * (vr[3]-vr[2]);
00521       real ri2 = ri[3] - fracg * (ri[3]-ri[2]);
00522 
00523       real fract = (logt2-logt)/(logt2-logt1);
00524       real bcx = bc2 - fract * (bc2-bc1);
00525       real ubx = ub2 - fract * (ub2-ub1);
00526       real bvx = bv2 - fract * (bv2-bv1);
00527       real vrx = vr2 - fract * (vr2-vr1);
00528       real rix = ri2 - fract * (ri2-ri1);
00529 
00530       real mbol = 4.75 - 2.5 * logl;
00531       mv = mbol - bcx;
00532       uminb = ubx;
00533       bminv = bvx;
00534       vminr = vrx;
00535       rmini = rix;
00536 
00537       V = mv;
00538       B = V + bminv;
00539       U = B + uminb;
00540       R = V - vminr;
00541       I = R - rmini;
00542 }
00543 
00544   
00545 void combine_ubvri(real Up, real Bp, real Vp, real Rp, real Ip,
00546                    real Us, real Bs, real Vs, real Rs, real Is,
00547                    real &U, real &B, real &V, real &R, real &I) {
00548   
00549     real ln10g25 = 2.3025851/2.5;
00550 
00551     U = -2.5 * log(exp(-ln10g25*Up) + exp(-ln10g25*Us));
00552     B = -2.5 * log(exp(-ln10g25*Bp) + exp(-ln10g25*Bs));
00553     V = -2.5 * log(exp(-ln10g25*Vp) + exp(-ln10g25*Vs));
00554     R = -2.5 * log(exp(-ln10g25*Rp) + exp(-ln10g25*Rs));
00555     I = -2.5 * log(exp(-ln10g25*Ip) + exp(-ln10g25*Is));
00556 
00557 }
00558 
00559 void ltm_to_ubvri(const real logl_prim,
00560                   const real logt_prim,
00561                   const real mass_prim,
00562                   const real logl_sec,
00563                   const real logt_sec,
00564                   const real mass_sec,
00565                   real& U,
00566                   real& B,
00567                   real& V,
00568                   real& R,
00569                   real& I) {
00570 
00571      real Up, Bp, Vp, Rp, Ip;
00572      ltm_to_ubvri(logl_prim, logt_prim, mass_prim,
00573                   Up, Bp, Vp, Rp, Ip);
00574      real Us, Bs, Vs, Rs, Is;
00575      ltm_to_ubvri(logl_sec, logt_sec, mass_sec,
00576                   Us, Bs, Vs, Rs, Is);
00577 
00578      combine_ubvri(Up, Bp, Vp, Rp, Ip,
00579                    Us, Bs, Vs, Rs, Is,
00580                    U,  B,  V,  R,  I); 
00581 }
00582 
00583 local inline real exp10(real x) // sorry Simon -- no such function!  (Steve)
00584 {
00585     return pow(10.0, x);
00586 }
00587 
00588 void get_Lubvri_star(dyn *bi, stellar_type& stype,
00589                      real& Lu, real& Lb, real& Lv, real& Lr, real& Li) {
00590 
00591     real u, b, v, r, i;
00592     u = b = v = r = i = VERY_LARGE_NUMBER;
00593 
00594     get_ubvri_star(bi, stype, u, b, v, r, i);
00595 
00596     real ln10g25 = 2.3025851/2.5;
00597     Lu = exp10(-ln10g25*u);
00598     Lb = exp10(-ln10g25*b);
00599     Lv = exp10(-ln10g25*v);
00600     Lr = exp10(-ln10g25*r);
00601     Li = exp10(-ln10g25*i);
00602 }
00603 
00604 void get_ubvri_star(dyn *bi, stellar_type& stype,
00605                     real& U, real& B, real& V, real& R, real& I) {
00606 
00607 //     real mass = bi->get_starbase()->conv_m_dyn_to_star(bi->get_mass());
00608 
00609      star_type_spec tpe_class = NAC;
00610      spectral_class star_class;
00611      real mass=0, T_rel=0, T_eff=0, R_eff=0, L_eff=0;
00612      if (bi->get_use_sstar()) {
00613         stype = bi->get_starbase()->get_element_type();
00614         T_rel = bi->get_starbase()->get_relative_age();
00615         mass = bi->get_starbase()->get_total_mass();
00616         T_eff = bi->get_starbase()->temperature();
00617         L_eff = bi->get_starbase()->get_luminosity();
00618         star_class = get_spectral_class(T_eff);
00619         R_eff = bi->get_starbase()->get_effective_radius();
00620      }
00621      else if (find_qmatch(bi->get_star_story(), "T_eff")) {
00622        stype = extract_stellar_type_string(
00623                getsq(bi->get_star_story(), "Type")); 
00624        T_rel = getrq(bi->get_star_story(), "T_rel");
00625        mass = getrq(bi->get_star_story(), "M_env");
00626             + getrq(bi->get_star_story(), "M_core");
00627        T_eff = getrq(bi->get_star_story(), "T_eff");
00628        star_class = get_spectral_class(T_eff);
00629        L_eff = getrq(bi->get_star_story(), "L_eff");
00630        if (find_qmatch(bi->get_star_story(), "Class"))
00631          tpe_class = extract_stellar_spec_summary_string(
00632              getsq(bi->get_star_story(), "Class"));
00633        if (L_eff>0)
00634           R_eff = pow(T_eff/cnsts.parameters(solar_temperature), 2)
00635                / sqrt(L_eff);
00636      }
00637      else {
00638        cerr << "    No stellar information found for: ";
00639        bi->pretty_print_node(cout);
00640 
00641        return;
00642      }
00643 
00644      real log_Leff = log10(L_eff);
00645      real log_Teff = log10(T_eff);
00646      ltm_to_ubvri(log_Leff, log_Teff, mass,
00647                   U, B, V, R, I);
00648 
00649 //     if(V>B) {
00650 //       cerr << type_string(stype) << " " << type_string(star_class)<<" ";
00651 //       PRC(T_rel);PRC(mass);PRC(T_eff);PRC(L_eff);PRL(R_eff);
00652 //     }
00653 }
00654 
00655 local void print_star(stellar_type stype, int nstar, real mass, vector pos, 
00656                  real U, real B, real V, real R, real I) {
00657 
00658      cerr << stype <<" "<< nstar<<" "<<mass << " " << pos << " " 
00659           << U <<" "<< B <<" "<< V <<" "<< R <<" "<< I << endl;
00660 
00661 }
00662 
00663 local void print_ubvri_star(dyn *bi, vector pos) {
00664 
00665 //     real mass = bi->get_starbase()->conv_m_dyn_to_star(bi->get_mass());
00666      real time = bi->get_starbase()->conv_t_dyn_to_star(bi->get_system_time());
00667 
00668      real rcom = abs(pos);
00669      rcom = bi->get_starbase()->conv_r_dyn_to_star(rcom);
00670      // And now to parsec
00671      real Rsun_per_parsec = cnsts.parameters(solar_radius)
00672                           / cnsts.parameters(parsec);
00673      real Rdyn_to_parsec = Rsun_per_parsec*
00674                            bi->get_starbase()->conv_r_dyn_to_star(1);
00675                        
00676      rcom *= Rsun_per_parsec;
00677      pos  *= Rdyn_to_parsec;
00678           
00679      star_type_spec tpe_class = NAC;
00680      spectral_class star_class;
00681      stellar_type stype = NAS;
00682      real mass=0, T_rel=0, T_eff=0, R_eff=0, L_eff=0;
00683      if (bi->get_use_sstar()) {
00684         stype = bi->get_starbase()->get_element_type();
00685         T_rel = bi->get_starbase()->get_relative_age();
00686         mass = bi->get_starbase()->get_total_mass();
00687         T_eff = bi->get_starbase()->temperature();
00688         L_eff = bi->get_starbase()->get_luminosity();
00689         star_class = get_spectral_class(T_eff);
00690         R_eff = bi->get_starbase()->get_effective_radius();
00691      }
00692      else if (find_qmatch(bi->get_star_story(), "T_eff")) {
00693        stype = extract_stellar_type_string(
00694                getsq(bi->get_star_story(), "Type")); 
00695        T_rel = getrq(bi->get_star_story(), "T_rel");
00696        mass = getrq(bi->get_star_story(), "M_env");
00697             + getrq(bi->get_star_story(), "M_core");
00698        T_eff = getrq(bi->get_star_story(), "T_eff");
00699        star_class = get_spectral_class(T_eff);
00700        L_eff = getrq(bi->get_star_story(), "L_eff");
00701        if (find_qmatch(bi->get_star_story(), "Class"))
00702          tpe_class = extract_stellar_spec_summary_string(
00703              getsq(bi->get_star_story(), "Class"));
00704        if (L_eff>0)
00705           R_eff = pow(T_eff/cnsts.parameters(solar_temperature), 2)
00706                / sqrt(L_eff);
00707      }
00708      else {
00709        cerr << "    No stellar information found for: ";
00710        bi->pretty_print_node(cout);
00711        return;
00712      }
00713 
00714      real log_Leff = log10(L_eff);
00715      real log_Teff = log10(T_eff);
00716      real U, B, V, R, I;
00717      ltm_to_ubvri(log_Leff, log_Teff, mass,
00718                   U, B, V, R, I);
00719 
00720      print_star(stype, 0, mass, pos, U, B, V, R, I);
00721 
00722 }
00723 
00724 local void print_ubvri_binary(dyn *bi, vector dc_pos) {
00725 
00726 
00727   vector com = bi->get_pos() - dc_pos;
00728   real rcom = abs(com);
00729   rcom = bi->get_starbase()->conv_r_dyn_to_star(rcom);
00730   // And now to parsec
00731   real Rsun_per_parsec = cnsts.parameters(solar_radius)
00732                        / cnsts.parameters(parsec);
00733   real Rdyn_to_parsec = Rsun_per_parsec*
00734                         bi->get_starbase()->conv_r_dyn_to_star(1);
00735   rcom *= Rsun_per_parsec;
00736   com  *= Rdyn_to_parsec;
00737 
00738   stellar_type ptype;
00739   real Up, Bp, Vp, Rp, Ip;
00740   real mp = bi->get_starbase()
00741               ->conv_m_dyn_to_star(bi->get_oldest_daughter()->get_mass());
00742   get_ubvri_star(bi->get_oldest_daughter(), ptype, Up, Bp, Vp, Rp, Ip);
00743 
00744   stellar_type stype;
00745   real Us, Bs, Vs, Rs, Is;
00746   real ms = bi->get_starbase()
00747               ->conv_m_dyn_to_star(bi->get_oldest_daughter()
00748                                      ->get_binary_sister()->get_mass());
00749   get_ubvri_star(bi->get_oldest_daughter()->get_binary_sister(),
00750                  stype, Us, Bs, Vs, Rs, Is);
00751 
00752   real U, B, V, R, I;
00753   combine_ubvri(Up, Bp, Vp, Rp, Ip,
00754                 Us, Bs, Vs, Rs, Is,
00755                 U, B, V, R, I);
00756 
00757   print_star(Double, 2, mp+ms, com, U, B, V, R, I);
00758 //  cerr << "    ";
00759 //  print_star(ptype, 1, mp, com, Up, Bp, Vp, Rp, Ip);
00760 //  cerr << "    ";
00761 //  print_star(stype, 1, ms, com, Us, Bs, Vs, Rs, Is);
00762 
00763 }
00764 
00765 local int print_ubvri_binary_recursive(dyn *b, vector dc_pos,
00766                                        real mtot, int ncomp,
00767                                        real &U, real &B, real &V, 
00768                                        real &R, real &I) {
00769 
00770   int nb = 0;
00771   real Up=U, Bp=B, Vp=V, Rp=R, Ip=I;
00772   real Us, Bs, Vs, Rs, Is;
00773        Us= Bs= Vs= Rs= Is=VERY_LARGE_NUMBER;
00774   if (b->get_oldest_daughter()) {
00775 //      PRL(b->n_leaves()); 
00776 
00777       //cerr << " Multiple : " << b->format_label()<<endl;
00778 
00779       for_all_daughters(dyn, b, bb) {
00780         Up=U; Bp=B; Vp=V; Rp=R; Ip=I;
00781         //      cerr << "search furthre for "<< bb->format_label()<<endl;
00782         if (bb->n_leaves() >= 2) {
00783           //cerr << "next recursive call"<<endl;
00784           print_ubvri_binary_recursive(bb, dc_pos, mtot, ncomp, 
00785                                        Us, Bs, Vs, Rs, Is);
00786         }
00787         else if(bb->is_leaf()) {
00788           //cerr << "compute UBVRI for leave "<<bb->format_label()<<endl;
00789           stellar_type stype=NAS;
00790           real mass = bb->get_starbase()->conv_m_dyn_to_star(bb->get_mass());
00791           mtot += mass;
00792           ncomp++;
00793           nb++;
00794           get_ubvri_star(bb, stype, Us, Bs, Vs, Rs, Is);
00795           //print_star(stype, ncomp, mass, dc_pos, Us, Bs, Vs, Rs, Is);
00796         }
00797 
00798         combine_ubvri(Up, Bp, Vp, Rp, Ip,
00799                       Us, Bs, Vs, Rs, Is,
00800                       U, B, V, R, I);
00801 
00802         //PRC(U);PRC(B);PRC(V);PRC(R);PRL(I);
00803 
00804       }
00805     }
00806 
00807 
00808   vector pos = something_relative_to_root(b, &dyn::get_pos);
00809 
00810   // And now to parsec
00811   real Rsun_per_parsec = cnsts.parameters(solar_radius)
00812                        / cnsts.parameters(parsec);
00813   real Rdyn_to_parsec = Rsun_per_parsec*
00814                         b->get_starbase()->conv_r_dyn_to_star(1);
00815                        
00816   pos = (pos-dc_pos)*Rdyn_to_parsec;
00817   real rcom = abs(pos);
00818 
00819   print_star(Double, ncomp, mtot, pos, U, B, V, R, I);
00820 
00821 //  print_ubvri_binary(b, dc_pos); //, U, B, V, R, I);
00822 
00823   return nb;
00824 }
00825 
00826 
00827 #if 0
00828 
00829 
00830 local int print_ubvri_binary_recursive(dyn *b, vector dc_pos,
00831                                        real mtot, int ncomp,
00832                                        real &U, real &B, real &V, 
00833                                        real &R, real &I) {
00834 
00835   int nb = 0;
00836   if (b->get_oldest_daughter()) {
00837 
00838      print_ubvri_binary(b, dc_pos);
00839 
00840 
00841       //cerr << " Multiple : " << b->format_label()<<endl;
00842 
00843      real Us, Bs, Vs, Rs, Is;
00844       for_all_daughters(dyn, b, bb) {
00845         if (bb->n_leaves() >= 2) {
00846           print_ubvri_binary_recursive(bb, dc_pos, mtot, ncomp, 
00847                                        Us, Bs, Vs, Rs, Is);
00848         }
00849       }
00850    }
00851 
00852   return nb;
00853 }
00854 #endif
00855 
00856 void put_ubvri(dyn *b) {
00857 
00858   bool cod = false;
00859 
00860   vector dc_pos = 0;
00861   bool try_com = false;
00862   if(abs(dc_pos) == 0) {
00863       if (find_qmatch(b->get_dyn_story(), "density_center_pos")) {
00864       
00865           if (getrq(b->get_dyn_story(), "density_center_time")
00866               != b->get_system_time()) {
00867               warning("put_ubvri: neglecting out-of-date density center");
00868               try_com = true;
00869           } else
00870               cod = true;
00871           
00872           dc_pos = getvq(b->get_dyn_story(), "density_center_pos");
00873       }
00874       else if (find_qmatch(b->get_dyn_story(), "lagr_pos")) {
00875           
00876           dc_pos = getvq(b->get_dyn_story(), "lagr_pos");
00877 
00878       }
00879       else if (try_com && find_qmatch(b->get_dyn_story(), "com_pos")) {
00880         
00881           dc_pos = getvq(b->get_dyn_story(), "com_pos");
00882       }
00883   }
00884 
00885   // For now: put density center in geometric origin
00886 //  dc_pos = 0;
00887   
00888   int ns=0, nb=0;
00889   for_all_daughters(dyn, b, bi) 
00890     if (bi->is_leaf()) {
00891 
00892       print_ubvri_star(bi, bi->get_pos() - dc_pos);
00893       ns++;
00894     }
00895 
00896   for_all_daughters(dyn, b, bi) {
00897     if (!bi->is_leaf()) {                
00898       int nstar = 0;
00899       real mtot=0, U, B, V, R, I; 
00900       U=B=V=R=I = VERY_LARGE_NUMBER;
00901 
00902 
00903       nb += print_ubvri_binary_recursive(bi, dc_pos, mtot, nstar, 
00904                                          U, B, V, R, I);
00905     }
00906 
00907   }
00908 }
00909 
00910 #else
00911 
00912 main(int argc, char **argv)
00913 {
00914 
00915     bool v_flag = false;
00916     bool c_flag = false;
00917     
00918     real m_prim;                     // Mass [Msun] of primary star 
00919     real m_sec;                      // Mass [Msun] of secondary star 
00920     real T_prim;                     // Temperature [Kelvin] of primary star
00921     real T_sec;                      // Temperature [Kelvin] of secondary star
00922     real L_prim;                     // Luminosity [Lsun] of primary star 
00923     real L_sec;                      // Luminosity [Lsun] of secondary star 
00924     T_prim = T_sec = L_prim = L_sec = -1;
00925 
00926     real mv_prim;                    // Magnitude of primary star
00927     real bminv_prim;                 // B-V magnitude of primary star
00928     real uminb_prim;                 // U-B magnitude of primary star
00929     real mv_sec;                     // Magnitude of secondary star
00930     real bminv_sec;                  // B-V magnitude of secondary star
00931     real uminb_sec;                  // U-B magnitude of secondary star
00932     real mv_bin;                     // Magnitude of binary
00933     real bminv_bin;                  // B-V magnitude of binary
00934     real uminb_bin;                  // U-B magnitude of binary
00935     real U, B, V, R, I;
00936     
00937     char* comment;
00938     check_help();
00939     extern char *poptarg;
00940     int c;
00941     char* param_string = "M:m:T:t:L:l:v";
00942 
00943     while ((c = pgetopt(argc, argv, param_string)) != -1)
00944         switch(c) {
00945             case 'M': m_prim = atof(poptarg);
00946                       break;
00947             case 'm': m_sec = atof(poptarg);
00948                       break;
00949             case 'T': T_prim = atof(poptarg);
00950                       break;
00951             case 't': T_sec = atof(poptarg);
00952                       break;
00953             case 'L': L_prim = atof(poptarg);
00954                       break;
00955             case 'l': L_sec = atof(poptarg);
00956                       break;
00957             case 'c': c_flag = true;
00958                       comment = poptarg;
00959             case 'v': v_flag = true;
00960                       comment = poptarg;
00961                       break;
00962             case '?': params_to_usage(cerr, argv[0], param_string);
00963                       get_help();
00964                       exit(1);
00965         }
00966 
00967     bool apply_to_nbody_system = false;
00968     if (T_prim<=0 && L_prim<=0)
00969       apply_to_nbody_system = true;
00970 
00971     if (!apply_to_nbody_system) {
00972       real logl_prim;
00973       real logt_prim;
00974       if (L_prim >0 && T_prim >0) {
00975         logl_prim = log10(L_prim);
00976         logt_prim = log10(T_prim);
00977 
00978         ltm_to_ubvri(logl_prim, logt_prim, m_prim,
00979                      U, B, V, R, I);
00980 
00981         cerr << "Primary star:           "
00982              << " Mv = " << V
00983              << " B-V = " << B-V
00984              << " U-B = " << U-B
00985              << endl;
00986         PRI(10);PRC(U);PRC(B);PRL(V);
00987         PRI(10);PRC(R);PRL(I);
00988       }
00989     
00990       real logl_sec;
00991       real logt_sec;
00992       if (L_sec >0 && T_sec >0) {
00993         logl_sec = log10(L_sec);
00994         logt_sec = log10(T_sec);
00995         ltm_to_ubvri(logl_sec, logt_sec, m_sec,
00996                      U, B, V, R, I);
00997 
00998         cerr << "Secondary star:         "
00999              << " Mv = " << V
01000              << " B-V = " << B-V
01001              << " U-B = " << U-B
01002              << endl;
01003         PRI(10);PRC(U);PRC(B);PRL(V);
01004         PRI(10);PRC(R);PRL(I);
01005 
01006         if (L_prim >0 && T_prim >0) {
01007           ltm_to_ubvri(logl_prim, logt_prim, m_prim,
01008                        logl_sec, logt_sec, m_sec,
01009                        U, B, V, R, I);
01010 
01011           cerr << "Combined in the binary: "
01012                << " Mv = " << V
01013                << " B-V = " << B-V
01014                << " U-B = " << U-B
01015                << endl;
01016           PRI(10);PRC(U);PRC(B);PRL(V);
01017           PRI(10);PRC(R);PRL(I);
01018       
01019         }
01020       }
01021     }
01022     else {
01023 
01024       cerr.precision(STD_PRECISION);
01025 
01026       dyn *b;
01027 
01028       int nsnap = 0;    
01029       while (b = get_dyn(cin)) {
01030 
01031         cerr << "Time = " << b->get_system_time() 
01032              << " ("<<b->get_starbase()->conv_t_dyn_to_star(b->get_system_time())<<" [Myr])" 
01033              << endl;
01034         addstar(b);                            
01035 
01036         b->set_use_sstar(true); 
01037         // Do not make new stars but make sure the starbase is searched.
01038         //b->set_use_sstar(false);
01039 
01040         if (c_flag == TRUE)
01041           b->log_comment(comment);
01042         
01043         b->log_history(argc, argv);
01044 
01045         nsnap ++;       
01046         put_ubvri(b);
01047 
01048         if (v_flag)
01049           put_dyn(cout, *b);
01050         
01051         rmtree(b);
01052       }
01053     }
01054 }
01055 
01056 #endif

Generated at Sun Feb 24 09:57:07 2002 for STARLAB by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001