- Timestamp:
- Feb 22, 2012, 11:29:22 AM (13 years ago)
- 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:
- 7e3065
- Parents:
- c96423
- git-author:
- Frederik Heber <heber@…> (01/18/12 18:13:52)
- git-committer:
- Frederik Heber <heber@…> (02/22/12 11:29:22)
- Location:
- src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Values.cpp
rc96423 r2a0271 41 41 static_cast<Vector>(returnVector) = Vector(vector); // under its hood it's still a Vector 42 42 43 ASSERT(_box.is Inside(returnVector),43 ASSERT(_box.isValid(returnVector), 44 44 "VectorValue::toBoxVector() - vector "+toString(toVector())+" does not lie within box "+toString(_box)+"."); 45 45 -
src/Box.cpp
rc96423 r2a0271 169 169 result = result && 170 170 ((conditions[i] == BoundaryConditions::Ignore) || 171 ((tester[i] >= -MYEPSILON) && 172 ((tester[i] - 1.) < MYEPSILON))); 173 174 return result; 175 } 176 177 bool Box::isValid(const Vector &point) const 178 { 179 bool result = true; 180 Vector tester = translateOut(point); 181 182 for(int i=0;i<NDIM;i++) 183 result = result && 184 ((conditions[i] != BoundaryConditions::Ignore) || 171 185 ((tester[i] >= -MYEPSILON) && 172 186 ((tester[i] - 1.) < MYEPSILON))); -
src/Box.hpp
rc96423 r2a0271 83 83 84 84 /** 85 * Checks whether a given vector is inside the box .85 * Checks whether a given vector is inside the box not accounting for boundary conditions. 86 86 */ 87 87 bool isInside(const Vector &point) const; 88 89 /** 90 * Checks whether a given vector is inside the box under the given boundary conditions. 91 */ 92 bool isValid(const Vector &point) const; 93 88 94 89 95 /** … … 146 152 void internal_explode(const Vector &point,int n) const; 147 153 154 148 155 //!> Internal vector list for exploding vectors used in Box::internal_explode(). 149 156 mutable VECTORSET(std::vector) internal_list; -
src/LinkedCell/LinkedCell_Model.cpp
rc96423 r2a0271 288 288 const LinkedCell::tripleIndex LinkedCell::LinkedCell_Model::getIndexToVector(const Vector &position) const 289 289 { 290 ASSERT(domain.isValid(position), 291 "LinkedCell::LinkedCell_Model::getIndexToVector() - specified position "+toString(position) 292 +"is not valid in the current domain."); 290 293 tripleIndex index; 291 294 Vector x(Partition*domain.enforceBoundaryConditions(position)); -
src/LinkedCell/unittests/stubs/ObserverBoxStub.cpp
rc96423 r2a0271 70 70 } 71 71 72 bool Box::isValid(const Vector &p) const 73 { 74 return true; 75 } 76 72 77 void Box::setM(RealSpaceMatrix _M) 73 78 { -
src/Tesselation/boundary.cpp
rc96423 r2a0271 1175 1175 boundary, 1176 1176 CurrentPosition); 1177 FillIt = FillIt && (Domain.is Inside(CurrentPosition))1177 FillIt = FillIt && (Domain.isValid(CurrentPosition)) 1178 1178 && ((Domain.DistanceToBoundary(CurrentPosition) - MinDistance) > -MYEPSILON); 1179 1179 if (!FillIt) … … 1240 1240 }; 1241 1241 1242 1243 /** Fills the empty space around other molecules' surface of the simulation box with a filler. 1244 * 1245 * Note that we use \a FindNonConvexBorder to determine the surface of the found molecules. 1246 * There, we use a radius of twice the given \a boundary. 1247 * 1248 * \param *out output stream for debugging 1249 * \param *List list of molecules already present in box 1250 * \param *TesselStruct contains tesselated surface 1251 * \param *filler molecule which the box is to be filled with 1252 * \param configuration contains box dimensions 1253 * \param MaxSurfaceDistance fills in molecules only up to this distance (set to -1 if whole of the domain) 1254 * \param distance[NDIM] distance between filling molecules in each direction 1255 * \param boundary length of boundary zone between molecule and filling molecules 1256 * \param MinDistance distance to boundary of domain which is not filled 1257 * \param RandAtomDisplacement maximum distance for random displacement per atom 1258 * \param RandMolDisplacement maximum distance for random displacement per filler molecule 1259 * \param DoRandomRotation true - do random rotations, false - don't 1260 */ 1261 void FillBoxWithMolecule( 1262 MoleculeListClass *MolList, 1263 molecule *filler, 1264 config &configuration, 1265 const double MaxSurfaceDistance, 1266 const double distance[NDIM], 1267 const double boundary, 1268 const double MinDistance, 1269 const double RandomAtomDisplacement, 1270 const double RandomMolDisplacement, 1271 const bool DoRandomRotation) 1272 { 1273 Info FunctionInfo(__func__); 1274 molecule *Filling = NULL; 1275 Vector CurrentPosition; 1276 int N[NDIM]; 1277 int n[NDIM]; 1278 const RealSpaceMatrix &M = World::getInstance().getDomain().getM(); 1279 RealSpaceMatrix Rotations; 1280 const RealSpaceMatrix &MInverse = World::getInstance().getDomain().getMinv(); 1281 Vector FillerTranslations; 1282 Vector FillerDistance; 1283 Vector Inserter; 1284 double FillIt = false; 1285 Vector firstInserter; 1286 bool firstInsertion = true; 1287 const Box &Domain = World::getInstance().getDomain(); 1288 map<molecule *, LinkedCell_deprecated *> LCList; 1289 std::vector<molecule *> List = World::getInstance().getAllMolecules(); 1290 map<molecule *, Tesselation *> TesselStruct; 1291 1292 for (MoleculeList::iterator ListRunner = MolList->ListOfMolecules.begin(); ListRunner != MolList->ListOfMolecules.end(); ListRunner++) 1293 if ((*ListRunner)->getAtomCount() > 0) { 1294 LOG(1, "Pre-creating linked cell lists for molecule " << *ListRunner << "."); 1295 PointCloudAdaptor< molecule > cloud(*ListRunner, (*ListRunner)->name); 1296 LCList[(*ListRunner)] = new LinkedCell_deprecated(cloud, 4.*boundary); // get linked cell list 1297 LOG(1, "Pre-creating tesselation for molecule " << *ListRunner << "."); 1298 TesselStruct[(*ListRunner)] = NULL; 1299 FindNonConvexBorder((*ListRunner), TesselStruct[(*ListRunner)], (const LinkedCell_deprecated *&)LCList[(*ListRunner)], 2.*boundary, NULL); 1300 } 1301 1302 // Center filler at origin 1303 filler->CenterEdge(&Inserter); 1304 const int FillerCount = filler->getAtomCount(); 1305 LOG(2, "INFO: Filler molecule has the following bonds:"); 1306 for(molecule::iterator AtomRunner = filler->begin(); AtomRunner != filler->end(); ++AtomRunner) { 1307 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 1308 for(BondList::const_iterator BondRunner = ListOfBonds.begin(); 1309 BondRunner != ListOfBonds.end(); 1310 ++BondRunner) { 1311 if ((*BondRunner)->leftatom == *AtomRunner) 1312 LOG(2, " " << *(*BondRunner)); 1313 } 1314 } 1315 1316 atom * CopyAtoms[FillerCount]; 1317 1318 setVerbosity(4); 1319 1320 // calculate filler grid in [0,1]^3 1321 FillerDistance = MInverse * Vector(distance[0], distance[1], distance[2]); 1322 for(int i=0;i<NDIM;i++) 1323 N[i] = (int) ceil(1./FillerDistance[i]); 1324 LOG(1, "INFO: Grid steps are " << N[0] << ", " << N[1] << ", " << N[2] << "."); 1325 1326 // initialize seed of random number generator to current time 1327 RandomNumberGenerator &random = RandomNumberGeneratorFactory::getInstance().makeRandomNumberGenerator(); 1328 const double rng_min = random.min(); 1329 const double rng_max = random.max(); 1330 //srand ( time(NULL) ); 1331 1332 // go over [0,1]^3 filler grid 1333 for (n[0] = 0; n[0] < N[0]; n[0]++) 1334 for (n[1] = 0; n[1] < N[1]; n[1]++) 1335 for (n[2] = 0; n[2] < N[2]; n[2]++) { 1336 // calculate position of current grid vector in untransformed box 1337 CurrentPosition = M * Vector((double)n[0]/(double)N[0], (double)n[1]/(double)N[1], (double)n[2]/(double)N[2]); 1338 // create molecule random translation vector ... 1339 for (int i=0;i<NDIM;i++) 1340 FillerTranslations[i] = RandomMolDisplacement*(random()/((rng_max-rng_min)/2.) - 1.); 1341 LOG(1, "INFO: Current Position is " << CurrentPosition << "+" << FillerTranslations << "."); 1342 1343 // ... and rotation matrix 1344 if (DoRandomRotation) 1345 setRandomRotation(Rotations); 1346 else 1347 Rotations.setIdentity(); 1348 1349 1350 // Check whether there is anything too close by and whether atom is outside of domain 1351 FillIt = true; 1352 for (std::map<molecule *, LinkedCell_deprecated *>::iterator ListRunner = LCList.begin(); ListRunner != LCList.end(); ++ListRunner) { 1353 // check whether its void 1354 FillIt = FillIt && isSpaceAroundPointVoid( 1355 ListRunner->second, 1356 (firstInsertion ? filler : NULL), 1357 boundary, 1358 CurrentPosition); 1359 if (!FillIt) { 1360 LOG(2, "REJECT: Position at " << Inserter << " is non-void."); 1361 break; 1362 } 1363 // check whether inside domain 1364 FillIt = FillIt && (Domain.isValid(CurrentPosition)); 1365 if (!FillIt) { 1366 LOG(2, "REJECT: Position at " << CurrentPosition << " is " 1367 << distance << ", hence outside of domain."); 1368 break; 1369 } 1370 // check minimum distance to boundary 1371 const double distance = (Domain.DistanceToBoundary(CurrentPosition) - MinDistance); 1372 FillIt = FillIt && (distance > -MYEPSILON); 1373 if (!FillIt) { 1374 LOG(2, "REJECT: Position at " << CurrentPosition << " is " << distance << ", less than " 1375 << MinDistance << " hence, too close to boundary."); 1376 break; 1377 } 1378 } 1379 // Check whether point is in- or outside of tesselations 1380 if (FillIt) { 1381 for (MoleculeList::iterator ListRunner = MolList->ListOfMolecules.begin(); ListRunner != MolList->ListOfMolecules.end(); ListRunner++) { 1382 // get linked cell list 1383 if (TesselStruct[(*ListRunner)] != NULL) { 1384 const double distance = (TesselStruct[(*ListRunner)]->GetDistanceToSurface(Inserter, LCList[(*ListRunner)])); 1385 LOG(2, "INFO: Distance to surface is " << distance << "."); 1386 FillIt = FillIt && ((distance == -1.) || (distance > boundary)) && ((MaxSurfaceDistance < 0) || (MaxSurfaceDistance > distance)); 1387 if (!FillIt) { 1388 LOG(2, "REJECT: Position at " << CurrentPosition << " is in distance of " << distance 1389 << " to a surface, less than " << MaxSurfaceDistance << " hence, too close."); 1390 break; 1391 } 1392 } 1393 } 1394 } 1395 1396 // insert into Filling 1397 if (FillIt) { 1398 Inserter = CurrentPosition + FillerTranslations; 1399 LOG(2, "ACCEPT: Position at " << CurrentPosition << " is void point."); 1400 // fill! 1401 Filling = filler->CopyMolecule(); 1402 RandomizeMoleculePositions(Filling, RandomAtomDisplacement, Rotations, random); 1403 // translation 1404 Filling->Translate(&Inserter); 1405 // remove out-of-bounds atoms 1406 const bool status = RemoveAtomsOutsideDomain(Filling); 1407 if ((firstInsertion) && (!status)) { // no atom has been removed 1408 // remove copied atoms and molecule again 1409 Filling->removeAtomsinMolecule(); 1410 World::getInstance().destroyMolecule(Filling); 1411 // and mark is final filler position 1412 Filling = filler; 1413 firstInsertion = false; 1414 firstInserter = Inserter; 1415 } else { 1416 // TODO: Remove when World has no MoleculeListClass anymore 1417 if (Filling) 1418 MolList->insert(Filling); 1419 } 1420 } else { 1421 LOG(2, "REJECT: Position at " << CurrentPosition << " is non-void point, within boundary or outside of MaxSurfaceDistance."); 1422 continue; 1423 } 1424 } 1425 1426 // have we inserted any molecules? 1427 if (firstInsertion) { 1428 // If not remove filler 1429 for(molecule::iterator miter = filler->begin(); !filler->empty(); miter = filler->begin()) { 1430 atom *Walker = *miter; 1431 World::getInstance().destroyAtom(Walker); 1432 } 1433 World::getInstance().destroyMolecule(filler); 1434 } else { 1435 // otherwise translate and randomize to final position 1436 if (DoRandomRotation) 1437 setRandomRotation(Rotations); 1438 else 1439 Rotations.setIdentity(); 1440 RandomizeMoleculePositions(filler, RandomAtomDisplacement, Rotations, random); 1441 // translation 1442 filler->Translate(&firstInserter); 1443 // remove out-of-bounds atoms 1444 RemoveAtomsOutsideDomain(filler); 1445 } 1446 1447 LOG(0, MolList->ListOfMolecules.size() << " molecules have been inserted."); 1448 1449 for (std::map<molecule *, LinkedCell_deprecated *>::iterator ListRunner = LCList.begin(); !LCList.empty(); ListRunner = LCList.begin()) { 1450 delete ListRunner->second; 1451 LCList.erase(ListRunner); 1452 } 1453 }; 1454 1242 1455 /** Tesselates the non convex boundary by rolling a virtual sphere along the surface of the molecule. 1243 1456 * \param *out output stream for debugging -
src/UIElements/CommandLineUI/Query/VectorCommandLineQuery.cpp
rc96423 r2a0271 41 41 temp = CommandLineParser::getInstance().vm[getTitle()].as< VectorValue >(); 42 42 tmp = temp.toVector(); 43 if ((check) && (!World::getInstance().getDomain().is Inside(tmp))) {43 if ((check) && (!World::getInstance().getDomain().isValid(tmp))) { 44 44 ELOG(1, "Vector " << tmp << " would be outside of box domain."); 45 45 return false; -
src/UIElements/CommandLineUI/Query/VectorsCommandLineQuery.cpp
rc96423 r2a0271 42 42 for(std::vector<VectorValue>::iterator iter = temporary.begin(); iter != temporary.end(); ++iter) { 43 43 temp = (*iter).toVector(); 44 if ((!check) || (World::getInstance().getDomain().is Inside(temp)))44 if ((!check) || (World::getInstance().getDomain().isValid(temp))) 45 45 tmp.push_back(temp); 46 46 else -
src/UIElements/TextUI/Query/VectorTextQuery.cpp
rc96423 r2a0271 67 67 68 68 // check vector 69 return World::getInstance().getDomain().is Inside(tmp);69 return World::getInstance().getDomain().isValid(tmp); 70 70 } 71 71 -
src/UIElements/TextUI/Query/VectorsTextQuery.cpp
rc96423 r2a0271 71 71 temp[counter++] = coord; 72 72 } 73 if (World::getInstance().getDomain().is Inside(temp))73 if (World::getInstance().getDomain().isValid(temp)) 74 74 tmp.push_back(temp); 75 75 olditerspace = vectoriter;
Note:
See TracChangeset
for help on using the changeset viewer.