- Timestamp:
- Dec 8, 2008, 2:16:34 PM (16 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:
- caf5d6
- Parents:
- a8bcea6
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/boundary.cpp
ra8bcea6 rf714979 514 514 double a,b,c; 515 515 516 Find_non_convex_border(out, tecplot, *TesselStruct, mol);517 /* 516 //Find_non_convex_border(out, tecplot, *TesselStruct, mol); // Is now called from command line. 517 518 518 // 1. calculate center of gravity 519 519 *out << endl; … … 559 559 560 560 *out << Verbose(2) << "I created " << TesselStruct->TrianglesOnBoundaryCount << " triangles with " << TesselStruct->LinesOnBoundaryCount << " lines and " << TesselStruct->PointsOnBoundaryCount << " points." << endl; 561 */ 561 562 562 563 563 … … 582 582 *out << Verbose(0) << "RESULT: The summed volume is " << setprecision(10) << volume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." << endl; 583 583 584 /* 584 585 585 // 7. translate all points back from CoG 586 586 *out << Verbose(1) << "Translating system back from Center of Gravity." << endl; … … 591 591 Walker->x.Translate(CenterOfGravity); 592 592 } 593 */ 593 594 594 595 595 … … 1039 1039 * with all neighbours of the candidate. 1040 1040 */ 1041 void Find_next_suitable_point(atom* a, atom* b, atom* Candidate, int n, Vector *Chord, Vector *d1, Vector * d2, atom*& Opt_Candidate, double *Storage, const double RADIUS, molecule* mol, bool problem)1042 { 1043 /* d2 is normal vector on thetriangle1044 * d1 is normal on the triangle line, from which we come, as well as on d2.1041 void Find_next_suitable_point(atom* a, atom* b, atom* Candidate, int n, Vector *Chord, Vector *d1, Vector *OldNormal, atom*& Opt_Candidate, double *Storage, const double RADIUS, molecule* mol, bool problem) 1042 { 1043 /* OldNormal is normal vector on the old triangle 1044 * d1 is normal on the triangle line, from which we come, as well as on OldNormal. 1045 1045 */ 1046 1046 Vector dif_a; //Vector from a to candidate … … 1066 1066 { 1067 1067 1068 if (Chord->Norm()/(2*sin( dif_a.Angle(&dif_b)))<RADIUS) //Using Formula for relation of chord length with inner angle to find of Ball will touch atom1068 if (Chord->Norm()/(2*sin(0.5*dif_a.Angle(&dif_b)))<RADIUS) //Using Formula for relation of chord length with inner angle to find if Ball will touch atom 1069 1069 { 1070 1070 if (dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1))>Storage[0]) //This will give absolute preference to those in "right-hand" quadrants … … 1072 1072 Opt_Candidate = Candidate; 1073 1073 Storage[0]=dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1)); 1074 Storage[1]=AngleCheck.Angle( d2);1074 Storage[1]=AngleCheck.Angle(OldNormal); 1075 1075 } 1076 1076 else 1077 1077 { 1078 if ((dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1)) == Storage[0] && Storage[0]>0 && Storage[1] < AngleCheck.Angle(d2)) or \1079 (dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1)) == Storage[0] && Storage[0]<0 && Storage[1] > AngleCheck.Angle(d2)))1078 if ((dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1)) == Storage[0] && Storage[0]>0 && Storage[1]> AngleCheck.Angle(OldNormal)) or \ 1079 (dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1)) == Storage[0] && Storage[0]<0 && Storage[1]< AngleCheck.Angle(OldNormal))) 1080 1080 //Depending on quadrant we prefer higher or lower atom with respect to Triangle normal first. 1081 1081 { 1082 1082 Opt_Candidate = Candidate; 1083 1083 Storage[0]=dif_a.ScalarProduct(d1)/fabs(dif_a.ScalarProduct(d1)); 1084 Storage[1]=AngleCheck.Angle( d2);1084 Storage[1]=AngleCheck.Angle(OldNormal); 1085 1085 } 1086 1086 else 1087 1087 { 1088 1088 if (problem) 1089 cout << "Lo ses to better candidate" << endl;1089 cout << "Looses to better candidate" << endl; 1090 1090 } 1091 1091 } … … 1109 1109 Walker = mol->ListOfBondsPerAtom[Candidate->nr][i]->GetOtherAtom(Candidate); 1110 1110 1111 Find_next_suitable_point(a, b, Walker, n+1, Chord, d1, d2, Opt_Candidate, Storage, RADIUS, mol, problem); //call function again1111 Find_next_suitable_point(a, b, Walker, n+1, Chord, d1, OldNormal, Opt_Candidate, Storage, RADIUS, mol, problem); //call function again 1112 1112 } 1113 1113 } … … 1117 1117 * this function fins a triangle to a line, adjacent to an existing one. 1118 1118 */ 1119 void Tesselation::Find_next_suitable_triangle(ofstream *out, ofstream *tecplot, molecule* mol, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS )1119 void Tesselation::Find_next_suitable_triangle(ofstream *out, ofstream *tecplot, molecule* mol, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, int N) 1120 1120 { 1121 1121 cout << Verbose(1) << "Looking for next suitable triangle \n"; … … 1147 1147 direction1.VectorProduct(&(T.NormalVector)); 1148 1148 1149 if (direction1.ScalarProduct(&helper) >0)1149 if (direction1.ScalarProduct(&helper)<0) 1150 1150 { 1151 1151 direction1.Scale(-1); … … 1158 1158 Find_next_suitable_point(Line.endpoints[0]->node, Line.endpoints[1]->node, Line.endpoints[0]->node, 0, &Chord, &direction1, &(T.NormalVector), Opt_Candidate, Storage, RADIUS, mol,0); 1159 1159 1160 if ( Opt_Candidate==NULL)1160 if (N>-1) 1161 1161 { 1162 1162 cout << Verbose(1) << "No new Atom found, triangle construction will crash" << endl; … … 1180 1180 cout << " Optimal candidate is " << *Opt_Candidate << endl; 1181 1181 BPS[0] = new class BoundaryPointSet(Opt_Candidate); 1182 cout << " Optimal candidate is " << *Opt_Candidate << endl; 1182 1183 1183 BPS[1] = new class BoundaryPointSet(Line.endpoints[1]->node); 1184 1184 BLS[1] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount); … … 1190 1190 1191 1191 cout << Verbose(1) << "Checking for already present lines ... " << endl; 1192 for(int i=0;i<NDIM;i++) // sind Linien bereits vorhanden ??? 1193 { 1194 1195 1196 if ( (LinesOnBoundary.insert( LinePair(LinesOnBoundaryCount, BTS->lines[i]))).second); 1197 { 1198 LinesOnBoundaryCount++; 1199 } 1200 } 1192 for(int i=0; i<NDIM; i++) // sind Linien bereits vorhanden ??? 1193 { 1194 if ( (LinesOnBoundary.insert( LinePair(LinesOnBoundaryCount, BTS->lines[i]))).second); 1195 { 1196 LinesOnBoundaryCount++; 1197 } 1198 } 1201 1199 cout << Verbose(1) << "Constructing normal vector for this triangle ... " << endl; 1202 1200 … … 1219 1217 atom* Walker; 1220 1218 1221 AngleCheck.CopyVector(&(Candidate->x)); 1222 AngleCheck.SubtractVector(&(a->x)); 1223 if (AngleCheck.Norm() < RADIUS and AngleCheck.Angle(&Oben) < Storage[0]) 1224 { 1225 //cout << Verbose(1) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]); 1226 Opt_Candidate=Candidate; 1227 Storage[0]=AngleCheck.Angle(&Oben); 1228 //cout << Verbose(1) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[1]); 1229 }; 1219 if (a->nr !=Candidate->nr) 1220 { 1221 AngleCheck.CopyVector(&(Candidate->x)); 1222 AngleCheck.SubtractVector(&(a->x)); 1223 if (AngleCheck.Norm() < RADIUS and AngleCheck.Angle(&Oben) < Storage[0]) 1224 { 1225 //cout << Verbose(1) << "Old values of Storage: %lf %lf \n", Storage[0], Storage[1]); 1226 Opt_Candidate=Candidate; 1227 Storage[0]=AngleCheck.Angle(&Oben); 1228 //cout << Verbose(1) << "Changing something in Storage: %lf %lf. \n", Storage[0], Storage[1]); 1229 } 1230 else{ 1231 if (AngleCheck.Norm() > RADIUS) 1232 { 1233 cout << Verbose(1) << "refused due to Radius" << AngleCheck.Norm() << endl; 1234 } 1235 else{ 1236 cout << Verbose(1) << "Supposedly looses to better candidate" << Opt_Candidate->nr << endl; 1237 } 1238 } 1239 } 1240 1230 1241 if (n<5) 1231 1242 { … … 1246 1257 int i=0; 1247 1258 atom* Walker; 1248 atom* Walker2;1249 atom* Walker3;1259 atom* FirstPoint; 1260 atom* SecondPoint; 1250 1261 int max_index[3]; 1251 1262 double max_coordinate[3]; … … 1267 1278 { 1268 1279 Walker = Walker->next; 1269 1270 1271 1272 1273 1274 1275 1276 1277 } 1278 1279 cout << Verbose(1) << "Found starting atom \n";1280 for (i=0; i<3; i++) 1281 { 1282 if (Walker->x.x[i] > max_coordinate[i]) 1283 { 1284 max_coordinate[i]=Walker->x.x[i]; 1285 max_index[i]=Walker->nr; 1286 } 1287 } 1288 } 1289 1290 cout << Verbose(1) << "Found maximum coordinates. "<< endl; 1280 1291 //Koennen dies fuer alle Richtungen, legen hier erstmal Richtung auf k=0 1281 const int k= 2;1292 const int k=0; 1282 1293 1283 1294 Oben.x[k]=1.; 1284 Walker= mol->start;1285 Walker = Walker->next;1286 while ( Walker->nr != max_index[k])1295 FirstPoint = mol->start; 1296 FirstPoint = FirstPoint->next; 1297 while (FirstPoint->nr != max_index[k]) 1287 1298 { 1288 Walker = Walker->next;1289 } 1290 cout << Verbose(1) << "Number of start atom: " << Walker->nr<< endl;1299 FirstPoint = FirstPoint->next; 1300 } 1301 cout << Verbose(1) << "Coordinates of start atom: " << FirstPoint->x.x[0] << endl; 1291 1302 double Storage[2]; 1292 1303 atom* Opt_Candidate = NULL; 1293 1304 Storage[0]=999999.; // This will contain the angle, which will be always positive (when looking for second point), when looking for third point this will be the quadrant. 1294 1305 Storage[1]=999999.; // This will be an angle looking for the third point. 1295 cout << Verbose(1) << "Number of Bonds: " << mol->NumberOfBondsPerAtom[Walker->nr] << endl; 1296 1297 for (i=1; i< (mol->NumberOfBondsPerAtom[Walker->nr]); i++) 1298 { 1299 Walker2 = mol->ListOfBondsPerAtom[Walker->nr][i]->GetOtherAtom(Walker); 1300 Find_second_point_for_Tesselation(Walker, Walker2, 0, Oben, Opt_Candidate, Storage, mol, RADIUS); 1301 } 1302 1303 Walker2 = Opt_Candidate; 1306 cout << Verbose(1) << "Number of Bonds: " << mol->NumberOfBondsPerAtom[FirstPoint->nr] << endl; 1307 1308 Find_second_point_for_Tesselation(FirstPoint, mol->ListOfBondsPerAtom[FirstPoint->nr][0]->GetOtherAtom(FirstPoint), 0, Oben, Opt_Candidate, Storage, mol, RADIUS); 1309 1310 1311 SecondPoint = Opt_Candidate; 1304 1312 Opt_Candidate=NULL; 1305 helper.CopyVector(&( Walker->x));1306 helper.SubtractVector(&( Walker2->x));1313 helper.CopyVector(&(FirstPoint->x)); 1314 helper.SubtractVector(&(SecondPoint->x)); 1307 1315 Oben.ProjectOntoPlane(&helper); 1308 1316 helper.VectorProduct(&Oben); … … 1310 1318 Storage[1]= 9999999.; // This will be an angle looking for the third point. 1311 1319 1312 Chord.CopyVector(&( Walker->x)); // bring into calling function1313 Chord.SubtractVector(&( Walker2->x));1320 Chord.CopyVector(&(FirstPoint->x)); // bring into calling function 1321 Chord.SubtractVector(&(SecondPoint->x)); 1314 1322 1315 1323 cout << Verbose(1) << "Looking for third point candidates \n"; 1316 Find_next_suitable_point( Walker, Walker2, mol->ListOfBondsPerAtom[Walker->nr][0]->GetOtherAtom(Walker), 0, &Chord, &helper, &Oben, Opt_Candidate, Storage, RADIUS, mol, 0);1317 1318 1319 //Starting Triangle is Walker, Walker2, Opt_Candidate1320 1321 AddPoint( Walker);1322 AddPoint( Walker2);1324 Find_next_suitable_point(FirstPoint, SecondPoint, mol->ListOfBondsPerAtom[FirstPoint->nr][0]->GetOtherAtom(FirstPoint), 0, &Chord, &helper, &Oben, Opt_Candidate, Storage, RADIUS, mol, 0); 1325 1326 1327 //Starting Triangle is Walker, SecondPoint, Opt_Candidate 1328 1329 AddPoint(FirstPoint); 1330 AddPoint(SecondPoint); 1323 1331 AddPoint(Opt_Candidate); 1324 1332 1325 cout << Verbose(1) << "The found starting triangle consists of " << * Walker << ", " << *Walker2<< " and " << *Opt_Candidate << "." << endl;1326 1327 BPS[0] = new class BoundaryPointSet( Walker);1328 BPS[1] = new class BoundaryPointSet( Walker2);1333 cout << Verbose(1) << "The found starting triangle consists of " << *FirstPoint << ", " << *SecondPoint << " and " << *Opt_Candidate << "." << endl; 1334 1335 BPS[0] = new class BoundaryPointSet(FirstPoint); 1336 BPS[1] = new class BoundaryPointSet(SecondPoint); 1329 1337 BLS[0] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount); 1330 BPS[0] = new class BoundaryPointSet( Walker);1338 BPS[0] = new class BoundaryPointSet(FirstPoint); 1331 1339 BPS[1] = new class BoundaryPointSet(Opt_Candidate); 1332 1340 BLS[1] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount); 1333 BPS[0] = new class BoundaryPointSet( Walker);1334 BPS[1] = new class BoundaryPointSet( Walker2);1341 BPS[0] = new class BoundaryPointSet(Opt_Candidate); 1342 BPS[1] = new class BoundaryPointSet(SecondPoint); 1335 1343 BLS[2] = new class BoundaryLineSet(BPS , LinesOnBoundaryCount); 1336 1344 … … 1354 1362 1355 1363 1356 void Find_non_convex_border(ofstream *out, ofstream *tecplot, Tesselation Tess, molecule* mol) 1357 { 1364 void Find_non_convex_border(ofstream *out, ofstream *tecplot, molecule* mol) 1365 { 1366 int N =0; 1367 struct Tesselation *Tess = new Tesselation; 1358 1368 cout << Verbose(1) << "Entering finding of non convex hull. " << endl; 1359 1369 cout << flush; 1360 const double RADIUS =6; 1361 LineMap::iterator baseline; 1362 Tess.Find_starting_triangle(mol, RADIUS); 1363 1364 baseline = Tess.LinesOnBoundary.begin(); 1365 while (baseline != Tess.LinesOnBoundary.end()) { 1366 if (baseline->second->TrianglesCount == 1) 1367 { 1368 cout << Verbose(1) << "Begin of Tesselation ... " << endl; 1369 Tess.Find_next_suitable_triangle(out, tecplot, mol, *(baseline->second), *(baseline->second->triangles.begin()->second), RADIUS); //the line is there, so there is a triangle, but only one. 1370 cout << Verbose(1) << "End of Tesselation ... " << endl; 1371 } 1372 else 1373 { 1374 cout << Verbose(1) << "There is a line with " << baseline->second->TrianglesCount << " triangles adjacent"; 1375 } 1376 baseline++; 1377 } 1378 1379 }; 1370 const double RADIUS =6.; 1371 LineMap::iterator baseline; 1372 Tess->Find_starting_triangle(mol, RADIUS); 1373 1374 baseline = Tess->LinesOnBoundary.begin(); 1375 while (baseline != Tess->LinesOnBoundary.end()) { 1376 if (baseline->second->TrianglesCount == 1) 1377 { 1378 cout << Verbose(1) << "Begin of Tesselation ... " << endl; 1379 Tess->Find_next_suitable_triangle(out, tecplot, mol, *(baseline->second), *(baseline->second->triangles.begin()->second), RADIUS, N); //the line is there, so there is a triangle, but only one. 1380 cout << Verbose(1) << "End of Tesselation ... " << endl; 1381 } 1382 else 1383 { 1384 cout << Verbose(1) << "There is a line with " << baseline->second->TrianglesCount << " triangles adjacent"; 1385 } 1386 N++; 1387 baseline++; 1388 } 1389 1390 }; -
src/boundary.hpp
ra8bcea6 rf714979 83 83 void AddPoint(atom * Walker); 84 84 void Find_starting_triangle(molecule* mol, const double RADIUS); 85 void Find_next_suitable_triangle(ofstream *out, ofstream *tecplot, molecule* mol, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS );85 void Find_next_suitable_triangle(ofstream *out, ofstream *tecplot, molecule* mol, BoundaryLineSet &Line, BoundaryTriangleSet &T, const double& RADIUS, int N); 86 86 87 87 PointMap PointsOnBoundary; … … 106 106 void PrepareClustersinWater(ofstream *out, config *configuration, molecule *mol, double ClusterVolume, double celldensity); 107 107 void Find_next_suitable_point(atom a, atom b, atom Candidate, int n, Vector *d1, Vector *d2, atom*& Opt_Candidate, double *Storage, const double RADIUS, molecule *mol, bool problem); 108 void Find_non_convex_border(ofstream *out, ofstream *tecplot, Tesselation Tess,molecule* mol);108 void Find_non_convex_border(ofstream *out, ofstream *tecplot, molecule* mol); 109 109 110 110 -
src/builder.cpp
ra8bcea6 rf714979 801 801 cout << "or simply " << argv[0] << " without arguments for interactive session." << endl; 802 802 cout << "\t-a Z x1 x2 x3\tAdd new atom of element Z at coordinates (x1,x2,x3)." << endl; 803 cout << "\t-A <source>\tCreate adjacen zy list from bonds parsed from 'dbond'-style file." <<endl;803 cout << "\t-A <source>\tCreate adjacency list from bonds parsed from 'dbond'-style file." <<endl; 804 804 cout << "\t-b x1 x2 x3\tCenter atoms in domain with given edge lengths of (x1,x2,x3)." << endl; 805 805 cout << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl; … … 813 813 cout << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl; 814 814 cout << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl; 815 cout << "\t-N\tGet non-convex-envelope." << endl; 815 816 cout << "\t-o <out>\tGet volume of the convex envelope (and store to tecplot file)." << endl; 816 817 cout << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl; … … 1015 1016 input->close(); 1016 1017 } 1018 break; 1019 case 'N': 1020 ExitFlag = 1; 1021 if ((argptr >= argc) || (argv[argptr][0] == '-')){ 1022 ExitFlag = 255; 1023 cerr << "Not enough or invalid arguments given for non-convex envelope: -o <tecplot output file>" << endl; 1024 } 1025 else { 1026 cout << Verbose(0) << "Evaluating npn-convex envelope."; 1027 ofstream *output = new ofstream(argv[argptr], ios::trunc); 1028 cout << Verbose(1) << "Storing tecplot data in " << argv[argptr] << "." << endl; 1029 Find_non_convex_border((ofstream *)&cout, output, mol); 1030 output->close(); 1031 delete(output); 1032 argptr+=1; 1033 } 1017 1034 break; 1018 1035 case 'T': -
src/molecules.cpp
ra8bcea6 rf714979 1677 1677 1678 1678 /** Creates an adjacency list of the molecule. 1679 * We obtain an outside file with the indices of atoms which are bondmembers. 1680 */ 1681 void molecule::CreateAdjacencyList2(ofstream *out, ifstream *input) 1682 { 1683 1684 // 1 We will parse bonds out of the dbond file created by tremolo. 1685 int atom1, atom2, temp; 1686 atom *Walker, *OtherWalker; 1687 1688 if (!input) 1689 { 1690 cout << Verbose(1) << "Opening silica failed \n"; 1691 }; 1692 1693 *input >> ws >> atom1; 1694 *input >> ws >> atom2; 1695 cout << Verbose(1) << "Scanning file\n"; 1696 while (!input->eof()) // Check whether we read everything already 1697 { 1698 *input >> ws >> atom1; 1699 *input >> ws >> atom2; 1700 if(atom2<atom1) //Sort indices of atoms in order 1701 { 1702 temp=atom1; 1703 atom1=atom2; 1704 atom2=temp; 1705 }; 1706 1707 Walker=start; 1708 while(Walker-> nr != atom1) // Find atom corresponding to first index 1709 { 1710 Walker = Walker->next; 1711 }; 1712 OtherWalker = Walker->next; 1713 while(OtherWalker->nr != atom2) // Find atom corresponding to second index 1714 { 1715 OtherWalker= OtherWalker->next; 1716 }; 1717 AddBond(Walker, OtherWalker); //Add the bond between the two atoms with respective indices. 1718 BondCount++; //Increase bond count of molecule 1719 } 1720 1721 CreateListOfBondsPerAtom(out); 1722 1723 }; 1724 1725 1726 /** Creates an adjacency list of the molecule. 1679 1727 * Generally, we use the CSD approach to bond recognition, that is the the distance 1680 1728 * between two atoms A and B must be within [Rcov(A)+Rcov(B)-t,Rcov(A)+Rcov(B)+t] with … … 1694 1742 * \param IsAngstroem whether coordinate system is gauged to Angstroem or Bohr radii 1695 1743 */ 1696 void molecule::CreateAdjacencyList2(ofstream *out, ifstream *input)// ofstream* out, double bonddistance, bool IsAngstroem)1697 {1698 1699 // 1 We will parse bonds out of the dbond file created by tremolo.1700 int atom1, atom2, temp;1701 atom *Walker, *OtherWalker;1702 1703 if (!input)1704 {1705 cout << Verbose(1) << "Opening silica failed \n";1706 };1707 1708 *input >> ws >> atom1;1709 *input >> ws >> atom2;1710 cout << Verbose(1) << "Scanning file\n";1711 while (!input->eof()) // Check whether we read 2 items1712 {1713 *input >> ws >> atom1;1714 *input >> ws >> atom2;1715 if(atom2<atom1) //Sort indizes of atoms in order1716 {1717 temp=atom1;1718 atom1=atom2;1719 atom2=temp;1720 };1721 1722 Walker=start;1723 while(Walker-> nr != atom1) // Find atom corresponding to first index1724 {1725 Walker = Walker->next;1726 };1727 OtherWalker = Walker->next;1728 while(OtherWalker->nr != atom2) // Find atom corresponding to second index1729 {1730 OtherWalker= OtherWalker->next;1731 };1732 AddBond(Walker, OtherWalker); //Add the bond between the two atoms with respective indices.1733 BondCount++; //Increase bond count of molecule1734 }1735 1736 CreateListOfBondsPerAtom(out);1737 1738 };1739 1744 void molecule::CreateAdjacencyList(ofstream *out, double bonddistance, bool IsAngstroem) 1740 1745 {
Note:
See TracChangeset
for help on using the changeset viewer.