Changeset 44a59b for src


Ignore:
Timestamp:
Oct 17, 2009, 5:06:42 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:
07051c
Parents:
09048c
Message:

Renamed and rewritten CreateAdjacencyList2().

  • rename CreateAdjacencyList2() -> CreateAdjacencyListFromDbondFile()
  • initially written by Christian Neuen who was at that time not familiar with all the functions already present. The code is now shortened and tighter.

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

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    r09048c r44a59b  
    16661666                cout << "Parsing bonds from " << argv[argptr] << "." << endl;
    16671667                ifstream *input = new ifstream(argv[argptr]);
    1668                 mol->CreateAdjacencyList2((ofstream *)&cout, input);
     1668                mol->CreateAdjacencyListFromDbondFile((ofstream *)&cout, input);
    16691669                input->close();
    16701670                argptr+=1;
  • src/molecule.hpp

    r09048c r44a59b  
    245245
    246246  /// Initialising routines in fragmentation
    247   void CreateAdjacencyList2(ofstream *out, ifstream *output);
     247  void CreateAdjacencyListFromDbondFile(ofstream *out, ifstream *output);
    248248  void CreateAdjacencyList(ofstream *out, double bonddistance, bool IsAngstroem);
    249249  void CreateListOfBondsPerAtom(ofstream *out);
  • src/molecule_graph.cpp

    r09048c r44a59b  
    2121 * We obtain an outside file with the indices of atoms which are bondmembers.
    2222 */
    23 void molecule::CreateAdjacencyList2(ofstream *out, ifstream *input)
     23void molecule::CreateAdjacencyListFromDbondFile(ofstream *out, ifstream *input)
    2424{
    2525
    2626  // 1 We will parse bonds out of the dbond file created by tremolo.
    27       int atom1, atom2, temp;
    28       atom *Walker, *OtherWalker;
    29 
    30           if (!input)
    31           {
    32             cout << Verbose(1) << "Opening silica failed \n";
    33           };
    34 
    35       *input >> ws >> atom1;
    36       *input >> ws >> atom2;
    37           cout << Verbose(1) << "Scanning file\n";
    38           while (!input->eof()) // Check whether we read everything already
    39           {
    40         *input >> ws >> atom1;
    41         *input >> ws >> atom2;
    42             if(atom2<atom1) //Sort indices of atoms in order
    43             {
    44               temp=atom1;
    45               atom1=atom2;
    46               atom2=temp;
    47             };
    48 
    49             Walker=start;
    50             while(Walker-> nr != atom1) // Find atom corresponding to first index
    51             {
    52               Walker = Walker->next;
    53             };
    54             OtherWalker = Walker->next;
    55             while(OtherWalker->nr != atom2) // Find atom corresponding to second index
    56             {
    57               OtherWalker= OtherWalker->next;
    58             };
    59             AddBond(Walker, OtherWalker); //Add the bond between the two atoms with respective indices.
    60 
    61           }
    62 
    63           CreateListOfBondsPerAtom(out);
    64 
     27  int atom1, atom2;
     28  atom *Walker, *OtherWalker;
     29
     30  if (!input)
     31  {
     32    cout << Verbose(1) << "Opening silica failed \n";
     33  };
     34
     35  *input >> ws >> atom1;
     36  *input >> ws >> atom2;
     37  cout << Verbose(1) << "Scanning file\n";
     38  while (!input->eof()) // Check whether we read everything already
     39  {
     40    *input >> ws >> atom1;
     41    *input >> ws >> atom2;
     42
     43    if(atom2<atom1) //Sort indices of atoms in order
     44      flip(atom1, atom2);
     45    Walker=FindAtom(atom1);
     46    OtherWalker=FindAtom(atom2);
     47    AddBond(Walker, OtherWalker); //Add the bond between the two atoms with respective indices.
     48  }
     49
     50  CreateListOfBondsPerAtom(out);
    6551};
    6652
Note: See TracChangeset for help on using the changeset viewer.