Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    r14d4d4 rfedd5f  
    5252#include "helpers.hpp"
    5353#include "molecules.hpp"
    54 #include "boundary.hpp"
    5554
    5655/********************************************** Submenu routine **************************************/
     
    485484 * \param *mol the molecule with all the atoms
    486485 */
    487 static void MeasureAtoms(periodentafel *periode, molecule *mol, config *configuration)
     486static void MeasureAtoms(periodentafel *periode, molecule *mol)
    488487{
    489488  atom *first, *second, *third;
     
    497496  cout << Verbose(0) << " b - calculate bond length between two atoms" << endl;
    498497  cout << Verbose(0) << " c - calculate bond angle" << endl;
    499   cout << Verbose(0) << " d - calculate principal axis of the system" << endl;
    500   cout << Verbose(0) << " e - calculate volume of the convex envelope" << endl;
    501498  cout << Verbose(0) << "all else - go back" << endl;
    502499  cout << Verbose(0) << "===============================================" << endl;
     
    556553      cout << Verbose(0) << (acos(x.ScalarProduct((const vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl;         
    557554      break;
    558     case 'd':
    559         cout << Verbose(0) << "Evaluating prinicipal axis." << endl;
    560         cout << Verbose(0) << "Shall we rotate? [0/1]: ";
    561         cin >> Z;
    562         if ((Z >=0) && (Z <=1))
    563           mol->PrincipalAxisSystem((ofstream *)&cout, (bool)Z);
    564         else
    565           mol->PrincipalAxisSystem((ofstream *)&cout, false);
    566         break;
    567     case 'e':
    568         cout << Verbose(0) << "Evaluating volume of the convex envelope.";
    569         VolumeOfConvexEnvelope((ofstream *)&cout, configuration, NULL, mol);
    570         break;
    571555  }
    572556};
     
    736720  int ExitFlag = 0;
    737721  int j;
    738   double volume = 0.;
    739722  enum ConfigStatus config_present = absent;
    740723  clock_t start,end;
     
    759742            cout << "\t-b x1 x2 x3\tCenter atoms in domain with given edge lengths of (x1,x2,x3)." << endl;
    760743            cout << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl;
    761             cout << "\t-d x1 x2 x3\tDuplicate cell along each axis by given factor." << endl;
    762744            cout << "\t-e <file>\tSets the databases path to be parsed (default: ./)." << endl;
    763745            cout << "\t-f <dist> <order>\tFragments the molecule in BOSSANOVA manner and stores config files in same dir as config." << endl;
    764746            cout << "\t-h/-H/-?\tGive this help screen." << endl;
    765             cout << "\t-m\tAlign in PAS with greatest EV along z axis." << endl;
    766             cout << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl;
    767             cout << "\t-o\tGet volume of the convex envelope (and store to tecplot file)." << endl;
    768747            cout << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl;
    769748            cout << "\t-r\t\tConvert file from an old pcp syntax." << endl;
    770749            cout << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl;
    771750            cout << "\t-s x1 x2 x3\tScale all atom coordinates by this vector (x1,x2,x3)." << endl;
    772             cout << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl;
    773751            cout << "\t-v/-V\t\tGives version information." << endl;
    774752            cout << "Note: config files must not begin with '-' !" << endl;
     
    790768            argptr+=1;
    791769            break;
    792           case 'n':
    793             cout << "I won't parse trajectories." << endl;
    794             configuration.FastParsing = true;
    795770          default:   // no match? Step on
    796771            argptr++;
     
    805780      cout << Verbose(0) << "Element list loaded successfully." << endl;
    806781      periode->Output((ofstream *)&cout);
    807     } else {
     782    } else
    808783      cout << Verbose(0) << "Element list loading failed." << endl;
    809       return 1;
    810     }
    811784   
    812785    // 3. Find config file name and parse if possible
     
    972945              }
    973946              break;
    974             case 'm':
    975               ExitFlag = 1;
    976               j = atoi(argv[argptr++]);
    977               if ((j<0) || (j>1)) {
    978                 cerr << Verbose(1) << "ERROR: Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl;
    979                 j = 0;
    980               }
    981               if (j)
    982                 cout << Verbose(0) << "Converting to prinicipal axis system." << endl;
    983               else
    984                 cout << Verbose(0) << "Evaluating prinicipal axis." << endl;
    985               mol->PrincipalAxisSystem((ofstream *)&cout, (bool)j);
    986               break;
    987             case 'o':
    988               ExitFlag = 1;
    989               cout << Verbose(0) << "Evaluating volume of the convex envelope.";
    990               VolumeOfConvexEnvelope((ofstream *)&cout, &configuration, NULL, mol);
    991               break;
    992             case 'U':
    993               volume = atof(argv[argptr++]);
    994               cout << Verbose(0) << "Using " << volume << " angstrom^3 as the volume instead of convex envelope one's." << endl; 
    995             case 'u':
    996               {
    997                 double density;
    998                 ExitFlag = 1;
    999                 cout << Verbose(0) << "Evaluating necessary cell volume for a cluster suspended in water.";
    1000                 density = atof(argv[argptr++]);
    1001                 if (density < 1.0) {
    1002                   cerr << Verbose(0) << "Density must be greater than 1.0g/cm^3 !" << endl;
    1003                   density = 1.3;
    1004                 }
    1005 //                for(int i=0;i<NDIM;i++) {
    1006 //                  repetition[i] = atoi(argv[argptr++]);
    1007 //                  if (repetition[i] < 1)
    1008 //                    cerr << Verbose(0) << "ERROR: repetition value must be greater 1!" << endl;
    1009 //                  repetition[i] = 1;
    1010 //                }
    1011                 PrepareClustersinWater((ofstream *)&cout, &configuration, mol, volume, density);
    1012               }
    1013               break;
    1014             case 'd':
    1015               for (int axis = 1; axis <= NDIM; axis++) {
    1016                 int faktor = atoi(argv[argptr++]);
    1017                 int count;
    1018                 element ** Elements;
    1019                 vector ** Vectors;
    1020                 if (faktor < 1) {
    1021                   cerr << Verbose(0) << "ERROR: Repetition faktor mus be greater than 1!" << endl;
    1022                   faktor = 1;
    1023                 }
    1024                 mol->CountAtoms((ofstream *)&cout);  // recount atoms
    1025                 if (mol->AtomCount != 0) {  // if there is more than none
    1026                   count = mol->AtomCount;   // is changed becausing of adding, thus has to be stored away beforehand
    1027                   Elements = new element *[count];
    1028                   Vectors = new vector *[count];
    1029                   j = 0;
    1030                   first = mol->start;
    1031                   while (first->next != mol->end) {  // make a list of all atoms with coordinates and element
    1032                     first = first->next;
    1033                     Elements[j] = first->type;
    1034                     Vectors[j] = &first->x;
    1035                     j++;
    1036                   }
    1037                   if (count != j)
    1038                     cout << Verbose(0) << "ERROR: AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
    1039                   x.Zero();
    1040                   y.Zero();
    1041                   y.x[abs(axis)-1] = mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
    1042                   for (int i=1;i<faktor;i++) {  // then add this list with respective translation factor times
    1043                     x.AddVector(&y); // per factor one cell width further
    1044                     for (int k=count;k--;) { // go through every atom of the original cell
    1045                       first = new atom(); // create a new body
    1046                       first->x.CopyVector(Vectors[k]);  // use coordinate of original atom
    1047                       first->x.AddVector(&x);      // translate the coordinates
    1048                       first->type = Elements[k];  // insert original element
    1049                       mol->AddAtom(first);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
    1050                     }
    1051                   }
    1052                   // free memory
    1053                   delete[](Elements);
    1054                   delete[](Vectors);
    1055                   // correct cell size
    1056                   if (axis < 0) { // if sign was negative, we have to translate everything
    1057                     x.Zero();
    1058                     x.AddVector(&y);
    1059                     x.Scale(-(faktor-1));
    1060                     mol->Translate(&x);
    1061                   }
    1062                   mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
    1063                 }
    1064               }
    1065               break;
    1066947            default:   // no match? Step on
    1067               if (argv[argptr][0] != '-') // if it started with a '-' we've already made a step!
    1068                 argptr++;
     948              argptr++;
    1069949              break;
    1070950          }
     
    12711151
    12721152      case 'l': // measure distances or angles
    1273         MeasureAtoms(periode, mol, &configuration);
     1153        MeasureAtoms(periode, mol);
    12741154        break;
    12751155
     
    12841164        mol->CreateAdjacencyList((ofstream *)&cout, tmp1, configuration.GetIsAngstroem());
    12851165        //mol->CreateListOfBondsPerAtom((ofstream *)&cout);
    1286         Subgraphs = mol->DepthFirstSearchAnalysis((ofstream *)&cout, MinimumRingSize);
     1166        Subgraphs = mol->DepthFirstSearchAnalysis((ofstream *)&cout, false, MinimumRingSize);
    12871167        while (Subgraphs->next != NULL) {
    12881168          Subgraphs = Subgraphs->next;
     
    13401220 
    13411221  // save element data base
    1342   if (periode->StorePeriodentafel(ElementsFileName)) //ElementsFileName
     1222  if (periode->StorePeriodentafel()) //ElementsFileName
    13431223    cout << Verbose(0) << "Saving of elements.db successful." << endl;
    13441224  else
Note: See TracChangeset for help on using the changeset viewer.