Changes in src/builder.cpp [14d4d4:fedd5f]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/builder.cpp
r14d4d4 rfedd5f 52 52 #include "helpers.hpp" 53 53 #include "molecules.hpp" 54 #include "boundary.hpp"55 54 56 55 /********************************************** Submenu routine **************************************/ … … 485 484 * \param *mol the molecule with all the atoms 486 485 */ 487 static void MeasureAtoms(periodentafel *periode, molecule *mol , config *configuration)486 static void MeasureAtoms(periodentafel *periode, molecule *mol) 488 487 { 489 488 atom *first, *second, *third; … … 497 496 cout << Verbose(0) << " b - calculate bond length between two atoms" << endl; 498 497 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;501 498 cout << Verbose(0) << "all else - go back" << endl; 502 499 cout << Verbose(0) << "===============================================" << endl; … … 556 553 cout << Verbose(0) << (acos(x.ScalarProduct((const vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl; 557 554 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 else565 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;571 555 } 572 556 }; … … 736 720 int ExitFlag = 0; 737 721 int j; 738 double volume = 0.;739 722 enum ConfigStatus config_present = absent; 740 723 clock_t start,end; … … 759 742 cout << "\t-b x1 x2 x3\tCenter atoms in domain with given edge lengths of (x1,x2,x3)." << endl; 760 743 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;762 744 cout << "\t-e <file>\tSets the databases path to be parsed (default: ./)." << endl; 763 745 cout << "\t-f <dist> <order>\tFragments the molecule in BOSSANOVA manner and stores config files in same dir as config." << endl; 764 746 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;768 747 cout << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl; 769 748 cout << "\t-r\t\tConvert file from an old pcp syntax." << endl; 770 749 cout << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl; 771 750 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;773 751 cout << "\t-v/-V\t\tGives version information." << endl; 774 752 cout << "Note: config files must not begin with '-' !" << endl; … … 790 768 argptr+=1; 791 769 break; 792 case 'n':793 cout << "I won't parse trajectories." << endl;794 configuration.FastParsing = true;795 770 default: // no match? Step on 796 771 argptr++; … … 805 780 cout << Verbose(0) << "Element list loaded successfully." << endl; 806 781 periode->Output((ofstream *)&cout); 807 } else {782 } else 808 783 cout << Verbose(0) << "Element list loading failed." << endl; 809 return 1;810 }811 784 812 785 // 3. Find config file name and parse if possible … … 972 945 } 973 946 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 else984 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 atoms1025 if (mol->AtomCount != 0) { // if there is more than none1026 count = mol->AtomCount; // is changed becausing of adding, thus has to be stored away beforehand1027 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 element1032 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 magnitude1042 for (int i=1;i<faktor;i++) { // then add this list with respective translation factor times1043 x.AddVector(&y); // per factor one cell width further1044 for (int k=count;k--;) { // go through every atom of the original cell1045 first = new atom(); // create a new body1046 first->x.CopyVector(Vectors[k]); // use coordinate of original atom1047 first->x.AddVector(&x); // translate the coordinates1048 first->type = Elements[k]; // insert original element1049 mol->AddAtom(first); // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)1050 }1051 }1052 // free memory1053 delete[](Elements);1054 delete[](Vectors);1055 // correct cell size1056 if (axis < 0) { // if sign was negative, we have to translate everything1057 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;1066 947 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++; 1069 949 break; 1070 950 } … … 1271 1151 1272 1152 case 'l': // measure distances or angles 1273 MeasureAtoms(periode, mol , &configuration);1153 MeasureAtoms(periode, mol); 1274 1154 break; 1275 1155 … … 1284 1164 mol->CreateAdjacencyList((ofstream *)&cout, tmp1, configuration.GetIsAngstroem()); 1285 1165 //mol->CreateListOfBondsPerAtom((ofstream *)&cout); 1286 Subgraphs = mol->DepthFirstSearchAnalysis((ofstream *)&cout, MinimumRingSize);1166 Subgraphs = mol->DepthFirstSearchAnalysis((ofstream *)&cout, false, MinimumRingSize); 1287 1167 while (Subgraphs->next != NULL) { 1288 1168 Subgraphs = Subgraphs->next; … … 1340 1220 1341 1221 // save element data base 1342 if (periode->StorePeriodentafel( ElementsFileName)) //ElementsFileName1222 if (periode->StorePeriodentafel()) //ElementsFileName 1343 1223 cout << Verbose(0) << "Saving of elements.db successful." << endl; 1344 1224 else
Note:
See TracChangeset
for help on using the changeset viewer.