Changeset 63f06e for src


Ignore:
Timestamp:
Apr 8, 2009, 11:35:42 AM (16 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
09af1b
Parents:
d67150
Message:

fixes due to changes in molecule structure (Center...()) and merge submenu is done.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    rd67150 r63f06e  
    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.);
     
    646646  cout << Verbose(0) << "all else - go back" << endl;
    647647  cout << Verbose(0) << "===============================================" << endl;
    648   if (molecules->NumberOfActiveMolecules() > 0)
     648  if (molecules->NumberOfActiveMolecules() > 1)
    649649    cout << Verbose(0) << "WARNING: There is more than one molecule active! Atoms will be added to each." << endl;
    650650  cout << Verbose(0) << "INPUT: ";
     
    657657
    658658    case 'a': // add atom
    659       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     659      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     660        if ((*ListRunner)->ActiveFlag) {
    660661        mol = *ListRunner;
    661662        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    665666
    666667    case 'b': // scale a bond
    667       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     668      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     669        if ((*ListRunner)->ActiveFlag) {
    668670        mol = *ListRunner;
    669671        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    687689
    688690    case 'c': // unit scaling of the metric
    689       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     691      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     692        if ((*ListRunner)->ActiveFlag) {
    690693        mol = *ListRunner;
    691694        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    703706
    704707    case 'l': // measure distances or angles
    705       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     708      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     709        if ((*ListRunner)->ActiveFlag) {
    706710        mol = *ListRunner;
    707711        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    711715
    712716    case 'r': // remove atom
    713       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     717      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     718        if ((*ListRunner)->ActiveFlag) {
    714719        mol = *ListRunner;
    715720        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    719724
    720725    case 'u': // change an atom's element
    721       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     726      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     727        if ((*ListRunner)->ActiveFlag) {
    722728        int Z;
    723729        mol = *ListRunner;
     
    766772  cout << Verbose(0) << "all else - go back" << endl;
    767773  cout << Verbose(0) << "===============================================" << endl;
    768   if (molecules->NumberOfActiveMolecules() > 0)
     774  if (molecules->NumberOfActiveMolecules() > 1)
    769775    cout << Verbose(0) << "WARNING: There is more than one molecule active! Atoms will be added to each." << endl;
    770776  cout << Verbose(0) << "INPUT: ";
     
    777783
    778784    case 'd': // duplicate the periodic cell along a given axis, given times
    779       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     785      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     786        if ((*ListRunner)->ActiveFlag) {
    780787        mol = *ListRunner;
    781788        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    835842
    836843    case 'g': // center the atoms
    837       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     844      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     845        if ((*ListRunner)->ActiveFlag) {
    838846        mol = *ListRunner;
    839847        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    843851
    844852    case 'i': // align all atoms
    845       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     853      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     854        if ((*ListRunner)->ActiveFlag) {
    846855        mol = *ListRunner;
    847856        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    851860
    852861    case 'm': // mirror atoms along a given axis
    853       for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     862      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     863        if ((*ListRunner)->ActiveFlag) {
    854864        mol = *ListRunner;
    855865        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
     
    859869
    860870    case 'o': // create the connection matrix
    861       {
     871      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     872        if ((*ListRunner)->ActiveFlag) {
    862873        double bonddistance;
    863874        clock_t start,end;
     
    873884
    874885    case 't': // translate all atoms
    875      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     886      for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     887        if ((*ListRunner)->ActiveFlag) {
    876888        mol = *ListRunner;
    877889        cout << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
    878890        cout << Verbose(0) << "Enter translation vector." << endl;
    879891        x.AskPosition(mol->cell_size,0);
    880         mol->Translate((const Vector *)&x);
     892        mol->Center.AddVector((const Vector *)&x);
    881893     }
    882894     break;
     
    901913  char choice;  // menu choice char
    902914  bool valid;
    903   Vector Center;
     915  Vector center;
    904916  int nr, count;
    905917  molecule *mol = NULL;
    906918  char *molname = NULL;
    907919  int length;
    908   char filename[MAXSTRINGSIZE];
    909 
    910   cout << Verbose(0) << "==========Edit MOLECULES=====================" << endl;
     920
     921  cout << Verbose(0) << "==========EDIT MOLECULES=====================" << endl;
    911922  cout << Verbose(0) << "c - create new molecule" << endl;
    912923  cout << Verbose(0) << "l - load molecule from xyz file" << endl;
    913924  cout << Verbose(0) << "n - change molecule's name" << endl;
    914925  cout << Verbose(0) << "N - give molecules filename" << endl;
    915   cout << Verbose(0) << "p - parse xyz file into molecule" << endl;
     926  cout << Verbose(0) << "p - parse atoms in xyz file into molecule" << endl;
    916927  cout << Verbose(0) << "r - remove a molecule" << endl;
    917928  cout << Verbose(0) << "all else - go back" << endl;
     
    929940      break;
    930941
    931     case 'l': // laod from XYZ file
    932       cout << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
    933       mol = new molecule(periode);
    934       do {
    935         cout << Verbose(0) << "Enter file name: ";
     942    case 'l': // load from XYZ file
     943      {
     944        char filename[MAXSTRINGSIZE];
     945        cout << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
     946        mol = new molecule(periode);
     947        do {
     948          cout << Verbose(0) << "Enter file name: ";
     949          cin >> filename;
     950        } while (!mol->AddXYZFile(filename));
     951        mol->SetNameFromFilename(filename);
     952        // center at set box dimensions
     953        mol->CenterEdge((ofstream *)&cout, &center);
     954        mol->cell_size[0] = center.x[0];
     955        mol->cell_size[1] = 0;
     956        mol->cell_size[2] = center.x[1];
     957        mol->cell_size[3] = 0;
     958        mol->cell_size[4] = 0;
     959        mol->cell_size[5] = center.x[2];
     960        molecules->insert(mol);
     961      }
     962      break;
     963
     964    case 'n':
     965      {
     966        char filename[MAXSTRINGSIZE];
     967        do {
     968          cout << Verbose(0) << "Enter index of molecule: ";
     969          cin >> nr;
     970          mol = molecules->ReturnIndex(nr);
     971        } while (mol == NULL);
     972        cout << Verbose(0) << "Enter name: ";
    936973        cin >> filename;
    937       } while (!mol->AddXYZFile(filename));
    938       mol->SetNameFromFilename(filename);
    939       // center at set box dimensions
    940       mol->CenterEdge((ofstream *)&cout, &Center);
    941       mol->cell_size[0] = Center.x[0];
    942       mol->cell_size[1] = 0;
    943       mol->cell_size[2] = Center.x[1];
    944       mol->cell_size[3] = 0;
    945       mol->cell_size[4] = 0;
    946       mol->cell_size[5] = Center.x[2];
    947       molecules->insert(mol);
    948       break;
    949 
    950     case 'n':
    951       do {
    952         cout << Verbose(0) << "Enter index of molecule: ";
    953         cin >> nr;
    954         mol = molecules->ReturnIndex(nr);
    955       } while (mol != NULL);
    956       cout << Verbose(0) << "Enter name: ";
    957       cin >> filename;
    958       strcpy(mol->name, filename);
     974        strcpy(mol->name, filename);
     975      }
    959976      break;
    960977
    961978    case 'N':
    962       do {
    963         cout << Verbose(0) << "Enter index of molecule: ";
    964         cin >> nr;
    965         mol = molecules->ReturnIndex(nr);
    966       } while (mol != NULL);
    967       cout << Verbose(0) << "Enter name: ";
    968       cin >> filename;
    969       mol->SetNameFromFilename(filename);
     979      {
     980        char filename[MAXSTRINGSIZE];
     981        do {
     982          cout << Verbose(0) << "Enter index of molecule: ";
     983          cin >> nr;
     984          mol = molecules->ReturnIndex(nr);
     985        } while (mol == NULL);
     986        cout << Verbose(0) << "Enter name: ";
     987        cin >> filename;
     988        mol->SetNameFromFilename(filename);
     989      }
    970990      break;
    971991
    972992    case 'p': // parse XYZ file
    973       mol = NULL;
    974       do {
    975         cout << Verbose(0) << "Enter index of molecule: ";
    976         cin >> nr;
    977         mol = molecules->ReturnIndex(nr);
    978       } while (mol == NULL);
    979       cout << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
    980       do {
    981         cout << Verbose(0) << "Enter file name: ";
    982         cin >> filename;
    983       } while (!mol->AddXYZFile(filename));
    984       mol->SetNameFromFilename(filename);
     993      {
     994        char filename[MAXSTRINGSIZE];
     995        mol = NULL;
     996        do {
     997          cout << Verbose(0) << "Enter index of molecule: ";
     998          cin >> nr;
     999          mol = molecules->ReturnIndex(nr);
     1000        } while (mol == NULL);
     1001        cout << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
     1002        do {
     1003          cout << Verbose(0) << "Enter file name: ";
     1004          cin >> filename;
     1005        } while (!mol->AddXYZFile(filename));
     1006        mol->SetNameFromFilename(filename);
     1007      }
    9851008      break;
    9861009
     
    9891012      cin >> nr;
    9901013      count = 1;
    991       MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin();
    992       for(; ((ListRunner != molecules->ListOfMolecules.end()) && (count < nr)); ListRunner++);
    993       mol = *ListRunner;
    994       if (count == nr) {
    995         molecules->ListOfMolecules.erase(ListRunner);
    996         delete(mol);
    997       }
     1014      for( MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     1015        if (nr == (*ListRunner)->IndexNr) {
     1016          mol = *ListRunner;
     1017          molecules->ListOfMolecules.erase(ListRunner);
     1018          delete(mol);
     1019        }
    9981020      break;
    9991021  }
     
    10111033
    10121034  cout << Verbose(0) << "===========MERGE MOLECULES=====================" << endl;
     1035  cout << Verbose(0) << "a - simple add of one molecule to another" << endl;
    10131036  cout << Verbose(0) << "e - embedding merge of two molecules" << endl;
    10141037  cout << Verbose(0) << "m - multi-merge of all molecules" << endl;
     
    10251048      break;
    10261049
     1050    case 'a':
     1051      {
     1052        int src, dest;
     1053        molecule *srcmol = NULL, *destmol = NULL;
     1054        {
     1055          do {
     1056            cout << Verbose(0) << "Enter index of destination molecule: ";
     1057            cin >> dest;
     1058            destmol = molecules->ReturnIndex(dest);
     1059          } while ((destmol == NULL) && (dest != -1));
     1060          do {
     1061            cout << Verbose(0) << "Enter index of source molecule to add from: ";
     1062            cin >> src;
     1063            srcmol = molecules->ReturnIndex(src);
     1064          } while ((srcmol == NULL) && (src != -1));
     1065          if ((src != -1) && (dest != -1))
     1066            molecules->SimpleAdd(srcmol, destmol);
     1067        }
     1068      }
     1069      break;
     1070
    10271071    case 'e':
     1072      cout << Verbose(0) << "Not implemented yet." << endl;
    10281073      break;
    10291074
    10301075    case 'm':
     1076      {
     1077        int nr;
     1078        molecule *mol = NULL;
     1079        do {
     1080          cout << Verbose(0) << "Enter index of molecule to merge into: ";
     1081          cin >> nr;
     1082          mol = molecules->ReturnIndex(nr);
     1083        } while ((mol == NULL) && (nr != -1));
     1084        if (nr != -1) {
     1085          int N = molecules->ListOfMolecules.size()-1;
     1086          int *src = new int(N);
     1087          for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     1088            if ((*ListRunner)->IndexNr != nr)
     1089              src[N++] = (*ListRunner)->IndexNr;       
     1090          molecules->SimpleMultiMerge(mol, src, N);
     1091          delete[](src);
     1092        }
     1093      }
    10311094      break;
    10321095
    10331096    case 's':
     1097      cout << Verbose(0) << "Not implemented yet." << endl;
    10341098      break;
    10351099
    10361100    case 't':
     1101      {
     1102        int src, dest;
     1103        molecule *srcmol = NULL, *destmol = NULL;
     1104        {
     1105          do {
     1106            cout << Verbose(0) << "Enter index of destination molecule: ";
     1107            cin >> dest;
     1108            destmol = molecules->ReturnIndex(dest);
     1109          } while ((destmol == NULL) && (dest != -1));
     1110          do {
     1111            cout << Verbose(0) << "Enter index of source molecule to merge into: ";
     1112            cin >> src;
     1113            srcmol = molecules->ReturnIndex(src);
     1114          } while ((srcmol == NULL) && (src != -1));
     1115          if ((src != -1) && (dest != -1))
     1116            molecules->SimpleMerge(srcmol, destmol);
     1117        }
     1118      }
    10371119      break;
    10381120  }
     
    11341216        molecule *mol = new molecule(periode);
    11351217
    1136         // merge all molecules in MoleculeListClass into this molecule
     1218        // translate each to its center and merge all molecules in MoleculeListClass into this molecule
    11371219        int N = molecules->ListOfMolecules.size();
    11381220        int *src = new int(N);
    11391221        N=0;
    1140         for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     1222        for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
    11411223          src[N++] = (*ListRunner)->IndexNr;
     1224          (*ListRunner)->Translate(&(*ListRunner)->Center);
     1225        }
    11421226        molecules->SimpleMultiAdd(mol, src, N);
     1227        delete[](src);
     1228        // ... and translate back
     1229  for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
     1230    (*ListRunner)->Center.Scale(-1.);
     1231    (*ListRunner)->Translate(&(*ListRunner)->Center);
     1232    (*ListRunner)->Center.Scale(-1.);
     1233  }
    11431234
    11441235        cout << Verbose(0) << "Storing configuration ... " << endl;
     
    11461237        mol->CalculateOrbitals(*configuration);
    11471238        configuration->InitMaxMinStopStep = configuration->MaxMinStopStep = configuration->MaxPsiDouble;
    1148         strcpy(filename, ConfigFileName);
    11491239        if (ConfigFileName != NULL) { // test the file name
    1150                 output.open(ConfigFileName, ios::trunc);
     1240          strcpy(filename, ConfigFileName);
     1241                output.open(filename, ios::trunc);
    11511242        } else if (strlen(configuration->configname) != 0) {
    11521243                strcpy(filename, configuration->configname);
     
    12171308 * \return exit code (0 - successful, all else - something's wrong)
    12181309 */
    1219 static int ParseCommandLineOptions(int argc, char **argv, MoleculeListClass *&molecules, periodentafel *&periode, config& configuration, char *&ConfigFileName, char *&PathToDatabases)
     1310static int ParseCommandLineOptions(int argc, char **argv, MoleculeListClass *&molecules, periodentafel *&periode, config& configuration, char *ConfigFileName, char *&PathToDatabases)
    12201311{
    12211312        Vector x,y,z,n; // coordinates for absolute point in cell volume
     
    12361327        // simply create a new molecule, wherein the config file is loaded and the manipulation takes place
    12371328        molecule *mol = new molecule(periode);
     1329  mol->ActiveFlag = true;
    12381330        molecules->insert(mol);
    12391331
     
    13301422                                } else {
    13311423                                        cout << "Empty configuration file." << endl;
    1332                                         ConfigFileName = argv[1];
     1424                                        strcpy(ConfigFileName, argv[1]);
    13331425                                        config_present = empty;
    13341426                                        output.close();
     
    13361428                        } else {
    13371429                                test.close();
    1338                                 ConfigFileName = argv[1];
     1430                                strcpy(ConfigFileName, argv[1]);
    13391431                                cout << Verbose(1) << "Specified config file found, parsing ... ";
    13401432                                switch (configuration.TestSyntax(ConfigFileName, periode, mol)) {
     
    16181710                                                        ExitFlag = 1;
    16191711                                                        SaveFlag = true;
    1620                                                         cout << Verbose(1) << "Centering atoms in origin." << endl;
    1621                                                         mol->CenterOrigin((ofstream *)&cout, &x);
     1712                                                        cout << Verbose(1) << "Centering atoms on edge and setting box dimensions." << endl;
     1713                                                        mol->CenterEdge((ofstream *)&cout, &x);
    16221714                                                        mol->SetBoxDimension(&x);
    16231715                                                        break;
     
    18071899        ofstream output;
    18081900        string line;
    1809         char *ConfigFileName = NULL;
     1901        char ConfigFileName[MAXSTRINGSIZE];
    18101902        char *ElementsFileName = NULL;
    18111903        int Z;
     
    18131905
    18141906        // =========================== PARSE COMMAND LINE OPTIONS ====================================
     1907        ConfigFileName[0] = '\0';
    18151908        j = ParseCommandLineOptions(argc, argv, molecules, periode, configuration, ConfigFileName, ElementsFileName);
    18161909        if (j == 1) return 0; // just for -v and -h options
     
    18291922    molecules->insert(mol);
    18301923        }
     1924        if (strlen(ConfigFileName) == 0)
     1925          strcpy(ConfigFileName, DEFAULTCONFIG);
     1926         
    18311927
    18321928        // =========================== START INTERACTIVE SESSION ====================================
     
    18401936                cout << Verbose(0) << "============Menu===============================" << endl;
    18411937    cout << Verbose(0) << "a - set molecule (in)active" << endl;
    1842     cout << Verbose(0) << "e - edit new molecules" << endl;
     1938    cout << Verbose(0) << "e - edit molecules (load, parse, save)" << endl;
    18431939    cout << Verbose(0) << "g - globally manipulate atoms in molecule" << endl;
    18441940    cout << Verbose(0) << "M - Merge molecules" << endl;
     
    18591955          cout << "Enter index of molecule: ";
    18601956          cin >> j;
    1861           count = 1;
    1862           MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin();
    1863           for(; ((ListRunner != molecules->ListOfMolecules.end()) && (count < j)); ListRunner++);
    1864           if (count == j)
    1865             (*ListRunner)->ActiveFlag = !(*ListRunner)->ActiveFlag;
     1957          for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
     1958            if ((*ListRunner)->IndexNr == j)
     1959              (*ListRunner)->ActiveFlag = !(*ListRunner)->ActiveFlag;
    18661960        }
    18671961                          break;
Note: See TracChangeset for help on using the changeset viewer.