Changes in src/builder.cpp [632bc3:68f03d]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/builder.cpp
r632bc3 r68f03d 1741 1741 DoLog(2) && (Log() << Verbose(2) << "found element " << first->type->name << endl); 1742 1742 for (int i=NDIM;i--;) 1743 first->x .x[i] = atof(argv[argptr+1+i]);1743 first->x[i] = atof(argv[argptr+1+i]); 1744 1744 if (first->type != NULL) { 1745 1745 mol->AddAtom(first); // add to molecule … … 2013 2013 first = World::getInstance().createAtom(); 2014 2014 first->type = periode->FindElement(1); 2015 first->x .Init(0.441, -0.143, 0.);2015 first->x = Vector(0.441, -0.143, 0.); 2016 2016 filler->AddAtom(first); 2017 2017 second = World::getInstance().createAtom(); 2018 2018 second->type = periode->FindElement(1); 2019 second->x .Init(-0.464, 1.137, 0.0);2019 second->x = Vector(-0.464, 1.137, 0.0); 2020 2020 filler->AddAtom(second); 2021 2021 third = World::getInstance().createAtom(); 2022 2022 third->type = periode->FindElement(8); 2023 third->x .Init(-0.464, 0.177, 0.);2023 third->x = Vector(-0.464, 0.177, 0.); 2024 2024 filler->AddAtom(third); 2025 2025 filler->AddBond(first, third, 1); … … 2186 2186 first = second; 2187 2187 second = first->next; 2188 if (first->x.DistanceSquared( (const Vector *)&third->x) > tmp1*tmp1) // distance to first above radius ...2188 if (first->x.DistanceSquared(third->x) > tmp1*tmp1) // distance to first above radius ... 2189 2189 mol->RemoveAtom(first); 2190 2190 } … … 2206 2206 DoLog(1) && (Log() << Verbose(1) << "Translating all ions by given vector." << endl); 2207 2207 for (int i=NDIM;i--;) 2208 x .x[i] = atof(argv[argptr+i]);2208 x[i] = atof(argv[argptr+i]); 2209 2209 mol->Translate((const Vector *)&x); 2210 2210 argptr+=3; … … 2222 2222 DoLog(1) && (Log() << Verbose(1) << "Translating all ions periodically by given vector." << endl); 2223 2223 for (int i=NDIM;i--;) 2224 x .x[i] = atof(argv[argptr+i]);2224 x[i] = atof(argv[argptr+i]); 2225 2225 mol->TranslatePeriodically((const Vector *)&x); 2226 2226 argptr+=3; … … 2245 2245 for (int i=0;i<NDIM;i++) { 2246 2246 j += i+1; 2247 x .x[i] = atof(argv[NDIM+i]);2247 x[i] = atof(argv[NDIM+i]); 2248 2248 cell_size[j]*=factor[i]; 2249 2249 } … … 2309 2309 for (int i=0;i<NDIM;i++) { 2310 2310 j += i+1; 2311 x .x[i] = atof(argv[argptr+i]);2312 cell_size[j] += x .x[i]*2.;2311 x[i] = atof(argv[argptr+i]); 2312 cell_size[j] += x[i]*2.; 2313 2313 } 2314 2314 mol->Translate((const Vector *)&x); … … 2468 2468 x.Zero(); 2469 2469 y.Zero(); 2470 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 magnitude2470 y[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 2471 2471 for (int i=1;i<faktor;i++) { // then add this list with respective translation factor times 2472 x .AddVector(&y); // per factor one cell width further2472 x += y; // per factor one cell width further 2473 2473 for (int k=count;k--;) { // go through every atom of the original cell 2474 2474 first = World::getInstance().createAtom(); // create a new body 2475 first->x.CopyVector(vectors[k]); // use coordinate of original atom 2476 first->x.AddVector(&x); // translate the coordinates 2475 first->x = (*vectors[k]) + x; 2477 2476 first->type = Elements[k]; // insert original element 2478 2477 mol->AddAtom(first); // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...) … … 2484 2483 // correct cell size 2485 2484 if (axis < 0) { // if sign was negative, we have to translate everything 2486 x.Zero(); 2487 x.AddVector(&y); 2488 x.Scale(-(faktor-1)); 2485 x =(-(faktor-1)) * y; 2489 2486 mol->Translate(&x); 2490 2487 } … … 2554 2551 ActionRegistry::purgeInstance(); 2555 2552 ActionHistory::purgeInstance(); 2553 Memory::getState(); 2556 2554 } 2557 2555 … … 2619 2617 cleanUp(configuration); 2620 2618 2621 Memory::getState();2622 2619 return (0); 2623 2620 }
Note:
See TracChangeset
for help on using the changeset viewer.