Changeset 046783 for src


Ignore:
Timestamp:
Mar 3, 2010, 2:53:07 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:
6e8dc2, b72091
Parents:
a837d0
git-author:
Frederik Heber <heber@…> (03/03/10 14:46:13)
git-committer:
Frederik Heber <heber@…> (03/03/10 14:53:07)
Message:

Default molecule name can be set via command line, BUGFIX: molecule::DepthFirstSearchAnalysis() seg'faulted on no atoms.

Allow '-I' on empty configs:

new case 'X' for setting default molecule name:

Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/World.cpp

    ra837d0 r046783  
    66 */
    77
     8#include <string>
     9
    810#include "World.hpp"
    911
    1012double *World::cell_size = 0;
     13char *World::DefaultName = 0;
    1114
    1215/** Constructor of World.
     
    1619{
    1720  cell_size = new double[6];
     21  DefaultName = new char[6];
     22  strncpy(DefaultName, "none", 4);
    1823};
    1924
     
    2429{
    2530  delete[](cell_size);
     31  delete[](DefaultName);
    2632};
    2733
  • src/World.hpp

    ra837d0 r046783  
    3232
    3333  static double *cell_size;
     34  static char *DefaultName;
    3435
    3536private:
  • src/builder.cpp

    ra837d0 r046783  
    14801480            Log() << Verbose(0) << "\t-v\t\tsets verbosity (more is more)." << endl;
    14811481            Log() << Verbose(0) << "\t-V\t\tGives version information." << endl;
     1482            Log() << Verbose(0) << "\t-X\t\tset default name of a molecule." << endl;
    14821483            Log() << Verbose(0) << "Note: config files must not begin with '-' !" << endl;
    14831484            return (1);
     
    15181519            Log() << Verbose(0) << "I won't parse trajectories." << endl;
    15191520            configuration.FastParsing = true;
     1521            break;
     1522          case 'X':
     1523            {
     1524              char **name = &(World::get()->DefaultName);
     1525              delete[](*name);
     1526              const int length = strlen(argv[argptr]);
     1527              *name = new char[length+2];
     1528              strncpy(*name, argv[argptr], length);
     1529              Log() << Verbose(0) << "Default name of new molecules set to " << *name << "." << endl;
     1530            }
    15201531            break;
    15211532          default:   // no match? Step on
     
    17091720                  }
    17101721              }
    1711               if (mol == NULL) {
     1722              if ((mol == NULL) && (!molecules->ListOfMolecules.empty())) {
    17121723                mol = *(molecules->ListOfMolecules.begin());
    1713                 mol->ActiveFlag = true;
     1724                if (mol != NULL)
     1725                  mol->ActiveFlag = true;
    17141726              }
    17151727              break;
  • src/molecule.cpp

    ra837d0 r046783  
    4646  for(int i=MAX_ELEMENTS;i--;)
    4747    ElementsInMolecule[i] = 0;
    48   strcpy(name,"none");
     48  strcpy(name,World::get()->DefaultName);
    4949};
    5050
  • src/molecule_graph.cpp

    ra837d0 r046783  
    495495  bond *Binder = NULL;
    496496
     497  if (AtomCount == 0)
     498    return SubGraphs;
    497499  Log() << Verbose(0) << "Begin of DepthFirstSearchAnalysis" << endl;
    498500  DepthFirstSearchAnalysis_Init(DFS, this);
  • src/moleculelist.cpp

    ra837d0 r046783  
    786786
    787787  // 1. dissect the molecule into connected subgraphs
    788   configuration->BG->ConstructBondGraph(mol);
     788  if (configuration->BG->ConstructBondGraph(mol)) {
     789    delete (mol);
     790    eLog() << Verbose(1) << "There are no bonds." << endl;
     791    return;
     792  }
    789793
    790794  // 2. scan for connected subgraphs
     
    793797  Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack);
    794798  delete(BackEdgeStack);
     799  if ((Subgraphs == NULL) || (Subgraphs->next == NULL)) {
     800    delete (mol);
     801    eLog() << Verbose(1) << "There are no atoms." << endl;
     802    return;
     803  }
    795804
    796805  // 3. dissect (the following construct is needed to have the atoms not in the order of the DFS, but in
Note: See TracChangeset for help on using the changeset viewer.