Commit dd361980 authored by js9's avatar js9

merge from 1.12RC; pick up missing atomic numbers, fix to xyz writer (adjusted)


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@7675 18c085ea-50e0-402c-830e-de6fd14e8384
parent e07074a3
......@@ -46,6 +46,8 @@
// which means "unknown", and hydrogen now starts at 1. This
// also means we don't have to correct for 1-origin atomic numbers.
//
// Jeremy Meredith, Tue Jun 30 11:29:50 EDT 2009
// Added inexplicably missing elements in name-to-number maps.
#include "AtomicProperties.h"
......@@ -869,8 +871,8 @@ InitializeResidueNameToLongNameMap()
static void
InitializeElementNameToAtomicNumberMap()
{
// These are sorted by covalent radius to make the map
// tree more balanced.
// These are sorted by an unrelated number (basically covalent radius)
// for randomiation make the map tree more balanced.
elementname_to_atomicnumber["?"] = 0;
elementname_to_atomicnumber["H"] = 1;
elementname_to_atomicnumber["Ne"] = 10;
......@@ -959,6 +961,28 @@ InitializeElementNameToAtomicNumberMap()
elementname_to_atomicnumber["K"] = 19;
elementname_to_atomicnumber["Rb"] = 37;
elementname_to_atomicnumber["Cs"] = 55;
elementname_to_atomicnumber["Rn"] = 86;
elementname_to_atomicnumber["Fr"] = 87;
elementname_to_atomicnumber["Ra"] = 88;
elementname_to_atomicnumber["Ac"] = 89;
elementname_to_atomicnumber["Pa"] = 91;
elementname_to_atomicnumber["Np"] = 93;
elementname_to_atomicnumber["Pu"] = 94;
elementname_to_atomicnumber["Am"] = 95;
elementname_to_atomicnumber["Cm"] = 96;
elementname_to_atomicnumber["Bk"] = 97;
elementname_to_atomicnumber["Cf"] = 98;
elementname_to_atomicnumber["Es"] = 99;
elementname_to_atomicnumber["Fm"] = 100;
elementname_to_atomicnumber["Md"] = 101;
elementname_to_atomicnumber["No"] = 102;
elementname_to_atomicnumber["Lr"] = 103;
elementname_to_atomicnumber["Rf"] = 104;
elementname_to_atomicnumber["Db"] = 105;
elementname_to_atomicnumber["Sg"] = 106;
elementname_to_atomicnumber["Bh"] = 107;
elementname_to_atomicnumber["Hs"] = 108;
elementname_to_atomicnumber["Mt"] = 109;
}
static void PrintColorTablesFor_avtColorTables();
......@@ -1017,14 +1041,17 @@ int ElementNameToAtomicNumber(const char *element)
{
switch (name[1])
{
case 'c': return 89;
case 'g': return 47;
case 'l': return 13;
case 'm': return 95;
case 'r': return 18;
case 's': return 33;
case 't': return 85;
case 'u': return 79;
}
}
break;
case 'B':
{
......@@ -1033,10 +1060,13 @@ int ElementNameToAtomicNumber(const char *element)
case '\0': return 5;
case 'a': return 56;
case 'e': return 4;
case 'h': return 107;
case 'i': return 83;
case 'k': return 97;
case 'r': return 35;
}
}
break;
case 'C':
{
......@@ -1046,30 +1076,37 @@ int ElementNameToAtomicNumber(const char *element)
case 'a': return 20;
case 'd': return 48;
case 'e': return 58;
case 'f': return 98;
case 'l': return 17;
case 'm': return 96;
case 'o': return 27;
case 'r': return 24;
case 's': return 55;
case 'u': return 29;
}
}
break;
case 'D':
{
switch (name[1])
{
case 'b': return 105;
case 'y': return 66;
}
}
break;
case 'E':
{
switch (name[1])
{
case 'r': return 68;
case 's': return 99;
case 'u': return 63;
}
}
break;
case 'F':
{
......@@ -1077,8 +1114,11 @@ int ElementNameToAtomicNumber(const char *element)
{
case '\0': return 9;
case 'e': return 26;
case 'm': return 100;
case 'r': return 87;
}
}
break;
case 'G':
{
......@@ -1089,6 +1129,7 @@ int ElementNameToAtomicNumber(const char *element)
case 'e': return 32;
}
}
break;
case 'H':
{
......@@ -1099,8 +1140,10 @@ int ElementNameToAtomicNumber(const char *element)
case 'f': return 72;
case 'g': return 80;
case 'o': return 67;
case 's': return 108;
}
}
break;
case 'I':
{
......@@ -1111,6 +1154,7 @@ int ElementNameToAtomicNumber(const char *element)
case 'r': return 77;
}
}
break;
case 'K':
{
......@@ -1120,6 +1164,7 @@ int ElementNameToAtomicNumber(const char *element)
case 'r': return 36;
}
}
break;
case 'L':
{
......@@ -1127,19 +1172,24 @@ int ElementNameToAtomicNumber(const char *element)
{
case 'a': return 57;
case 'i': return 3;
case 'r': return 103;
case 'u': return 71;
}
}
break;
case 'M':
{
switch (name[1])
{
case 'd': return 101;
case 'g': return 12;
case 'n': return 25;
case 'o': return 42;
case 't': return 109;
}
}
break;
case 'N':
{
......@@ -1151,8 +1201,11 @@ int ElementNameToAtomicNumber(const char *element)
case 'd': return 60;
case 'e': return 10;
case 'i': return 28;
case 'o': return 102;
case 'p': return 93;
}
}
break;
case 'O':
{
......@@ -1162,31 +1215,39 @@ int ElementNameToAtomicNumber(const char *element)
case 's': return 76;
}
}
break;
case 'P':
{
switch (name[1])
{
case '\0': return 15;
case 'a': return 91;
case 'b': return 82;
case 'd': return 46;
case 'm': return 61;
case 'o': return 84;
case 'r': return 59;
case 't': return 78;
case 'u': return 94;
}
}
break;
case 'R':
{
switch (name[1])
{
case 'a': return 88;
case 'b': return 37;
case 'e': return 75;
case 'f': return 104;
case 'h': return 45;
case 'n': return 86;
case 'u': return 44;
}
}
break;
case 'S':
{
......@@ -1196,12 +1257,14 @@ int ElementNameToAtomicNumber(const char *element)
case 'b': return 51;
case 'c': return 21;
case 'e': return 34;
case 'g': return 106;
case 'i': return 14;
case 'm': return 62;
case 'n': return 50;
case 'r': return 38;
}
}
break;
case 'T':
{
......@@ -1217,6 +1280,7 @@ int ElementNameToAtomicNumber(const char *element)
case 'm': return 69;
}
}
break;
case 'U':
{
......@@ -1225,6 +1289,7 @@ int ElementNameToAtomicNumber(const char *element)
case '\0': return 92;
}
}
break;
case 'V':
{
......@@ -1233,6 +1298,7 @@ int ElementNameToAtomicNumber(const char *element)
case '\0': return 23;
}
}
break;
case 'W':
{
......@@ -1241,6 +1307,7 @@ int ElementNameToAtomicNumber(const char *element)
case '\0': return 74;
}
}
break;
case 'X':
{
......@@ -1249,6 +1316,7 @@ int ElementNameToAtomicNumber(const char *element)
case 'e': return 54;
}
}
break;
case 'Y':
{
......@@ -1258,6 +1326,7 @@ int ElementNameToAtomicNumber(const char *element)
case 'b': return 70;
}
}
break;
case 'Z':
{
......@@ -1267,6 +1336,7 @@ int ElementNameToAtomicNumber(const char *element)
case 'r': return 40;
}
}
break;
}
return -1;
}
......
......@@ -117,6 +117,10 @@ avtXYZWriter::WriteHeaders(const avtDatabaseMetaData *md,
// Programmer: Jeremy Meredith
// Creation: June 2, 2009
//
// Modifications:
// Jeremy Meredith, Tue Jun 30 12:14:58 EDT 2009
// Added check for negative atomic numbers.
//
// ****************************************************************************
void
......@@ -167,7 +171,7 @@ avtXYZWriter::WriteChunk(vtkDataSet *ds, int chunk)
int atomicNumber = 0;
if (element)
atomicNumber = element->GetTuple1(ids[0]);
if (atomicNumber > MAX_ELEMENT_NUMBER)
if (atomicNumber < 0 || atomicNumber > MAX_ELEMENT_NUMBER)
atomicNumber = 0;
// write out the element, coordinates, and any variables
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment