vtkMoleculeReaderBase.cxx 17.4 KB
Newer Older
1 2
/*=========================================================================

Brad King's avatar
Brad King committed
3 4
  Program:   Visualization Toolkit
  Module:    vtkMoleculeReaderBase.cxx
5

Brad King's avatar
Brad King committed
6 7 8
  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9

Brad King's avatar
Brad King committed
10 11 12
     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.
13 14 15 16 17 18 19 20

=========================================================================*/
#include "vtkMoleculeReaderBase.h"

#include "vtkCellArray.h"
#include "vtkCellType.h"
#include "vtkDataArray.h"
#include "vtkFloatArray.h"
21 22
#include "vtkInformation.h"
#include "vtkInformationVector.h"
23 24 25 26
#include "vtkObjectFactory.h"
#include "vtkPointData.h"
#include "vtkPolyData.h"
#include "vtkUnsignedCharArray.h"
Kyle Lutz's avatar
Kyle Lutz committed
27
#include "vtkStringArray.h"
28
#include "vtkMolecule.h"
29 30
#include "vtkPointLocator.h"
#include "vtkNew.h"
31

32
#include <algorithm>
33 34 35
#include <ctype.h>


Ken Martin's avatar
Ken Martin committed
36
static double vtkMoleculeReaderBaseCovRadius[103] = {
37 38 39 40 41 42 43 44 45 46 47 48 49
0.32 , 1.6 , 0.68 , 0.352 , 0.832 , 0.72 ,
0.68 , 0.68 , 0.64 , 1.12 , 0.972 , 1.1 , 1.352 , 1.2 , 1.036 ,
1.02 , 1 , 1.568 , 1.328 , 0.992 , 1.44 , 1.472 , 1.328 , 1.352 ,
1.352 , 1.34 , 1.328 , 1.62 , 1.52 , 1.448 , 1.22 , 1.168 , 1.208 ,
1.22 , 1.208 , 1.6 , 1.472 , 1.12 , 1.78 , 1.56 , 1.48 , 1.472 ,
1.352 , 1.4 , 1.448 , 1.5 , 1.592 , 1.688 , 1.632 , 1.46 , 1.46 ,
1.472 , 1.4 , 1.7 , 1.672 , 1.34 , 1.872 , 1.832 , 1.82 , 1.808 ,
1.8 , 1.8 , 1.992 , 1.792 , 1.76 , 1.752 , 1.74 , 1.728 , 1.72 ,
1.94 , 1.72 , 1.568 , 1.432 , 1.368 , 1.352 , 1.368 , 1.32 , 1.5 ,
1.5 , 1.7 , 1.552 , 1.54 , 1.54 , 1.68 , 1.208 , 1.9 , 1.8 ,
1.432 , 1.18 , 1.02 , 0.888 , 0.968 , 0.952 , 0.928 , 0.92 , 0.912 ,
0.9 , 0.888 , 0.88 , 0.872 , 0.86 , 0.848 , 0.84 };

Ken Martin's avatar
Ken Martin committed
50
static double vtkMoleculeReaderBaseAtomColors[][3] = {
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
  {255, 255, 255}, {127, 0, 127}, {255, 0, 255},
  {127, 127, 127}, {127, 0, 127}, {0, 255, 0},
  {0, 0, 255}, {255, 0, 0}, {0, 255, 255},
  {127, 127, 127}, {127, 127, 127}, {178, 153, 102},
  {127, 127, 127}, {51, 127, 229}, {0, 255, 255},
  {255, 255, 0}, {255, 127, 127}, {255, 255, 127},
  {127, 127, 127}, {51, 204, 204}, {127, 127, 127},
  {0, 178, 178}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {204, 0, 255}, {255, 0, 255},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {229, 102, 51}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 255, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {102, 51, 204}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {51, 127, 51}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}, {127, 127, 127},
  {127, 127, 127}, {127, 127, 127}
};

Ken Martin's avatar
Ken Martin committed
88
static double vtkMoleculeReaderBaseRadius[] = {
89 90 91
  1.2, 1.22, 1.75,  /* "H " "He" "Li" */
  1.50, 1.90, 1.80, /* "Be" "B " "C " */
  1.70, 1.60, 1.35, /* "N " "O " "F " */
92
  1.60, 2.31, 1.70,
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
  2.05, 2.00, 2.70,
  1.85, 1.81, 1.91,
  2.31, 1.74, 1.80,
  1.60, 1.50, 1.40,  /* Ti-Cu and Ge are guestimates. */
  1.40, 1.40, 1.40,
  1.60, 1.40, 1.40,
  1.90, 1.80, 2.00,
  2.00, 1.95, 1.98,
  2.44, 2.40, 2.10,  /* Sr-Rh and Ba and La are guestimates. */
  2.00, 1.80, 1.80,
  1.80, 1.80, 1.80,
  1.60, 1.70, 1.60,
  1.90, 2.20, 2.20,
  2.20, 2.15, 2.20,
  2.62, 2.30, 2.30,
  2.30, 2.30, 2.30,  /* All of these are guestimates. */
  2.30, 2.30, 2.40,
  2.30, 2.30, 2.30,
  2.30, 2.30, 2.30,
  2.40, 2.50, 2.30,
  2.30, 2.30, 2.30,  /* All but Pt and Bi are guestimates. */
  2.30, 2.30, 2.40,
  2.30, 2.40, 2.50,
  2.50, 2.40, 2.40,
  2.40, 2.40, 2.90,
  2.60, 2.30, 2.30,   /* These are all guestimates. */
  2.30, 2.30, 2.30,
  2.30, 2.30, 2.30,
  2.30, 2.30, 2.30,
  2.30, 2.30, 2.30,
  2.30, 1.50 } ;

vtkMoleculeReaderBase::vtkMoleculeReaderBase()
{
  this->FileName = NULL;
  this->BScale = 1.0;
  this->HBScale = 1.0;
130
  this->Molecule = NULL;
131
  this->AtomType = NULL;
Kyle Lutz's avatar
Kyle Lutz committed
132
  this->AtomTypeStrings = 0;
133 134 135
  this->Points = NULL;
  this->RGB = NULL;
  this->Radii = NULL;
136 137 138 139 140 141
  this->Chain = NULL;
  this->Residue = NULL;
  this->SecondaryStructures = NULL;
  this->SecondaryStructuresBegin = NULL;
  this->SecondaryStructuresEnd = NULL;
  this->IsHetatm = NULL;
Andy Cedilnik's avatar
Andy Cedilnik committed
142
  this->NumberOfAtoms = 0;
143 144

  this->SetNumberOfInputPorts(0);
145
  this->SetNumberOfOutputPorts(2);
146 147 148 149 150 151 152 153 154 155 156 157
}

vtkMoleculeReaderBase::~vtkMoleculeReaderBase()
{
  if (this->FileName)
    {
    delete [] this->FileName;
    }
  if(this->AtomType)
    {
    this->AtomType->Delete();
    }
Kyle Lutz's avatar
Kyle Lutz committed
158 159 160 161
  if(this->AtomTypeStrings)
    {
    this->AtomTypeStrings->Delete();
    }
162 163 164 165 166 167 168 169 170 171 172 173
  if(this->Points)
    {
    this->Points->Delete();
    }
  if(this->RGB)
    {
    this->RGB->Delete();
    }
  if(this->Radii)
    {
    this->Radii->Delete();
    }
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
  if(this->Chain)
    {
    this->Chain->Delete();
    }
  if(this->Residue)
    {
    this->Residue->Delete();
    }
  if(this->SecondaryStructures)
    {
    this->SecondaryStructures->Delete();
    }
  if(this->SecondaryStructuresBegin)
    {
    this->SecondaryStructuresBegin->Delete();
    }
  if(this->SecondaryStructuresEnd)
    {
    this->SecondaryStructuresEnd->Delete();
    }
  if(this->IsHetatm)
    {
    this->IsHetatm->Delete();
    }
198 199
}

200 201 202 203 204 205 206 207 208 209 210
int vtkMoleculeReaderBase::FillOutputPortInformation(int port,
                                                     vtkInformation *info)
{
  if (port == 1)
    {
    info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkMolecule");
    return 1;
    }
  return this->Superclass::FillOutputPortInformation(port, info);
}

211 212 213 214
int vtkMoleculeReaderBase::RequestData(
  vtkInformation *vtkNotUsed(request),
  vtkInformationVector **vtkNotUsed(inputVector),
  vtkInformationVector *outputVector)
215
{
216 217 218 219 220 221 222
  // get the info object
  vtkInformation *outInfo = outputVector->GetInformationObject(0);

  // get the ouptut
  vtkPolyData *output = vtkPolyData::SafeDownCast(
    outInfo->Get(vtkDataObject::DATA_OBJECT()));

223 224 225 226 227 228 229 230
  vtkInformation *outMolInfo = outputVector->GetInformationObject(1);
  if (outMolInfo)
    {
    this->Molecule = vtkMolecule::SafeDownCast(
      outMolInfo->Get(vtkDataObject::DATA_OBJECT()));
    }


231 232
  FILE *fp;

233
  if (!this->FileName)
234
    {
235
    return 0;
236 237
    }

238
  if ((fp = fopen(this->FileName, "r")) == NULL)
239
    {
240
    vtkErrorMacro(<< "Unable to open " << this->FileName);
241
    return 0;
242 243
    }
  vtkDebugMacro(<< "opening base file " << this->FileName);
244
  this->ReadMolecule(fp, output);
245
  fclose(fp);
246

247 248 249
  output->Squeeze();

  return 1;
250 251
}

252
int vtkMoleculeReaderBase::ReadMolecule(FILE *fp, vtkPolyData *output)
253 254 255 256 257 258
{
  int i;
  vtkCellArray *newBonds;

  vtkDebugMacro(<< "Scanning the Molecule file");

Andy Cedilnik's avatar
Andy Cedilnik committed
259 260 261 262
  if ( !this->AtomType )
    {
    this->AtomType = vtkIdTypeArray::New();
    }
263 264 265 266
  else
    {
    this->AtomType->Reset();
    }
267 268
  this->AtomType->SetName("atom_type");
  output->GetPointData()->AddArray(this->AtomType);
269

Kyle Lutz's avatar
Kyle Lutz committed
270 271 272 273 274 275 276 277 278 279 280
  if(!this->AtomTypeStrings)
    {
    this->AtomTypeStrings = vtkStringArray::New();
    }
  else
    {
    this->AtomTypeStrings->Reset();
    }
  this->AtomTypeStrings->SetName("atom_types");
  output->GetPointData()->AddArray(this->AtomTypeStrings);

281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
  if(!this->Residue)
    {
    this->Residue = vtkIdTypeArray::New();
    }
  else
    {
    this->Residue->Reset();
    }
  this->Residue->SetName("residue");
  output->GetPointData()->AddArray(this->Residue);

  if(!this->Chain)
    {
    this->Chain = vtkUnsignedCharArray::New();
    }
  else
    {
    this->Chain->Reset();
    }
  this->Chain->SetName("chain");
  output->GetPointData()->AddArray(this->Chain);

  if(!this->SecondaryStructures)
    {
    this->SecondaryStructures = vtkUnsignedCharArray::New();
    }
  else
    {
    this->SecondaryStructures->Reset();
    }
  this->SecondaryStructures->SetName("secondary_structures");
  output->GetPointData()->AddArray(this->SecondaryStructures);

  if(!this->SecondaryStructuresBegin)
    {
    this->SecondaryStructuresBegin = vtkUnsignedCharArray::New();
    }
  else
    {
    this->SecondaryStructuresBegin->Reset();
    }
  this->SecondaryStructuresBegin->SetName("secondary_structures_begin");
  output->GetPointData()->AddArray(this->SecondaryStructuresBegin);

  if(!this->SecondaryStructuresEnd)
    {
    this->SecondaryStructuresEnd = vtkUnsignedCharArray::New();
    }
  else
    {
    this->SecondaryStructuresEnd->Reset();
    }
  this->SecondaryStructuresEnd->SetName("secondary_structures_end");
  output->GetPointData()->AddArray(this->SecondaryStructuresEnd);

  if(!this->IsHetatm)
    {
    this->IsHetatm = vtkUnsignedCharArray::New();
    }
  else
    {
    this->IsHetatm->Reset();
    }
  this->IsHetatm->SetName("ishetatm");
  output->GetPointData()->AddArray(this->IsHetatm);

Andy Cedilnik's avatar
Andy Cedilnik committed
347 348 349 350
  if ( !this->Points )
    {
    this->Points = vtkPoints::New();
    }
351 352 353 354
  else
    {
    this->Points->Reset();
    }
355 356 357 358 359 360

  this->ReadSpecificMolecule(fp);

  vtkDebugMacro(<< "End of scanning");
  output->SetPoints(this->Points);

361 362 363
  newBonds = vtkCellArray::New();
  newBonds->Allocate(500);

364 365 366 367 368
  this->MakeBonds(this->Points, this->AtomType, newBonds);

  output->SetLines(newBonds);
  newBonds->Delete();

369
  vtkDebugMacro(<< "read " << this->NumberOfAtoms << " atoms and found "
370
                << newBonds->GetNumberOfCells() << " bonds" << endl);
371

Andy Cedilnik's avatar
Andy Cedilnik committed
372 373 374 375 376 377 378 379
  if ( this->RGB )
    {
    this->RGB->Reset();
    }
  else
    {
    this->RGB = vtkUnsignedCharArray::New();
    }
380 381 382 383 384 385
  this->RGB->SetNumberOfComponents(3);
  this->RGB->Allocate(3*this->NumberOfAtoms);
  this->RGB->SetName("rgb_colors");

  for(i=0; i < this->NumberOfAtoms; i++)
    {
386 387
    this->RGB->InsertNextTuple(
      &vtkMoleculeReaderBaseAtomColors[AtomType->GetValue(i)][0]);
388 389 390 391
    }

  output->GetPointData()->SetScalars(this->RGB);

Andy Cedilnik's avatar
Andy Cedilnik committed
392 393 394 395 396 397 398 399
  if ( this->Radii )
    {
    this->Radii->Reset();
    }
  else
    {
    this->Radii = vtkFloatArray::New();
    }
400 401 402 403
  this->Radii->SetNumberOfComponents(3);
  this->Radii->Allocate(3 * this->NumberOfAtoms);
  this->Radii->SetName("radius");

404 405
  // We're obliged here to insert the scalars "radius" 3 times to make it a
  // vector in order to use Glyph3D to color AND scale at the same time.
406 407 408

  for(i=0; i < this->NumberOfAtoms; i++)
    {
409 410
    this->Radii->InsertNextTuple3(
      vtkMoleculeReaderBaseRadius[AtomType->GetValue(i)],
411 412 413 414 415 416 417 418 419 420
      vtkMoleculeReaderBaseRadius[AtomType->GetValue(i)],
      vtkMoleculeReaderBaseRadius[AtomType->GetValue(i)]);
    }

  output->GetPointData()->SetVectors(this->Radii);

  return 0;
}

int vtkMoleculeReaderBase::MakeBonds(vtkPoints *newPts,
421 422
                                     vtkIdTypeArray *atype,
                                     vtkCellArray *newBonds)
423
{
424 425 426
  int i, j, k;
  int nbonds;
  double dx, dy, dz;
427
  double max, dist, radius;
Ken Martin's avatar
Ken Martin committed
428
  double X[3], Y[3];
429 430
  vtkIdType bond[2];

431 432 433 434 435 436 437 438
  vtkNew<vtkPolyData> ds;
  ds->SetPoints(newPts);

  vtkNew<vtkPointLocator> locator;
  locator->SetDataSet(ds.GetPointer());

  vtkNew<vtkIdList> result;

439 440 441 442 443 444 445 446 447 448 449
  // Add atoms to the molecule first because an atom must
  // must be declared before bonds involving it.
  if (this->Molecule)
    {
    for(i = 0; i < this->NumberOfAtoms; i++)
      {
      newPts->GetPoint(i, X);
      this->Molecule->AppendAtom(atype->GetValue(i) + 1, X[0], X[1], X[2]);
      }
    }

450
  nbonds = 0;
451
  for (i = this->NumberOfAtoms - 1; i > 0; i--)
452 453
    {
    bond[0] = i;
454
    newPts->GetPoint(i, X);
455 456 457 458 459 460 461 462 463

    /* Find all the atoms in the neighborhood at the max acceptable
     * bond distance
     */
    radius =
      (vtkMoleculeReaderBaseCovRadius[atype->GetValue(i)] + 2.0 + 0.56) *
      std::max(BScale, HBScale);
    locator->FindPointsWithinRadius(radius, X, result.GetPointer());
    for (k = result->GetNumberOfIds()-1; k >= 0; k--)
464
      {
465 466 467 468 469 470
      j = result->GetId(k);
      // Skip points with which a bond may have already been created
      if (j >= i)
        {
        continue;
        }
471 472 473 474 475 476 477 478
      /*
       * The outer loop index 'i' is AFTER the inner loop 'j': 'i'
       * leads 'j' in the list: since hydrogens traditionally follow
       * the heavy atom they're bonded to, this makes it easy to quit
       * bonding to hydrogens after one bond is made by breaking out of
       * the 'j' loop when 'i' is a hydrogen and we make a bond to it.
       * Working backwards like this makes it easy to find the heavy
       * atom that came 'just before' the Hydrogen. mp
479
       * Base distance criteria on vdw...lb
480 481
       */

482
      // Never bond hydrogens to each other
483
      if (atype->GetValue(i) == 0 && atype->GetValue(j) == 0)
Ken Martin's avatar
Ken Martin committed
484 485 486
        {
        continue;
        }
487 488 489 490 491 492

      dist = vtkMoleculeReaderBaseCovRadius[atype->GetValue(i)] +
        vtkMoleculeReaderBaseCovRadius[atype->GetValue(j)] + 0.56;
      max = dist*dist;

      if(atype->GetValue(i) == 0 || atype->GetValue(j) == 0)
493
        {
494
        max *= HBScale;
495
        }
496
      else
497
        {
498
        max *= BScale;
499
        }
500

501
      newPts->GetPoint(j, Y);
502 503 504
      dx = X[0] - Y[0];
      dy = X[1] - Y[1];
      dz = X[2] - Y[2];
505 506 507
      dist = dx * dx + dy * dy + dz * dz;

      if (dist <= max)
Ken Martin's avatar
Ken Martin committed
508
        {
509 510
        bond[1] = j;
        newBonds->InsertNextCell(2, bond);
511

512 513 514 515 516
        // Add bond to the molecule
        if (this->Molecule)
          {
          this->Molecule->AppendBond(bond[0], bond[1]);
          }
517

518
        nbonds++;
519
        }
520
      }
521
    result->Reset();
522
    }
523
  newBonds->Squeeze();
524 525 526
  return nbonds;
}

