Changeset 9565ec for molecuilder/src/builder.cpp
- Timestamp:
- Mar 3, 2010, 10:13:19 AM (16 years ago)
- Children:
- 5a40b8, 8758eb, bd506d
- Parents:
- 9f03b2
- File:
-
- 1 edited
-
molecuilder/src/builder.cpp (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/builder.cpp
r9f03b2 r9565ec 68 68 #include "periodentafel.hpp" 69 69 #include "version.h" 70 #include "World.hpp" 70 71 71 72 /********************************************* Subsubmenu routine ************************************/ … … 103 104 Log() << Verbose(0) << "Enter absolute coordinates." << endl; 104 105 first = new atom; 105 first->x.AskPosition( mol->cell_size, false);106 first->x.AskPosition(World::get()->cell_size, false); 106 107 first->type = periode->AskElement(); // give type 107 108 mol->AddAtom(first); // add to molecule … … 114 115 if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl; 115 116 Log() << Verbose(0) << "Enter reference coordinates." << endl; 116 x.AskPosition( mol->cell_size, true);117 x.AskPosition(World::get()->cell_size, true); 117 118 Log() << Verbose(0) << "Enter relative coordinates." << endl; 118 first->x.AskPosition( mol->cell_size, false);119 first->x.AskPosition(World::get()->cell_size, false); 119 120 first->x.AddVector((const Vector *)&x); 120 121 Log() << Verbose(0) << "\n"; … … 131 132 second = mol->AskAtom("Enter atom number: "); 132 133 Log() << Verbose(0) << "Enter relative coordinates." << endl; 133 first->x.AskPosition( mol->cell_size, false);134 first->x.AskPosition(World::get()->cell_size, false); 134 135 for (int i=NDIM;i--;) { 135 136 first->x.x[i] += second->x.x[i]; … … 358 359 case 'b': // normal vector of mirror plane 359 360 Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl; 360 n.AskPosition( mol->cell_size,0);361 n.AskPosition(World::get()->cell_size,0); 361 362 n.Normalize(); 362 363 break; … … 425 426 case 'b': // normal vector of mirror plane 426 427 Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl; 427 n.AskPosition( mol->cell_size,0);428 n.AskPosition(World::get()->cell_size,0); 428 429 n.Normalize(); 429 430 break; … … 865 866 x.Zero(); 866 867 y.Zero(); 867 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 magnitude868 y.x[abs(axis)-1] = World::get()->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude 868 869 for (int i=1;i<faktor;i++) { // then add this list with respective translation factor times 869 870 x.AddVector(&y); // per factor one cell width further … … 888 889 mol->Translate(&x); 889 890 } 890 mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;891 World::get()->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor; 891 892 } 892 893 } … … 945 946 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl; 946 947 Log() << Verbose(0) << "Enter translation vector." << endl; 947 x.AskPosition( mol->cell_size,0);948 x.AskPosition(World::get()->cell_size,0); 948 949 mol->Center.AddVector((const Vector *)&x); 949 950 } … … 1005 1006 // center at set box dimensions 1006 1007 mol->CenterEdge(¢er); 1007 mol->cell_size[0] = center.x[0]; 1008 mol->cell_size[1] = 0; 1009 mol->cell_size[2] = center.x[1]; 1010 mol->cell_size[3] = 0; 1011 mol->cell_size[4] = 0; 1012 mol->cell_size[5] = center.x[2]; 1008 double * const cell_size = World::get()->cell_size; 1009 cell_size[0] = center.x[0]; 1010 cell_size[1] = 0; 1011 cell_size[2] = center.x[1]; 1012 cell_size[3] = 0; 1013 cell_size[4] = 0; 1014 cell_size[5] = center.x[2]; 1013 1015 molecules->insert(mol); 1014 1016 } … … 2105 2107 factor[2] = atof(argv[argptr+2]); 2106 2108 mol->Scale((const double ** const)&factor); 2109 double * const cell_size = World::get()->cell_size; 2107 2110 for (int i=0;i<NDIM;i++) { 2108 2111 j += i+1; 2109 2112 x.x[i] = atof(argv[NDIM+i]); 2110 mol->cell_size[j]*=factor[i];2113 cell_size[j]*=factor[i]; 2111 2114 } 2112 2115 delete[](factor); … … 2124 2127 j = -1; 2125 2128 Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl; 2129 double * const cell_size = World::get()->cell_size; 2126 2130 for (int i=0;i<6;i++) { 2127 mol->cell_size[i] = atof(argv[argptr+i]);2131 cell_size[i] = atof(argv[argptr+i]); 2128 2132 } 2129 2133 // center … … 2142 2146 j = -1; 2143 2147 Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl; 2148 double * const cell_size = World::get()->cell_size; 2144 2149 for (int i=0;i<6;i++) { 2145 mol->cell_size[i] = atof(argv[argptr+i]);2150 cell_size[i] = atof(argv[argptr+i]); 2146 2151 } 2147 2152 // center … … 2165 2170 mol->SetBoxDimension(&x); 2166 2171 // translate each coordinate by boundary 2172 double * const cell_size = World::get()->cell_size; 2167 2173 j=-1; 2168 2174 for (int i=0;i<NDIM;i++) { 2169 2175 j += i+1; 2170 2176 x.x[i] = atof(argv[argptr+i]); 2171 mol->cell_size[j] += x.x[i]*2.;2177 cell_size[j] += x.x[i]*2.; 2172 2178 } 2173 2179 mol->Translate((const Vector *)&x); … … 2300 2306 } else { 2301 2307 SaveFlag = true; 2308 double * const cell_size = World::get()->cell_size; 2302 2309 for (int axis = 1; axis <= NDIM; axis++) { 2303 2310 int faktor = atoi(argv[argptr++]); … … 2326 2333 x.Zero(); 2327 2334 y.Zero(); 2328 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 magnitude2335 y.x[abs(axis)-1] = cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude 2329 2336 for (int i=1;i<faktor;i++) { // then add this list with respective translation factor times 2330 2337 x.AddVector(&y); // per factor one cell width further … … 2347 2354 mol->Translate(&x); 2348 2355 } 2349 mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;2356 cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor; 2350 2357 } 2351 2358 } … … 2416 2423 if (molecules->ListOfMolecules.size() == 0) { 2417 2424 mol = new molecule(periode); 2418 if (mol->cell_size[0] == 0.) { 2425 double * const cell_size = World::get()->cell_size; 2426 if (cell_size[0] == 0.) { 2419 2427 Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl; 2420 2428 for (int i=0;i<6;i++) { 2421 2429 Log() << Verbose(1) << "Cell size" << i << ": "; 2422 cin >> mol->cell_size[i];2430 cin >> cell_size[i]; 2423 2431 } 2424 2432 }
Note:
See TracChangeset
for help on using the changeset viewer.
