Changeset b84ab4 for molecuilder
- Timestamp:
- Oct 30, 2009, 3:49:38 PM (16 years ago)
- Children:
- 245826
- Parents:
- 5f697c
- git-author:
- Frederik Heber <heber@…> (10/30/09 15:33:51)
- git-committer:
- Frederik Heber <heber@…> (10/30/09 15:49:38)
- Location:
- molecuilder/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/bondgraph.cpp
r5f697c rb84ab4 49 49 50 50 // parse in matrix 51 BondLengthMatrix->ParseMatrix(filename.c_str(), 0, 0, 0);51 BondLengthMatrix->ParseMatrix(filename.c_str(), 0, 1, 0); 52 52 53 53 // find greatest distance … … 113 113 void BondGraph::BondLengthMatrixMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem) 114 114 { 115 MinDistance = GetBondLength(Walker->type->Z-1, OtherWalker->type->Z-1); 116 MinDistance *= (IsAngstroem) ? 1. : 1. / AtomicLengthToAngstroem; 117 MaxDistance = MinDistance + BONDTHRESHOLD; 118 MinDistance -= BONDTHRESHOLD; 115 if (BondLengthMatrix->Matrix == NULL) {// safety measure if no matrix has been parsed yet 116 cerr << Verbose(1) << "WARNING: BondLengthMatrixMinMaxDistance() called without having parsed the bond length matrix yet!" << endl; 117 CovalentMinMaxDistance(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem); 118 } else { 119 MinDistance = GetBondLength(Walker->type->Z-1, OtherWalker->type->Z-1); 120 MinDistance *= (IsAngstroem) ? 1. : 1. / AtomicLengthToAngstroem; 121 MaxDistance = MinDistance + BONDTHRESHOLD; 122 MinDistance -= BONDTHRESHOLD; 123 } 119 124 }; 120 125 -
molecuilder/src/builder.cpp
r5f697c rb84ab4 1357 1357 int argptr; 1358 1358 molecule *mol = NULL; 1359 string BondGraphFileName(""); 1359 1360 strncpy(configuration.databasepath, LocalPath, MAXSTRINGSIZE-1); 1360 1361 … … 1384 1385 cout << "\t-E <id> <Z>\tChange atom <id>'s element to <Z>, <id> begins at 0." << endl; 1385 1386 cout << "\t-f/F <dist> <order>\tFragments the molecule in BOSSANOVA manner (with/out rings compressed) and stores config files in same dir as config (return code 0 - fragmented, 2 - no fragmentation necessary)." << endl; 1387 cout << "\t-g <file>\tParses a bond length table from the given file." << endl; 1386 1388 cout << "\t-h/-H/-?\tGive this help screen." << endl; 1387 1389 cout << "\t-L <step0> <step1> <prefix>\tStore a linear interpolation between two configurations <step0> and <step1> into single config files with prefix <prefix> and as Trajectories into the current config file." << endl; … … 1420 1422 } 1421 1423 break; 1424 case 'g': 1425 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1426 cerr << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl; 1427 } else { 1428 BondGraphFileName = argv[argptr]; 1429 cout << "Using " << BondGraphFileName << " as bond length table." << endl; 1430 argptr+=1; 1431 } 1432 break; 1422 1433 case 'n': 1423 1434 cout << "I won't parse trajectories." << endl; … … 1432 1443 } while (argptr < argc); 1433 1444 1434 // 2. Parse the element database1445 // 3a. Parse the element database 1435 1446 if (periode->LoadPeriodentafel(configuration.databasepath)) { 1436 1447 cout << Verbose(0) << "Element list loaded successfully." << endl; … … 1440 1451 return 1; 1441 1452 } 1442 // 3 . Find config file name and parse if possible1453 // 3b. Find config file name and parse if possible 1443 1454 if (argv[1][0] != '-') { 1444 1455 // simply create a new molecule, wherein the config file is loaded and the manipulation takes place … … 1483 1494 } else 1484 1495 configPresent = absent; 1496 // 3c. parse the bond graph file if given 1497 configuration.BG = new BondGraph(configuration.GetIsAngstroem()); 1498 if (configuration.BG->LoadBondLengthTable((ofstream *)&cout, BondGraphFileName)) { 1499 cout << Verbose(0) << "Bond length table loaded successfully." << endl; 1500 } else { 1501 cout << Verbose(0) << "Bond length table loading failed." << endl; 1502 return 1; 1503 } 1485 1504 // 4. parse again through options, now for those depending on elements db and config presence 1486 1505 argptr = 1; -
molecuilder/src/config.cpp
r5f697c rb84ab4 160 160 /** Constructor for config file class. 161 161 */ 162 config::config() : PsiType(0), MaxPsiDouble(0), PsiMaxNoUp(0), PsiMaxNoDown(0), MaxMinStopStep(1), InitMaxMinStopStep(1), ProcPEGamma(8), ProcPEPsi(1), configpath(NULL),162 config::config() : BG(NULL), PsiType(0), MaxPsiDouble(0), PsiMaxNoUp(0), PsiMaxNoDown(0), MaxMinStopStep(1), InitMaxMinStopStep(1), ProcPEGamma(8), ProcPEPsi(1), configpath(NULL), 163 163 configname(NULL), FastParsing(false), Deltat(0.01), basis(""), databasepath(NULL), DoConstrainedMD(0), MaxOuterStep(0), Thermostat(4), ThermostatImplemented(NULL), 164 164 ThermostatNames(NULL), TempFrequency(2.5), alpha(0.), HooverMass(0.), TargetTemp(0.00095004455), ScaleTempStep(25), mainname(NULL), defaultpath(NULL), pseudopotpath(NULL), -
molecuilder/src/config.hpp
r5f697c rb84ab4 19 19 20 20 #include <string> 21 22 #include "bondgraph.hpp" 21 23 22 24 /****************************************** forward declarations *****************************/ … … 47 49 class config { 48 50 public: 51 class BondGraph *BG; 52 49 53 int PsiType; 50 54 int MaxPsiDouble; -
molecuilder/src/unittests/bondgraphunittest.cpp
r5f697c rb84ab4 79 79 filename = new string("test.dat"); 80 80 ofstream test(filename->c_str()); 81 test << "# Hydrogen\tCarbon\n1.\t1.2\n1.2\t1.5" << endl; 81 test << ".\tH\tC\n"; 82 test << "H\t1.\t1.2\n"; 83 test << "C\t1.2\t1.5\n"; 82 84 BG = new BondGraph(true); 83 85 };
Note:
See TracChangeset
for help on using the changeset viewer.