527
int vtkMoleculeReaderBase::MakeAtomType(const char *atype)
528
{
529 530 531
  int anum = 0;
  char a = toupper(atype[0]);
  char b = toupper(atype[1]);
532

533
  switch (a)
534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679
    {
  case 'A':
    if(b == 'C') anum = 89;
    else if(b == 'G') anum = 47;
    else if(b == 'L') anum = 13;
    else if(b == 'M') anum = 95;
    else if(b == 'R') anum = 18;
    else if(b == 'S') anum = 33;
    else if(b == 'T') anum = 85;
    else if(b == 'U') anum = 79;
    break;
  case 'B':
    if(b == 'A') anum = 56;
    else if(b == 'E') anum = 4;
    else if(b == 'I') anum = 83;
    else if(b == 'K') anum = 97;
    else if(b == 'R') anum = 35;
    else anum = 5;
    break;
  case 'C':
    if(b == 'L') anum = 17;
    else if(b == 'O') anum = 27;
    else if(b == 'R') anum = 24;
    else if(b == 'S') anum = 55;
    else if(b == 'U') anum = 29;
    else if(b == '0') anum = 6;
    else anum = 6;
    break;
  case 'D':
    anum = 66;
    break;
  case 'E':
    if(b == 'R') anum = 68;
    else if(b == 'S') anum = 99;
    else if(b == 'U') anum = 63;
    break;
  case 'F':
    if(b == 'E') anum = 26;
    else if(b == 'M') anum = 100;
    else if(b == 'R') anum = 87;
    else anum = 9;
    break;
  case 'G':
    if(b == 'A') anum = 31;
    else if(b == 'D') anum = 64;
    else if(b == 'E') anum = 32;
    break;
  case 'H':
    anum = 1;
    break;
  case 'I':
    if(b == 'N') anum = 49;
    else if(b == 'R') anum = 77;
    else anum = 53;
    break;
  case 'K':
    if(b == 'R') anum = 36;
    else anum = 19;
    break;
  case 'L':
    if(b == 'A') anum = 57;
    else if(b == 'I') anum = 3;
    else if(b == 'R') anum = 103;
    else if(b == 'U') anum = 71;
    break;
  case 'M':
    if(b == 'D') anum = 101;
    else if(b == 'G') anum = 12;
    else if(b == 'N') anum = 25;
    else if(b == 'O') anum = 42;
    break;
  case 'N':
    if(b == 'I') anum = 28;
    else anum = 7;
    break;
  case 'O':
    anum = 8;
    break;
  case 'P':
    if(b == 'A') anum = 91;
    else if(b == 'B') anum = 82;
    else if(b == 'D') anum = 46;
    else if(b == 'M') anum = 61;
    else if(b == 'O') anum = 84;
    else if(b == 'R') anum = 59;
    else if(b == 'T') anum = 78;
    else if(b == 'U') anum = 94;
    else anum = 15;
    break;
  case 'R':
    if(b == 'A') anum = 88;
    else if(b == 'B') anum = 37;
    else if(b == 'E') anum = 75;
    else if(b == 'H') anum = 45;
    else if(b == 'N') anum = 86;
    else if(b == 'U') anum = 44;
    break;
  case 'S':
    if(b == 'I') anum = 14;
    else if(b == 'R') anum = 38;
    else anum = 16;
    break;
  case 'T':
    if(b == 'A') anum = 73;
    else if(b == 'B') anum = 65;
    else if(b == 'C') anum = 43;
    else if(b == 'E') anum = 52;
    else if(b == 'H') anum = 90;
    else if(b == 'I') anum = 22;
    else if(b == 'L') anum = 81;
    else if(b == 'M') anum = 69;
    break;
  case 'U':
    anum = 92;
    break;
  case 'V':
    anum = 23;
    break;
  case 'W':
    anum = 74;
    break;
  case 'X':
    anum = 54;
    break;
  case 'Y':
    if(b == 'B') anum = 70;
    else anum = 39;
    break;
  case 'Z':
    if(b == 'N') anum = 30;
    else anum = 40;
    break;
  case ' ':
    anum = 104;
    break;
  default:
    anum = 6;
    break;
    }
  return (anum-1);
}

void vtkMoleculeReaderBase::PrintSelf(ostream& os, vtkIndent indent)
{
  this->Superclass::PrintSelf(os,indent);

680
  os << indent << "File Name: "
681 682 683 684
    << (this->FileName ? this->FileName : "(none)") << endl;
  os << indent << "NumberOfAtoms: " << this->NumberOfAtoms  << endl;
  os << indent << "HBScale: " << this->HBScale << endl;
  os << indent << "BScale: " << this->BScale << endl;
685
}