Ignore:
Timestamp:
May 21, 2008, 11:15:32 AM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
a6e314
Parents:
927aba
Message:

command line parsing outsourced to ParseCommandLineOptions(), cases in main() listed in alphabetical order, setting of cell_size by hand replaced through already present SetDimension()

new function ParseCommandLineOptions() does the command line parsing, subsequently some variables weren't needed anymore in main().
sorted the cases in switch in main() of the interactive menu in alphabetical order.
In 't'ranslate and 'c'enter cases, SetDimension() and by-hand setting cell_size was present. The later was thrown out

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/builder.cpp

    r927aba r3ce105  
    258258void CenterAtoms(molecule *mol)
    259259{
    260   vector x;
     260  vector x, y;
    261261  char choice;  // menu choice char
    262   double min[3];
    263   int j;
    264262 
    265263  cout << Verbose(0) << "===========CENTER ATOMS=========================" << endl;
     
    267265  cout << Verbose(0) << " b - on center of gravity" << endl;
    268266  cout << Verbose(0) << " c - within box with additional boundary" << endl;
     267  cout << Verbose(0) << " d - within given simulation box" << endl;
    269268  cout << Verbose(0) << "all else - go back" << endl;
    270269  cout << Verbose(0) << "===============================================" << endl;
     
    288287      for (int i=0;i<3;i++) {
    289288        cout << Verbose(0) << "Enter axis " << i << " boundary: ";
    290         cin >> min[i];
     289        cin >> y.x[i];
    291290      }
    292291      mol->CenterEdge((ofstream *)&cout, &x);  // make every coordinate positive
    293       mol->SetBoxDimension(&x);  // update Box of atoms by boundary
    294       // translate each coordinate by boundary
    295       j=-1;
    296       for (int i=0;i<NDIM;i++) {
    297         j += i+1;
    298         x.x[i] = min[i];
    299         mol->cell_size[j] += x.x[i]*2.;
     292      mol->Translate(&y); // translate by boundary
     293      mol->SetBoxDimension(&(x+y*2));  // update Box of atoms by boundary
     294      break;
     295    case 'd':
     296      cout << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
     297      for (int i=0;i<3;i++) {
     298        cout << Verbose(0) << "Enter axis " << i << " boundary: ";
     299        cin >> x.x[i];
    300300      }
    301       mol->Translate(&x);
     301      // center
     302      mol->CenterInBox((ofstream *)&cout, &x);
     303      // update Box of atoms by boundary
     304      mol->SetBoxDimension(&x);
    302305      break;
    303306  }
     
    696699};
    697700
    698 /********************************************** Main routine **************************************/
    699 
    700 int main(int argc, char **argv)
     701/** Parses the command line options.
     702 * \param argc argument count
     703 * \param **argv arguments array
     704 * \param *mol molecule structure
     705 * \param *periode elements structure
     706 * \param configuration config file structure
     707 * \param *ConfigFileName pointer to config file name in **argv
     708 * \param *ElementsFileName pointer to elements db file name in **argv
     709 * \return exit code (0 - successful, all else - something's wrong)
     710 */
     711int ParseCommandLineOptions(int argc, char **argv, molecule *&mol, periodentafel *&periode, config& configuration, char *&ConfigFileName, char *&ElementsFileName)
    701712{
    702   periodentafel *periode = new periodentafel; // and a period table of all elements
    703   molecule *mol = new molecule(periode);    // first we need an empty molecule
    704   config configuration;
    705   double tmp1;
    706   double bond, min_bond;
    707   atom *first, *second;
    708713  element *finder;
    709   char choice;  // menu choice char
    710714  vector x,y,z,n;  // coordinates for absolute point in cell volume
    711         double *factor; // unit factor if desired
    712   bool valid; // flag if input was valid or not
     715  double *factor; // unit factor if desired
    713716  ifstream test;
    714717  ofstream output;
    715718  string line;
    716   char filename[MAXSTRINGSIZE];
    717   char *ConfigFileName = NULL;
    718   char *ElementsFileName = NULL;
     719  atom *first;
    719720  int ExitFlag = 0;
    720   int Z;
    721   int j, axis, count, faktor;
    722   int *MinimumRingSize = NULL;
     721  int j;
    723722  enum ConfigStatus config_present = absent;
    724   MoleculeLeafClass *Subgraphs = NULL;
    725723  clock_t start,end;
    726   element **Elements;
    727   vector **Vectors;
    728724  int argptr;
    729 
    730   // =========================== PARSE COMMAND LINE OPTIONS ====================================
     725 
    731726  if (argc > 1) { // config file specified as option
    732727    // 1. : Parse options that just set variables or print help
    733         argptr = 1;
    734         do {
    735           if (argv[argptr][0] == '-') {
     728    argptr = 1;
     729    do {
     730      if (argv[argptr][0] == '-') {
    736731        cout << Verbose(0) << "Recognized command line argument: " << argv[argptr][1] << ".\n";
    737732        argptr++;
     
    744739            cout << "or simply " << argv[0] << " without arguments for interactive session." << endl;
    745740            cout << "\t-a Z x1 x2 x3\tAdd new atom of element Z at coordinates (x1,x2,x3)." << endl;
     741            cout << "\t-b x1 x2 x3\tCenter atoms in domain with given edge lengths of (x1,x2,x3)." << endl;
    746742            cout << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl;
    747743            cout << "\t-e <file>\tSets the element database to be parsed from this file (default: elements.db in same dir as " << argv[0] << ")." << endl;
     
    756752            delete(mol);
    757753            delete(periode);
    758             return (0);
     754            return (1);
    759755            break;
    760756          case 'v':
     
    764760            delete(mol);
    765761            delete(periode);
    766             return (0);
     762            return (1);
    767763            break;
    768764          case 'e':
     
    775771            break;
    776772        }
    777           } else
    778             argptr++;
     773      } else
     774        argptr++;
    779775    } while (argptr < argc);
    780        
    781         // 2. Parse the element database
     776   
     777    // 2. Parse the element database
    782778    if (periode->LoadPeriodentafel(ElementsFileName))
    783779      cout << Verbose(0) << "Element list loaded successfully." << endl;
     
    785781      cout << Verbose(0) << "Element list loading failed." << endl;
    786782   
    787         // 3. Find config file name and parse if possible
     783    // 3. Find config file name and parse if possible
    788784    if (argv[1][0] != '-') {
    789785      cout << Verbose(0) << "Config file given." << endl;
     
    827823    argptr = 1;
    828824    do {
     825      cout << "Current Command line argument: " << argv[argptr] << "." << endl;
    829826      if (argv[argptr][0] == '-') {
    830827        argptr++;
     
    834831              ExitFlag = 1;
    835832              cout << Verbose(1) << "Parsing xyz file for new atoms." << endl;
    836               if (!mol->AddXYZFile(argv[argptr++]))
     833              if (!mol->AddXYZFile(argv[argptr]))
    837834                cout << Verbose(2) << "File not found." << endl;
    838835              else
     
    844841          }
    845842        }
    846         if (config_present != empty) {
    847           if (config_present == present) {
    848             switch(argv[argptr-1][1]) {
    849               case 't':
    850                 ExitFlag = 1;
    851                 cout << Verbose(1) << "Translating all ions to new origin." << endl;
    852                 for (int i=0;i<3;i++)
    853                   x.x[i] = atof(argv[argptr+i]);
    854                 mol->Translate((const vector *)&x);
    855                 argptr+=3;
    856                 break;
    857               case 'a':
    858                 ExitFlag = 1;
    859                 cout << Verbose(1) << "Adding new atom." << endl;
    860                 first = new atom;
    861                 for (int i=0;i<3;i++)
    862                   first->x.x[i] = atof(argv[argptr+1+i]);
    863                 finder = periode->start;
    864                 while (finder != periode->end) {
    865                   finder = finder->next;
    866                   if (strncmp(finder->symbol,argv[argptr+1],3) == 0) {
    867                     first->type = finder;
    868                     break;
    869                   }
     843        if (config_present == present) {
     844          switch(argv[argptr-1][1]) {
     845            case 't':
     846              ExitFlag = 1;
     847              cout << Verbose(1) << "Translating all ions to new origin." << endl;
     848              for (int i=0;i<3;i++)
     849                x.x[i] = atof(argv[argptr+i]);
     850              mol->Translate((const vector *)&x);
     851              argptr+=3;
     852              break;
     853            case 'a':
     854              ExitFlag = 1;
     855              cout << Verbose(1) << "Adding new atom." << endl;
     856              first = new atom;
     857              for (int i=0;i<3;i++)
     858                first->x.x[i] = atof(argv[argptr+1+i]);
     859              finder = periode->start;
     860              while (finder != periode->end) {
     861                finder = finder->next;
     862                if (strncmp(finder->symbol,argv[argptr+1],3) == 0) {
     863                  first->type = finder;
     864                  break;
    870865                }
    871                 mol->AddAtom(first);  // add to molecule
    872                 argptr+=4;
    873                 break;
    874               case 's':
    875                 ExitFlag = 1;
    876                 j = -1;
    877                 cout << Verbose(1) << "Scaling all ion positions by factor." << endl;
    878                 factor = (double *) Malloc(sizeof(double)*NDIM, "main: *factor");
    879                 factor[0] = atof(argv[argptr]);
    880                 if (argc > argptr+1)
    881                   argptr++;
    882                 factor[1] = atof(argv[argptr]);
    883                 if (argc > argptr+1)
    884                   argptr++;
    885                 factor[2] = atof(argv[argptr]);
    886                 mol->Scale(&factor);
    887                 for (int i=0;i<3;i++) {
    888                   j += i+1;
    889                   x.x[i] = atof(argv[3+i]);
    890                   mol->cell_size[j]*=factor[i];
     866              }
     867              mol->AddAtom(first);  // add to molecule
     868              argptr+=4;
     869              break;
     870            case 's':
     871              ExitFlag = 1;
     872              j = -1;
     873              cout << Verbose(1) << "Scaling all ion positions by factor." << endl;
     874              factor = (double *) Malloc(sizeof(double)*NDIM, "main: *factor");
     875              factor[0] = atof(argv[argptr]);
     876              if (argc > argptr+1)
     877                argptr++;
     878              factor[1] = atof(argv[argptr]);
     879              if (argc > argptr+1)
     880                argptr++;
     881              factor[2] = atof(argv[argptr]);
     882              mol->Scale(&factor);
     883              for (int i=0;i<3;i++) {
     884                j += i+1;
     885                x.x[i] = atof(argv[3+i]);
     886                mol->cell_size[j]*=factor[i];
     887              }
     888              Free((void **)&factor, "main: *factor");
     889              argptr+=1;
     890              break;
     891            case 'b':
     892              ExitFlag = 1;
     893              j = -1;
     894              cout << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
     895              j=-1;
     896              for (int i=0;i<3;i++) {
     897                j += i+1;
     898                x.x[i] = atof(argv[argptr++]);
     899                mol->cell_size[j] += x.x[i]*2.;
     900              }
     901              // center
     902              mol->CenterInBox((ofstream *)&cout, &x);
     903              // update Box of atoms by boundary
     904              mol->SetBoxDimension(&x);
     905              break;
     906            case 'c':
     907              ExitFlag = 1;
     908              j = -1;
     909              cout << Verbose(1) << "Centering atoms in config file within given additional boundary." << endl;
     910              // make every coordinate positive
     911              mol->CenterEdge((ofstream *)&cout, &x);
     912              // update Box of atoms by boundary
     913              mol->SetBoxDimension(&x);
     914              // translate each coordinate by boundary
     915              j=-1;
     916              for (int i=0;i<3;i++) {
     917                j += i+1;
     918                x.x[i] = atof(argv[argptr++]);
     919                mol->cell_size[j] += x.x[i]*2.;
     920              }
     921              mol->Translate((const vector *)&x);
     922              break;
     923            case 'r':
     924              ExitFlag = 1;
     925              cout << Verbose(1) << "Converting config file from supposed old to new syntax." << endl;
     926              break;
     927            case 'f':
     928              if (ExitFlag ==0) ExitFlag = 2;  // only set if not already by other command line switch
     929              cout << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl;
     930              if (argc >= argptr+2) {
     931                cout << Verbose(0) << "Creating connection matrix..." << endl;
     932                start = clock();
     933                mol->CreateAdjacencyList((ofstream *)&cout, atof(argv[argptr++]));
     934                cout << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;
     935                if (mol->first->next != mol->last) {
     936                  mol->FragmentMolecule((ofstream *)&cout, atoi(argv[argptr]), &configuration);
    891937                }
    892                 Free((void **)&factor, "main: *factor");
     938                end = clock();
     939                cout << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
    893940                argptr+=1;
    894                 break;
    895               case 'c':
    896                 ExitFlag = 1;
    897                 j = -1;
    898                 cout << Verbose(1) << "Centering atoms in config file within given additional boundary." << endl;
    899                 // make every coordinate positive
    900                 mol->CenterEdge((ofstream *)&cout, &x);
    901                 // update Box of atoms by boundary
    902                 mol->SetBoxDimension(&x);
    903                 // translate each coordinate by boundary
    904                 j=-1;
    905                 for (int i=0;i<3;i++) {
    906                   j += i+1;
    907                   x.x[i] = atof(argv[argptr++]);
    908                   mol->cell_size[j] += x.x[i]*2.;
    909                 }
    910                 mol->Translate((const vector *)&x);
    911                 break;
    912               case 'r':
    913                 ExitFlag = 1;
    914                 cout << Verbose(1) << "Converting config file from supposed old to new syntax." << endl;
    915                 break;
    916               case 'f':
    917                 if (ExitFlag ==0) ExitFlag = 2;  // only set if not already by other command line switch
    918                 cout << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl;
    919                 if (argc >= argptr+2) {
    920                   cout << Verbose(0) << "Creating connection matrix..." << endl;
    921                   start = clock();
    922                   mol->CreateAdjacencyList((ofstream *)&cout, atof(argv[argptr++]));
    923                   cout << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;
    924                   if (mol->first->next != mol->last) {
    925                     mol->FragmentMolecule((ofstream *)&cout, atoi(argv[argptr]), &configuration);
    926                   }
    927                   end = clock();
    928                   cout << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
    929                   argptr+=1;
    930                 } else {
    931                   cerr << "Not enough arguments for fragmentation: -f <max. bond distance> <bond order>" << endl;
    932                 }
    933                 break;
    934               default:   // no match? Step on
    935                 argptr++;
    936                 break;
    937             }
     941              } else {
     942                cerr << "Not enough arguments for fragmentation: -f <max. bond distance> <bond order>" << endl;
     943              }
     944              break;
     945            default:   // no match? Step on
     946              argptr++;
     947              break;
    938948          }
    939949        }
    940           } else argptr++;
    941         } while (argptr < argc);
     950      } else argptr++;
     951    } while (argptr < argc);
    942952    if (ExitFlag == 1) // 1 means save and exit
    943953      SaveConfig(ConfigFileName, &configuration, periode, mol);
     
    954964    configuration.RetrieveConfigPathAndName("main_pcp_linux");
    955965  }
    956 
     966  return(0);
     967};
     968
     969/********************************************** Main routine **************************************/
     970
     971int main(int argc, char **argv)
     972{
     973  periodentafel *periode = new periodentafel; // and a period table of all elements
     974  molecule *mol = new molecule(periode);    // first we need an empty molecule
     975  config configuration;
     976  double tmp1;
     977  double bond, min_bond;
     978  atom *first, *second;
     979  char choice;  // menu choice char
     980  vector x,y,z,n;  // coordinates for absolute point in cell volume
     981        double *factor; // unit factor if desired
     982  bool valid; // flag if input was valid or not
     983  ifstream test;
     984  ofstream output;
     985  string line;
     986  char filename[MAXSTRINGSIZE];
     987  char *ConfigFileName = NULL;
     988  char *ElementsFileName = NULL;
     989  int Z;
     990  int j, axis, count, faktor;
     991  int *MinimumRingSize = NULL;
     992  MoleculeLeafClass *Subgraphs = NULL;
     993  clock_t start,end;
     994  element **Elements;
     995  vector **Vectors;
     996
     997  // =========================== PARSE COMMAND LINE OPTIONS ====================================
     998  j = ParseCommandLineOptions(argc, argv, mol, periode, configuration, ConfigFileName, ElementsFileName);
     999  if (j) return j;  // something went wrong
    9571000 
    9581001  // General stuff
     
    10031046    switch (choice) {
    10041047      default:
    1005       case 'q': // quit
    1006         break;
    1007        
    10081048      case 'a': // add atom
    10091049        AddAtoms(periode, mol);
     
    10111051        break;
    10121052     
     1053      case 'b': // scale a bond
     1054        cout << Verbose(0) << "Scaling bond length between two atoms." << endl;
     1055        first = mol->AskAtom("Enter first (fixed) atom: ");
     1056        second = mol->AskAtom("Enter second (shifting) atom: ");
     1057        min_bond = 0.;
     1058        for (int i=0;i<3;i++)
     1059          min_bond += (first->x.x[i]-second->x.x[i])*(first->x.x[i] - second->x.x[i]);
     1060        min_bond = sqrt(min_bond);
     1061        cout << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << min_bond << " a.u." << endl;
     1062        cout << Verbose(0) << "Enter new bond length [a.u.]: ";
     1063        cin >> bond;
     1064        for (int i=0;i<3;i++) {
     1065          second->x.x[i] -= (second->x.x[i]-first->x.x[i])/min_bond*(min_bond-bond);
     1066        }
     1067        //cout << Verbose(0) << "New coordinates of Atom " << second->nr << " are: ";
     1068        //second->Output(second->type->No, 1, (ofstream *)&cout);       
     1069        break;
     1070
     1071      case 'c': // unit scaling of the metric
     1072       cout << Verbose(0) << "Angstroem -> Bohrradius: 1.8897261\t\tBohrradius -> Angstroem: 0.52917721" << endl;
     1073       cout << Verbose(0) << "Enter three factors: ";
     1074       factor = new double[NDIM];
     1075       cin >> factor[0];
     1076       cin >> factor[1];
     1077       cin >> factor[2];
     1078       valid = true;
     1079       mol->Scale(&factor);
     1080       delete[](factor);
     1081       break;
     1082       
    10131083      case 'd': // duplicate the periodic cell along a given axis, given times
    10141084        cout << Verbose(0) << "State the axis [(+-)123]: ";
     
    10201090        if (mol->AtomCount != 0) {  // if there is more than none
    10211091          count = mol->AtomCount;   // is changed becausing of adding, thus has to be stored away beforehand
    1022           Elements = (element **) Malloc(sizeof(element *)*count, "main: duplicateCell - **Elements");
    1023           Vectors = (vector **) Malloc(sizeof(vector *)*count, "main: duplicateCell - **Vectors");
     1092          Elements = new element *[count];
     1093          Vectors = new vector *[count];
    10241094          j = 0;
    10251095          first = mol->start;
     
    10481118            mol->CreateAdjacencyList((ofstream *)&cout, mol->BondDistance);
    10491119          // free memory
    1050           Free((void **)&Elements, "main: duplicateCell - **Elements");
    1051           Free((void **)&Vectors, "main: duplicateCell - **Vectors");
     1120          delete[](Elements);
     1121          delete[](Vectors);
    10521122          // correct cell size
    10531123          if (axis < 0) { // if sign was negative, we have to translate everything
     
    10611131        break;
    10621132     
    1063       case 'g': // center the atoms
    1064         CenterAtoms(mol);
    1065         break;
    1066        
    1067       case 'b': // scale a bond
    1068         cout << Verbose(0) << "Scaling bond length between two atoms." << endl;
    1069         first = mol->AskAtom("Enter first (fixed) atom: ");
    1070         second = mol->AskAtom("Enter second (shifting) atom: ");
    1071         min_bond = 0.;
    1072         for (int i=0;i<3;i++)
    1073           min_bond += (first->x.x[i]-second->x.x[i])*(first->x.x[i] - second->x.x[i]);
    1074         min_bond = sqrt(min_bond);
    1075         cout << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << min_bond << " a.u." << endl;
    1076         cout << Verbose(0) << "Enter new bond length [a.u.]: ";
    1077         cin >> bond;
    1078         for (int i=0;i<3;i++) {
    1079           second->x.x[i] -= (second->x.x[i]-first->x.x[i])/min_bond*(min_bond-bond);
    1080         }
    1081         //cout << Verbose(0) << "New coordinates of Atom " << second->nr << " are: ";
    1082         //second->Output(second->type->No, 1, (ofstream *)&cout);       
    1083         break;
    1084 
    1085       case 'i': // align all atoms
    1086         AlignAtoms(periode, mol);
    1087         break;
    1088 
    1089       case 'm': // mirror atoms along a given axis
    1090         MirrorAtoms(mol);
    1091         break;
    1092        
    1093       case 't': // translate all atoms
    1094              cout << Verbose(0) << "Enter translation vector." << endl;       
    1095              x.AskPosition(mol->cell_size,0);
    1096        mol->Translate((const vector *)&x);
    1097              break;
    1098  
    10991133      case 'e': // edit each field of the configuration
    11001134       configuration.Edit(mol);
    11011135       break;
    1102        
    1103       case 'c': // unit scaling of the metric
    1104        cout << Verbose(0) << "Angstroem -> Bohrradius: 1.8897261\t\tBohrradius -> Angstroem: 0.52917721" << endl;
    1105          cout << Verbose(0) << "Enter three factors: ";
    1106        factor = (double *) Malloc(sizeof(double)*NDIM, "main: *factor");
    1107        cin >> factor[0];
    1108        cin >> factor[1];
    1109        cin >> factor[2];
    1110        valid = true;
    1111        mol->Scale(&factor);
    1112              Free((void **)&factor, "main: *factor");
    1113        break;
    1114                          
    1115       case 'r': // remove atom
    1116         RemoveAtoms(mol);       
     1136 
     1137      case 'f':
     1138        FragmentAtoms(mol, &configuration);
    11171139        break;
    11181140       
     1141      case 'g': // center the atoms
     1142        CenterAtoms(mol);
     1143        break;
     1144       
     1145      case 'i': // align all atoms
     1146        AlignAtoms(periode, mol);
     1147        break;
     1148
    11191149      case 'l': // measure distances or angles
    11201150        MeasureAtoms(periode, mol);
    11211151        break;
    11221152
    1123       case 'p': // parse and XYZ file
    1124         cout << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
    1125         do {
    1126           cout << Verbose(0) << "Enter file name: ";
    1127           cin >> filename;
    1128         } while (!mol->AddXYZFile(filename));
    1129         break;
    1130 
     1153      case 'm': // mirror atoms along a given axis
     1154        MirrorAtoms(mol);
     1155        break;
     1156       
    11311157      case 'o': // create the connection matrix
    11321158        cout << Verbose(0) << "What's the maximum bond distance: ";
     
    11471173        break;
    11481174       
    1149       case 'f':
    1150         FragmentAtoms(mol, &configuration);
    1151         break;
     1175      case 'p': // parse and XYZ file
     1176        cout << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
     1177        do {
     1178          cout << Verbose(0) << "Enter file name: ";
     1179          cin >> filename;
     1180        } while (!mol->AddXYZFile(filename));
     1181        break;
     1182
     1183      case 'q': // quit
     1184        break;
    11521185       
     1186      case 'r': // remove atom
     1187        RemoveAtoms(mol);       
     1188        break;
     1189       
     1190      case 's': // save to config file
     1191        SaveConfig(ConfigFileName, &configuration, periode, mol);
     1192        break;
     1193
     1194      case 't': // translate all atoms
     1195       cout << Verbose(0) << "Enter translation vector." << endl;       
     1196       x.AskPosition(mol->cell_size,0);
     1197       mol->Translate((const vector *)&x);
     1198       break;
     1199 
     1200      case 'T':
     1201        testroutine(mol);
     1202        break;
     1203     
    11531204      case 'u': // change an atom's element
    11541205        first = NULL;
     
    11611212        first->type = periode->FindElement(Z);
    11621213        cout << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl;   
    1163         break;
    1164        
    1165       case 'T':
    1166         testroutine(mol);
    1167         break;
    1168      
    1169       case 's': // save to config file
    1170         SaveConfig(ConfigFileName, &configuration, periode, mol);
    11711214        break;
    11721215    };
Note: See TracChangeset for help on using the changeset viewer.