Changeset 164a33


Ignore:
Timestamp:
Feb 8, 2010, 3:29:35 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:
775d133
Parents:
1f1b23
git-author:
Frederik Heber <heber@…> (02/08/10 15:26:30)
git-committer:
Frederik Heber <heber@…> (02/08/10 15:29:35)
Message:

changed case 'C' of ParseCommandLineOptions to allow selecting between the three different pair correlation analysis functions.

  • case 'C' now expects additional first parameter: A type which is E, S or P for element, surface or pair. Via a switch it selects either of the three functions.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    r1f1b23 r164a33  
    14121412            Log() << Verbose(0) << "\t-B xx xy xz yy yz zz\tBound atoms by domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl;
    14131413            Log() << Verbose(0) << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl;
    1414             Log() << Verbose(0) << "\t-C <Z> <output> <bin output>\tPair Correlation analysis." << endl;
     1414            Log() << Verbose(0) << "\t-C <type> [parms] <output> <bin output>\tPair Correlation analysis." << endl;
    14151415            Log() << Verbose(0) << "\t-d x1 x2 x3\tDuplicate cell along each axis by given factor." << endl;
    14161416            Log() << Verbose(0) << "\t-D <bond distance>\tDepth-First-Search Analysis of the molecule, giving cycles and tree/back edges." << endl;
     
    16781678            case 'C':
    16791679              if (ExitFlag == 0) ExitFlag = 1;
    1680               if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr][0] == '-') || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-')) {
     1680              if ((argptr >= argc)) {
    16811681                ExitFlag = 255;
    1682                 eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C <Z> <output> <bin output>" << endl;
     1682                eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C <type: E/P/S> [more params] <output> <bin output>" << endl;
    16831683                performCriticalExit();
    16841684              } else {
    1685                 ofstream output(argv[argptr+1]);
    1686                 ofstream binoutput(argv[argptr+2]);
    1687                 const double radius = 5.;
    1688 
    1689                 // get the boundary
    1690                 class molecule *Boundary = NULL;
    1691                 class Tesselation *TesselStruct = NULL;
    1692                 const LinkedCell *LCList = NULL;
    1693                 // find biggest molecule
    1694                 int counter  = 0;
    1695                 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
    1696                   if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) {
    1697                     Boundary = *BigFinder;
    1698                   }
    1699                   counter++;
     1685                switch(argv[argptr][0]) {
     1686                  case 'E':
     1687                    {
     1688                      if ((argptr+4 >= argc) || (!IsValidNumber(argv[argptr+1])) ||  (!IsValidNumber(argv[argptr+2])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-') || (argv[argptr+4][0] == '-')) {
     1689                        ExitFlag = 255;
     1690                        eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C E <Z1> <Z2> <output> <bin output>" << endl;
     1691                        performCriticalExit();
     1692                      } else {
     1693                        ofstream output(argv[argptr+3]);
     1694                        ofstream binoutput(argv[argptr+4]);
     1695
     1696                        element *elemental = periode->FindElement((const int) atoi(argv[argptr]));
     1697                        element *elemental2 = periode->FindElement((const int) atoi(argv[argptr+1]));
     1698                        PairCorrelationMap *correlationmap = PairCorrelation(molecules, elemental, elemental2);
     1699                        //OutputCorrelationToSurface(&output, correlationmap);
     1700                        BinPairMap *binmap = BinData( correlationmap, 0.5, 0., 0. );
     1701                        OutputCorrelation ( &binoutput, binmap );
     1702                        output.close();
     1703                        binoutput.close();
     1704                        delete(binmap);
     1705                        delete(correlationmap);
     1706                        argptr+=5;
     1707                      }
     1708                    }
     1709                    break;
     1710
     1711                  case 'P':
     1712                    {
     1713                      if ((argptr+6 >= argc) || (!IsValidNumber(argv[argptr+1])) ||  (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-') || (argv[argptr+4][0] == '-') || (argv[argptr+5][0] == '-') || (argv[argptr+6][0] == '-')) {
     1714                        ExitFlag = 255;
     1715                        eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C P <Z1> <x> <y> <z> <output> <bin output>" << endl;
     1716                        performCriticalExit();
     1717                      } else {
     1718                        ofstream output(argv[argptr+5]);
     1719                        ofstream binoutput(argv[argptr+6]);
     1720
     1721                        element *elemental = periode->FindElement((const int) atoi(argv[argptr]));
     1722                        Vector *Point = new Vector((const double) atof(argv[argptr+1]),(const double) atof(argv[argptr+2]),(const double) atof(argv[argptr+3]));
     1723                        CorrelationToPointMap *correlationmap = CorrelationToPoint(molecules, elemental, Point);
     1724                        //OutputCorrelationToSurface(&output, correlationmap);
     1725                        BinPairMap *binmap = BinData( correlationmap, 0.5, 0., 0. );
     1726                        OutputCorrelation ( &binoutput, binmap );
     1727                        output.close();
     1728                        binoutput.close();
     1729                        delete(Point);
     1730                        delete(binmap);
     1731                        delete(correlationmap);
     1732                        argptr+=7;
     1733                      }
     1734                    }
     1735                    break;
     1736
     1737                  case 'S':
     1738                    {
     1739                      if ((argptr+3 >= argc) || (!IsValidNumber(argv[argptr+1])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-')) {
     1740                        ExitFlag = 255;
     1741                        eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C S <Z> <output> <bin output>" << endl;
     1742                        performCriticalExit();
     1743                      } else {
     1744                        ofstream output(argv[argptr+2]);
     1745                        ofstream binoutput(argv[argptr+3]);
     1746                        const double radius = 5.;
     1747
     1748
     1749                        // get the boundary
     1750                        class molecule *Boundary = NULL;
     1751                        class Tesselation *TesselStruct = NULL;
     1752                        const LinkedCell *LCList = NULL;
     1753                        // find biggest molecule
     1754                        int counter  = 0;
     1755                        for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
     1756                          if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) {
     1757                            Boundary = *BigFinder;
     1758                          }
     1759                          counter++;
     1760                        }
     1761                        bool *Actives = Malloc<bool>(counter, "ParseCommandLineOptions() - case C -- *Actives");
     1762                        counter = 0;
     1763                        for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
     1764                          Actives[counter++] = (*BigFinder)->ActiveFlag;
     1765                          (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true;
     1766                        }
     1767                        LCList = new LinkedCell(Boundary, 2.*radius);
     1768                        element *elemental = periode->FindElement((const int) atoi(argv[argptr]));
     1769                        FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
     1770                        int ranges[NDIM] = {1,1,1};
     1771                        CorrelationToSurfaceMap *surfacemap = PeriodicCorrelationToSurface( molecules, elemental, TesselStruct, LCList, ranges );
     1772                        //OutputCorrelationToSurface(&output, surfacemap);
     1773                        BinPairMap *binmap = BinData( surfacemap, 0.5, 0., 0. );
     1774                        OutputCorrelation ( &binoutput, binmap );
     1775                        output.close();
     1776                        binoutput.close();
     1777                        for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++)
     1778                          (*BigFinder)->ActiveFlag = Actives[counter++];
     1779                        Free(&Actives);
     1780                        delete(LCList);
     1781                        delete(TesselStruct);
     1782                        delete(binmap);
     1783                        delete(surfacemap);
     1784                        argptr+=4;
     1785                      }
     1786                    }
     1787                    break;
     1788
     1789                  default:
     1790                    ExitFlag = 255;
     1791                    eLog() << Verbose(0) << "Invalid type given for pair correlation analysis: -C <type: E/P/S> [more params] <output> <bin output>" << endl;
     1792                    performCriticalExit();
     1793                    break;
    17001794                }
    1701                 bool *Actives = Malloc<bool>(counter, "ParseCommandLineOptions() - case C -- *Actives");
    1702                 counter = 0;
    1703                 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
    1704                   Actives[counter++] = (*BigFinder)->ActiveFlag;
    1705                   (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true;
    1706                 }
    1707                 LCList = new LinkedCell(Boundary, 2.*radius);
    1708                 element *elemental = periode->FindElement((const int) atoi(argv[argptr]));
    1709                 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
    1710                 int ranges[NDIM] = {1,1,1};
    1711                 CorrelationToSurfaceMap *surfacemap = PeriodicCorrelationToSurface( molecules, elemental, TesselStruct, LCList, ranges );
    1712                 OutputCorrelationToSurface(&output, surfacemap);
    1713                 BinPairMap *binmap = BinData( surfacemap, 0.5, 0., 20. );
    1714                 OutputCorrelation ( &binoutput, binmap );
    1715                 output.close();
    1716                 binoutput.close();
    1717                 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++)
    1718                   (*BigFinder)->ActiveFlag = Actives[counter++];
    1719                 Free(&Actives);
    1720                 delete(LCList);
    1721                 delete(TesselStruct);
    1722                 argptr+=3;
    17231795              }
    17241796              break;
Note: See TracChangeset for help on using the changeset viewer.