Ignore:
Timestamp:
Jul 24, 2009, 10:38:32 AM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
53d153
Parents:
a048fa (diff), 47548d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Frederik Heber <heber@…> (07/23/09 14:23:32)
git-committer:
Frederik Heber <heber@…> (07/24/09 10:38:32)
Message:

Merge branch 'master' into ConcaveHull

Conflicts:

molecuilder/src/analyzer.cpp
molecuilder/src/bond.cpp
molecuilder/src/boundary.cpp
molecuilder/src/boundary.hpp
molecuilder/src/builder.cpp
molecuilder/src/config.cpp
molecuilder/src/datacreator.cpp
molecuilder/src/datacreator.hpp
molecuilder/src/defs.hpp
molecuilder/src/ellipsoid.cpp
molecuilder/src/joiner.cpp
molecuilder/src/molecules.cpp
molecuilder/src/molecules.hpp
molecuilder/src/parser.cpp
molecuilder/src/parser.hpp

merges:

compilation fixes:

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/builder.cpp

    ra048fa rc3a303  
    282282    case 'a':
    283283      cout << Verbose(0) << "Centering atoms in config file on origin." << endl;
    284       mol->CenterOrigin((ofstream *)&cout, &x);
     284      mol->CenterOrigin((ofstream *)&cout);
    285285      break;
    286286    case 'b':
    287287      cout << Verbose(0) << "Centering atoms in config file on center of gravity." << endl;
    288       mol->CenterGravity((ofstream *)&cout, &x);
     288      mol->CenterPeriodic((ofstream *)&cout);
    289289      break;
    290290    case 'c':
     
    295295      }
    296296      mol->CenterEdge((ofstream *)&cout, &x);  // make every coordinate positive
    297       mol->Translate(&y); // translate by boundary
     297      mol->Center.AddVector(&y); // translate by boundary
    298298      helper.CopyVector(&y);
    299299      helper.Scale(2.);
     
    307307        cin >> x.x[i];
    308308      }
     309      // update Box of atoms by boundary
     310      mol->SetBoxDimension(&x);
    309311      // center
    310312      mol->CenterInBox((ofstream *)&cout);
    311       // update Box of atoms by boundary
    312       mol->SetBoxDimension(&x);
    313313      break;
    314314  }
     
    463463      cin >> tmp1;
    464464      first = mol->start;
    465       while(first->next != mol->end) {
    466         first = first->next;
     465      second = first->next;
     466      while(second != mol->end) {
     467        first = second;
     468        second = first->next;
    467469        if (first->x.DistanceSquared((const Vector *)&second->x) > tmp1*tmp1) // distance to first above radius ...
    468470          mol->RemoveAtom(first);
     
    472474      cout << Verbose(0) << "Which axis is it: ";
    473475      cin >> axis;
    474       cout << Verbose(0) << "Left inward boundary: ";
     476      cout << Verbose(0) << "Lower boundary: ";
    475477      cin >> tmp1;
    476       cout << Verbose(0) << "Right inward boundary: ";
     478      cout << Verbose(0) << "Upper boundary: ";
    477479      cin >> tmp2;
    478480      first = mol->start;
    479       while(first->next != mol->end) {
    480         first = first->next;
    481         if ((first->x.x[axis] > tmp2) || (first->x.x[axis] < tmp1)) // out of boundary ...
     481      second = first->next;
     482      while(second != mol->end) {
     483        first = second;
     484        second = first->next;
     485        if ((first->x.x[axis] < tmp1) || (first->x.x[axis] > tmp2)) {// out of boundary ...
     486          //cout << "Atom " << *first << " with " << first->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl;
    482487          mol->RemoveAtom(first);
     488        }
    483489      }
    484490      break;
     
    644650  cout << Verbose(0) << "all else - go back" << endl;
    645651  cout << Verbose(0) << "===============================================" << endl;
    646   if (molecules->NumberOfActiveMolecules() > 0)
     652  if (molecules->NumberOfActiveMolecules() > 1)
    647653    cout << Verbose(0) << "WARNING: There is more than one molecule active! Atoms will be added to each." << endl;
    648654  cout << Verbose(0) << "INPUT: ";
     
    655661
    656662    case 'a': // add atom
    657       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     663      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     664        if ((*ListRunner)->ActiveFlag) {
    658665        mol = *ListRunner;
    659666        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    663670
    664671    case 'b': // scale a bond
    665       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     672      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     673        if ((*ListRunner)->ActiveFlag) {
    666674        mol = *ListRunner;
    667675        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    685693
    686694    case 'c': // unit scaling of the metric
    687       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     695      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     696        if ((*ListRunner)->ActiveFlag) {
    688697        mol = *ListRunner;
    689698        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    701710
    702711    case 'l': // measure distances or angles
    703       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     712      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     713        if ((*ListRunner)->ActiveFlag) {
    704714        mol = *ListRunner;
    705715        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    709719
    710720    case 'r': // remove atom
    711       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     721      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     722        if ((*ListRunner)->ActiveFlag) {
    712723        mol = *ListRunner;
    713724        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    717728
    718729    case 'u': // change an atom's element
    719       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     730      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     731        if ((*ListRunner)->ActiveFlag) {
    720732        int Z;
    721733        mol = *ListRunner;
     
    761773  cout << Verbose(0) << "all else - go back" << endl;
    762774  cout << Verbose(0) << "===============================================" << endl;
    763   if (molecules->NumberOfActiveMolecules() > 0)
     775  if (molecules->NumberOfActiveMolecules() > 1)
    764776    cout << Verbose(0) << "WARNING: There is more than one molecule active! Atoms will be added to each." << endl;
    765777  cout << Verbose(0) << "INPUT: ";
     
    772784
    773785    case 'd': // duplicate the periodic cell along a given axis, given times
    774       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     786      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     787        if ((*ListRunner)->ActiveFlag) {
    775788        mol = *ListRunner;
    776789        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    830843
    831844    case 'g': // center the atoms
    832       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     845      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     846        if ((*ListRunner)->ActiveFlag) {
    833847        mol = *ListRunner;
    834848        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    838852
    839853    case 'i': // align all atoms
    840       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     854      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     855        if ((*ListRunner)->ActiveFlag) {
    841856        mol = *ListRunner;
    842857        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    846861
    847862    case 'm': // mirror atoms along a given axis
    848       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     863      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     864        if ((*ListRunner)->ActiveFlag) {
    849865        mol = *ListRunner;
    850866        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    854870
    855871    case 'o': // create the connection matrix
    856       {
     872      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     873        if ((*ListRunner)->ActiveFlag) {
    857874        double bonddistance;
    858875        clock_t start,end;
     
    868885
    869886    case 't': // translate all atoms
    870      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     887      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     888        if ((*ListRunner)->ActiveFlag) {
    871889        mol = *ListRunner;
    872890        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
    873891        cout << Verbose(0) << "Enter translation vector." << endl;
    874892        x.AskPosition(mol->cell_size,0);
    875         mol->Translate((const Vector *)&x);
     893        mol->Center.AddVector((const Vector *)&x);
    876894     }
    877895     break;
     
    895913{
    896914  char choice;  // menu choice char
    897   Vector Center;
     915  Vector center;
    898916  int nr, count;
    899917  molecule *mol = NULL;
    900   char filename[MAXSTRINGSIZE];
    901 
    902   cout << Verbose(0) << "==========Edit MOLECULES=====================" << endl;
     918
     919  cout << Verbose(0) << "==========EDIT MOLECULES=====================" << endl;
    903920  cout << Verbose(0) << "c - create new molecule" << endl;
    904921  cout << Verbose(0) << "l - load molecule from xyz file" << endl;
    905922  cout << Verbose(0) << "n - change molecule's name" << endl;
    906923  cout << Verbose(0) << "N - give molecules filename" << endl;
    907   cout << Verbose(0) << "p - parse xyz file into molecule" << endl;
     924  cout << Verbose(0) << "p - parse atoms in xyz file into molecule" << endl;
    908925  cout << Verbose(0) << "r - remove a molecule" << endl;
    909926  cout << Verbose(0) << "all else - go back" << endl;
     
    921938      break;
    922939
    923     case 'l': // laod from XYZ file
    924       cout << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
    925       mol = new molecule(periode);
    926       do {
    927         cout << Verbose(0) << "Enter file name: ";
     940    case 'l': // load from XYZ file
     941      {
     942        char filename[MAXSTRINGSIZE];
     943        cout << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
     944        mol = new molecule(periode);
     945        do {
     946          cout << Verbose(0) << "Enter file name: ";
     947          cin >> filename;
     948        } while (!mol->AddXYZFile(filename));
     949        mol->SetNameFromFilename(filename);
     950        // center at set box dimensions
     951        mol->CenterEdge((ofstream *)&cout, &center);
     952        mol->cell_size[0] = center.x[0];
     953        mol->cell_size[1] = 0;
     954        mol->cell_size[2] = center.x[1];
     955        mol->cell_size[3] = 0;
     956        mol->cell_size[4] = 0;
     957        mol->cell_size[5] = center.x[2];
     958        molecules->insert(mol);
     959      }
     960      break;
     961
     962    case 'n':
     963      {
     964        char filename[MAXSTRINGSIZE];
     965        do {
     966          cout << Verbose(0) << "Enter index of molecule: ";
     967          cin >> nr;
     968          mol = molecules->ReturnIndex(nr);
     969        } while (mol == NULL);
     970        cout << Verbose(0) << "Enter name: ";
    928971        cin >> filename;
    929       } while (!mol->AddXYZFile(filename));
    930       mol->SetNameFromFilename(filename);
    931       // center at set box dimensions
    932       mol->CenterEdge((ofstream *)&cout, &Center);
    933       mol->cell_size[0] = Center.x[0];
    934       mol->cell_size[1] = 0;
    935       mol->cell_size[2] = Center.x[1];
    936       mol->cell_size[3] = 0;
    937       mol->cell_size[4] = 0;
    938       mol->cell_size[5] = Center.x[2];
    939       molecules->insert(mol);
    940       break;
    941 
    942     case 'n':
    943       do {
    944         cout << Verbose(0) << "Enter index of molecule: ";
    945         cin >> nr;
    946         mol = molecules->ReturnIndex(nr);
    947       } while (mol != NULL);
    948       cout << Verbose(0) << "Enter name: ";
    949       cin >> filename;
    950       strcpy(mol->name, filename);
     972        strcpy(mol->name, filename);
     973      }
    951974      break;
    952975
    953976    case 'N':
    954       do {
    955         cout << Verbose(0) << "Enter index of molecule: ";
    956         cin >> nr;
    957         mol = molecules->ReturnIndex(nr);
    958       } while (mol != NULL);
    959       cout << Verbose(0) << "Enter name: ";
    960       cin >> filename;
    961       mol->SetNameFromFilename(filename);
     977      {
     978        char filename[MAXSTRINGSIZE];
     979        do {
     980          cout << Verbose(0) << "Enter index of molecule: ";
     981          cin >> nr;
     982          mol = molecules->ReturnIndex(nr);
     983        } while (mol == NULL);
     984        cout << Verbose(0) << "Enter name: ";
     985        cin >> filename;
     986        mol->SetNameFromFilename(filename);
     987      }
    962988      break;
    963989
    964990    case 'p': // parse XYZ file
    965       mol = NULL;
    966       do {
    967         cout << Verbose(0) << "Enter index of molecule: ";
    968         cin >> nr;
    969         mol = molecules->ReturnIndex(nr);
    970       } while (mol == NULL);
    971       cout << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
    972       do {
    973         cout << Verbose(0) << "Enter file name: ";
    974         cin >> filename;
    975       } while (!mol->AddXYZFile(filename));
    976       mol->SetNameFromFilename(filename);
     991      {
     992        char filename[MAXSTRINGSIZE];
     993        mol = NULL;
     994        do {
     995          cout << Verbose(0) << "Enter index of molecule: ";
     996          cin >> nr;
     997          mol = molecules->ReturnIndex(nr);
     998        } while (mol == NULL);
     999        cout << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
     1000        do {
     1001          cout << Verbose(0) << "Enter file name: ";
     1002          cin >> filename;
     1003        } while (!mol->AddXYZFile(filename));
     1004        mol->SetNameFromFilename(filename);
     1005      }
    9771006      break;
    9781007
     
    9811010      cin >> nr;
    9821011      count = 1;
    983       MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin();
    984       for(; ((ListRunner != molecules->ListOfMolecules.end()) && (count < nr)); ListRunner++);
    985       mol = *ListRunner;
    986       if (count == nr) {
    987         molecules->ListOfMolecules.erase(ListRunner);
    988         delete(mol);
    989       }
     1012      for( MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     1013        if (nr == (*ListRunner)->IndexNr) {
     1014          mol = *ListRunner;
     1015          molecules->ListOfMolecules.erase(ListRunner);
     1016          delete(mol);
     1017        }
    9901018      break;
    9911019  }
     
    10021030
    10031031  cout << Verbose(0) << "===========MERGE MOLECULES=====================" << endl;
     1032  cout << Verbose(0) << "a - simple add of one molecule to another" << endl;
    10041033  cout << Verbose(0) << "e - embedding merge of two molecules" << endl;
    10051034  cout << Verbose(0) << "m - multi-merge of all molecules" << endl;
     
    10161045      break;
    10171046
     1047    case 'a':
     1048      {
     1049        int src, dest;
     1050        molecule *srcmol = NULL, *destmol = NULL;
     1051        {
     1052          do {
     1053            cout << Verbose(0) << "Enter index of destination molecule: ";
     1054            cin >> dest;
     1055            destmol = molecules->ReturnIndex(dest);
     1056          } while ((destmol == NULL) && (dest != -1));
     1057          do {
     1058            cout << Verbose(0) << "Enter index of source molecule to add from: ";
     1059            cin >> src;
     1060            srcmol = molecules->ReturnIndex(src);
     1061          } while ((srcmol == NULL) && (src != -1));
     1062          if ((src != -1) && (dest != -1))
     1063            molecules->SimpleAdd(srcmol, destmol);
     1064        }
     1065      }
     1066      break;
     1067
    10181068    case 'e':
     1069      cout << Verbose(0) << "Not implemented yet." << endl;
    10191070      break;
    10201071
    10211072    case 'm':
     1073      {
     1074        int nr;
     1075        molecule *mol = NULL;
     1076        do {
     1077          cout << Verbose(0) << "Enter index of molecule to merge into: ";
     1078          cin >> nr;
     1079          mol = molecules->ReturnIndex(nr);
     1080        } while ((mol == NULL) && (nr != -1));
     1081        if (nr != -1) {
     1082          int N = molecules->ListOfMolecules.size()-1;
     1083          int *src = new int(N);
     1084          for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     1085            if ((*ListRunner)->IndexNr != nr)
     1086              src[N++] = (*ListRunner)->IndexNr;       
     1087          molecules->SimpleMultiMerge(mol, src, N);
     1088          delete[](src);
     1089        }
     1090      }
    10221091      break;
    10231092
    10241093    case 's':
     1094      cout << Verbose(0) << "Not implemented yet." << endl;
    10251095      break;
    10261096
    10271097    case 't':
     1098      {
     1099        int src, dest;
     1100        molecule *srcmol = NULL, *destmol = NULL;
     1101        {
     1102          do {
     1103            cout << Verbose(0) << "Enter index of destination molecule: ";
     1104            cin >> dest;
     1105            destmol = molecules->ReturnIndex(dest);
     1106          } while ((destmol == NULL) && (dest != -1));
     1107          do {
     1108            cout << Verbose(0) << "Enter index of source molecule to merge into: ";
     1109            cin >> src;
     1110            srcmol = molecules->ReturnIndex(src);
     1111          } while ((srcmol == NULL) && (src != -1));
     1112          if ((src != -1) && (dest != -1))
     1113            molecules->SimpleMerge(srcmol, destmol);
     1114        }
     1115      }
    10281116      break;
    10291117  }
     
    11251213  molecule *mol = new molecule(periode);
    11261214
    1127   // merge all molecules in MoleculeListClass into this molecule
     1215  // translate each to its center and merge all molecules in MoleculeListClass into this molecule
    11281216  int N = molecules->ListOfMolecules.size();
    11291217  int *src = new int(N);
    11301218  N=0;
    1131   for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     1219  for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
    11321220    src[N++] = (*ListRunner)->IndexNr;
     1221    (*ListRunner)->Translate(&(*ListRunner)->Center);
     1222  }
    11331223  molecules->SimpleMultiAdd(mol, src, N);
     1224  delete[](src);
     1225  // ... and translate back
     1226  for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     1227    (*ListRunner)->Center.Scale(-1.);
     1228    (*ListRunner)->Translate(&(*ListRunner)->Center);
     1229    (*ListRunner)->Center.Scale(-1.);
     1230  }
    11341231
    11351232  cout << Verbose(0) << "Storing configuration ... " << endl;
     
    11371234  mol->CalculateOrbitals(*configuration);
    11381235  configuration->InitMaxMinStopStep = configuration->MaxMinStopStep = configuration->MaxPsiDouble;
    1139   strcpy(filename, ConfigFileName);
    11401236  if (ConfigFileName != NULL) { // test the file name
    1141     output.open(ConfigFileName, ios::trunc);
     1237    strcpy(filename, ConfigFileName);
     1238    output.open(filename, ios::trunc);
    11421239  } else if (strlen(configuration->configname) != 0) {
    11431240    strcpy(filename, configuration->configname);
     
    12271324  // simply create a new molecule, wherein the config file is loaded and the manipulation takes place
    12281325  molecule *mol = new molecule(periode);
     1326  mol->ActiveFlag = true;
    12291327  molecules->insert(mol);
    12301328
     
    12571355            cout << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl;
    12581356            cout << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl;
    1259             cout << "\t-N\tGet non-convex-envelope." << endl;
     1357            cout << "\t-N <radius> <file>\tGet non-convex-envelope." << endl;
    12601358            cout << "\t-o <out>\tGet volume of the convex envelope (and store to tecplot file)." << endl;
    12611359            cout << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl;
    12621360            cout << "\t-P <file>\tParse given forces file and append as an MD step to config file via Verlet." << endl;
     1361            cout << "\t-L <step0> <step1> <prefix>\tStore a linear interpolation between two configurations <step0> and <step1> into single config files with prefix <prefix> and as Trajectories into the current config file." << endl;
    12631362            cout << "\t-r\t\tConvert file from an old pcp syntax." << endl;
     1363            cout << "\t-R\t\tRemove all atoms out of sphere around a given one." << endl;
    12641364            cout << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl;
    12651365            cout << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl;
     
    15041604              }
    15051605              break;
     1606            case 'L':
     1607              ExitFlag = 1;
     1608              SaveFlag = true;
     1609              cout << Verbose(1) << "Linear interpolation between configuration " << argv[argptr] << " and " << argv[argptr+1] << "." << endl;
     1610              if (!mol->LinearInterpolationBetweenConfiguration((ofstream *)&cout, atoi(argv[argptr]), atoi(argv[argptr+1]), argv[argptr+2], configuration))
     1611                cout << Verbose(2) << "Could not store " << argv[argptr+2] << " files." << endl;
     1612              else
     1613                cout << Verbose(2) << "Steps created and " << argv[argptr+2] << " files stored." << endl;
     1614              argptr+=3;
     1615              break;
    15061616            case 'P':
    15071617              ExitFlag = 1;
     
    15121622                SaveFlag = true;
    15131623                cout << Verbose(1) << "Parsing forces file and Verlet integrating." << endl;
    1514                 if (!mol->VerletForceIntegration(argv[argptr], configuration.Deltat, configuration.GetIsAngstroem()))
     1624                if (!mol->VerletForceIntegration((ofstream *)&cout, argv[argptr], configuration))
    15151625                  cout << Verbose(2) << "File not found." << endl;
    15161626                else
    15171627                  cout << Verbose(2) << "File found and parsed." << endl;
    15181628                argptr+=1;
     1629              }
     1630              break;
     1631            case 'R':
     1632              ExitFlag = 1;
     1633              if ((argptr+1 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])))  {
     1634                ExitFlag = 255;
     1635                cerr << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl;
     1636              } else {
     1637                SaveFlag = true;
     1638                cout << Verbose(1) << "Removing atoms around " << argv[argptr] << " with radius " << argv[argptr+1] << "." << endl;
     1639                double tmp1 = atof(argv[argptr+1]);
     1640                atom *third = mol->FindAtom(atoi(argv[argptr]));
     1641                atom *first = mol->start;
     1642                if ((third != NULL) && (first != mol->end)) {
     1643                  atom *second = first->next;
     1644                  while(second != mol->end) {
     1645                    first = second;
     1646                    second = first->next;
     1647                    if (first->x.DistanceSquared((const Vector *)&third->x) > tmp1*tmp1) // distance to first above radius ...
     1648                      mol->RemoveAtom(first);
     1649                  }
     1650                } else {
     1651                  cerr << "Removal failed due to missing atoms on molecule or wrong id." << endl;
     1652                }
     1653                argptr+=2;
    15191654              }
    15201655              break;
     
    15331668                argptr+=3;
    15341669              }
    1535               break;
    15361670            case 'T':
    15371671              ExitFlag = 1;
     
    15831717              } else {
    15841718                SaveFlag = true;
     1719                j = -1;
    15851720                cout << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
    15861721                for (int i=0;i<6;i++) {
     
    16091744                for (int i=0;i<NDIM;i++) {
    16101745                  j += i+1;
    1611                   x.x[i] = atof(argv[argptr++]);
     1746                  x.x[i] = atof(argv[argptr+i]);
    16121747                  mol->cell_size[j] += x.x[i]*2.;
    16131748                }
     
    16191754              ExitFlag = 1;
    16201755              SaveFlag = true;
    1621               cout << Verbose(1) << "Centering atoms in origin." << endl;
    1622               mol->CenterOrigin((ofstream *)&cout, &x);
     1756              cout << Verbose(1) << "Centering atoms on edge and setting box dimensions." << endl;
     1757              x.Zero();
     1758              mol->CenterEdge((ofstream *)&cout, &x);
    16231759              mol->SetBoxDimension(&x);
    16241760              argptr+=0;
     
    18021938  string line;
    18031939  char *ConfigFileName = NULL;
    1804   int j, count;
     1940  int j;
    18051941
    18061942  // =========================== PARSE COMMAND LINE OPTIONS ====================================
     
    18441980    cout << Verbose(0) << "============Menu===============================" << endl;
    18451981    cout << Verbose(0) << "a - set molecule (in)active" << endl;
    1846     cout << Verbose(0) << "e - edit new molecules" << endl;
     1982    cout << Verbose(0) << "e - edit molecules (load, parse, save)" << endl;
    18471983    cout << Verbose(0) << "g - globally manipulate atoms in molecule" << endl;
    18481984    cout << Verbose(0) << "M - Merge molecules" << endl;
     
    18631999          cout << "Enter index of molecule: ";
    18642000          cin >> j;
    1865           count = 1;
    1866           MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin();
    1867           for(; ((ListRunner != molecules->ListOfMolecules.end()) && (count < j)); ListRunner++);
    1868           if (count == j)
    1869             (*ListRunner)->ActiveFlag = !(*ListRunner)->ActiveFlag;
     2001          for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     2002            if ((*ListRunner)->IndexNr == j)
     2003              (*ListRunner)->ActiveFlag = !(*ListRunner)->ActiveFlag;
    18702004        }
    18712005        break;
Note: See TracChangeset for help on using the changeset viewer.