Changeset b21a64


Ignore:
Timestamp:
Oct 30, 2009, 3:49:38 PM (15 years ago)
Author:
Frederik Heber <heber@…>
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:
34e0013
Parents:
b70721
git-author:
Frederik Heber <heber@…> (10/30/09 15:33:51)
git-committer:
Frederik Heber <heber@…> (10/30/09 15:49:38)
Message:

BondGraph is parsed if command line switch '-g' is given.

  • builder.cpp: case 'g' which gives a bond length table file which is parsed after the configuration and before other command line options.
  • BondGraph::BondLengthMatrixMinMaxDistance() falls back to CovalentMinMaxDistance() if no table parsed.
  • Bond Length Table was changed to have first row _and_ column each enlist all the elements and does not have a "#" in front anymore.
  • The unit test has been changed accordingly.

Signed-off-by: Frederik Heber <heber@…>

Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/bondgraph.cpp

    rb70721 rb21a64  
    4949
    5050  // parse in matrix
    51   BondLengthMatrix->ParseMatrix(filename.c_str(), 0, 0, 0);
     51  BondLengthMatrix->ParseMatrix(filename.c_str(), 0, 1, 0);
    5252
    5353  // find greatest distance
     
    113113void BondGraph::BondLengthMatrixMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem)
    114114{
    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  }
    119124};
    120125
  • src/builder.cpp

    rb70721 rb21a64  
    13571357  int argptr;
    13581358  molecule *mol = NULL;
     1359  string BondGraphFileName("");
    13591360  strncpy(configuration.databasepath, LocalPath, MAXSTRINGSIZE-1);
    13601361
     
    13841385            cout << "\t-E <id> <Z>\tChange atom <id>'s element to <Z>, <id> begins at 0." << endl;
    13851386            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;
    13861388            cout << "\t-h/-H/-?\tGive this help screen." << endl;
    13871389            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;
     
    14201422            }
    14211423            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;
    14221433          case 'n':
    14231434            cout << "I won't parse trajectories." << endl;
     
    14321443    } while (argptr < argc);
    14331444
    1434     // 2. Parse the element database
     1445    // 3a. Parse the element database
    14351446    if (periode->LoadPeriodentafel(configuration.databasepath)) {
    14361447      cout << Verbose(0) << "Element list loaded successfully." << endl;
     
    14401451      return 1;
    14411452    }
    1442     // 3. Find config file name and parse if possible
     1453    // 3b. Find config file name and parse if possible
    14431454    if (argv[1][0] != '-') {
    14441455      // simply create a new molecule, wherein the config file is loaded and the manipulation takes place
     
    14831494    } else
    14841495      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    }
    14851504    // 4. parse again through options, now for those depending on elements db and config presence
    14861505    argptr = 1;
  • src/config.cpp

    rb70721 rb21a64  
    160160/** Constructor for config file class.
    161161 */
    162 config::config() : PsiType(0), MaxPsiDouble(0), PsiMaxNoUp(0), PsiMaxNoDown(0), MaxMinStopStep(1), InitMaxMinStopStep(1), ProcPEGamma(8), ProcPEPsi(1), configpath(NULL),
     162config::config() : BG(NULL), PsiType(0), MaxPsiDouble(0), PsiMaxNoUp(0), PsiMaxNoDown(0), MaxMinStopStep(1), InitMaxMinStopStep(1), ProcPEGamma(8), ProcPEPsi(1), configpath(NULL),
    163163    configname(NULL), FastParsing(false), Deltat(0.01), basis(""), databasepath(NULL), DoConstrainedMD(0), MaxOuterStep(0), Thermostat(4), ThermostatImplemented(NULL),
    164164    ThermostatNames(NULL), TempFrequency(2.5), alpha(0.), HooverMass(0.), TargetTemp(0.00095004455), ScaleTempStep(25),  mainname(NULL), defaultpath(NULL), pseudopotpath(NULL),
  • src/config.hpp

    rb70721 rb21a64  
    1919
    2020#include <string>
     21
     22#include "bondgraph.hpp"
    2123
    2224/****************************************** forward declarations *****************************/
     
    4749class config {
    4850  public:
     51    class BondGraph *BG;
     52
    4953    int PsiType;
    5054    int MaxPsiDouble;
  • src/unittests/bondgraphunittest.cpp

    rb70721 rb21a64  
    7979  filename = new string("test.dat");
    8080  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";
    8284  BG = new BondGraph(true);
    8385};
Note: See TracChangeset for help on using the changeset viewer.