Changeset f3278b for src


Ignore:
Timestamp:
Aug 7, 2009, 9:13:21 AM (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:
1999d8
Parents:
1953f9
Message:

Test case of filling a simulation domain with water included.

Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/boundary.cpp

    r1953f9 rf3278b  
    863863
    864864            // insert into Filling
     865
     866            // FIXME: gives completely different results if CopyAtoms[..] used instead of Walker, why???
    865867            *out << Verbose(4) << "Filling atom " << *Walker << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[Walker->nr]->x) << "." << endl;
    866868            Filling->AddAtom(CopyAtoms[Walker->nr]);
     
    930932      if (!failflag)
    931933        cerr << "WARNING: Find_next_suitable_triangle failed." << endl;
     934      // write temporary envelope
     935      if ((DoSingleStepOutput && (mol->TesselStruct->TrianglesOnBoundaryCount % SingleStepWidth == 0))) { // if we have a new triangle and want to output each new triangle configuration
     936        TriangleMap::iterator runner = mol->TesselStruct->TrianglesOnBoundary.end();
     937        runner--;
     938        class BoundaryTriangleSet *triangle = runner->second;
     939        if (triangle != NULL) {
     940          sprintf(NumberName, "-%04d-%s_%s_%s", TriangleFilesWritten, triangle->endpoints[0]->node->Name, triangle->endpoints[1]->node->Name, triangle->endpoints[2]->node->Name);
     941          if (DoTecplotOutput) {
     942            string NameofTempFile(filename);
     943            NameofTempFile.append(NumberName);
     944            for(size_t npos = NameofTempFile.find_first_of(' '); npos != string::npos; npos = NameofTempFile.find(' ', npos))
     945            NameofTempFile.erase(npos, 1);
     946            NameofTempFile.append(TecplotSuffix);
     947            *out << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
     948            tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc);
     949            write_tecplot_file(out, tempstream, mol->TesselStruct, mol, TriangleFilesWritten);
     950            tempstream->close();
     951            tempstream->flush();
     952            delete(tempstream);
     953          }
     954
     955          if (DoRaster3DOutput) {
     956            string NameofTempFile(filename);
     957            NameofTempFile.append(NumberName);
     958            for(size_t npos = NameofTempFile.find_first_of(' '); npos != string::npos; npos = NameofTempFile.find(' ', npos))
     959            NameofTempFile.erase(npos, 1);
     960            NameofTempFile.append(Raster3DSuffix);
     961            *out << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
     962            tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc);
     963            write_raster3d_file(out, tempstream, mol->TesselStruct, mol);
     964    //        // include the current position of the virtual sphere in the temporary raster3d file
     965    //        // make the circumsphere's center absolute again
     966    //        helper.CopyVector(BaseRay->endpoints[0]->node->node);
     967    //        helper.AddVector(BaseRay->endpoints[1]->node->node);
     968    //        helper.Scale(0.5);
     969    //        (*it)->OptCenter.AddVector(&helper);
     970    //        Vector *center = mol->DetermineCenterOfAll(out);
     971    //        (*it)->OptCenter.SubtractVector(center);
     972    //        delete(center);
     973    //        // and add to file plus translucency object
     974    //        *tempstream << "# current virtual sphere\n";
     975    //        *tempstream << "8\n  25.0    0.6     -1.0 -1.0 -1.0     0.2        0 0 0 0\n";
     976    //        *tempstream << "2\n  " << (*it)->OptCenter.x[0] << " "
     977    //          << (*it)->OptCenter.x[1] << " " << (*it)->OptCenter.x[2]
     978    //          << "\t" << RADIUS << "\t1 0 0\n";
     979    //        *tempstream << "9\n  terminating special property\n";
     980            tempstream->close();
     981            tempstream->flush();
     982            delete(tempstream);
     983          }
     984        }
     985        if (DoTecplotOutput || DoRaster3DOutput)
     986          TriangleFilesWritten++;
     987      }
    932988    } else {
    933989      //cout << Verbose(1) << "Line " << *baseline->second << " has " << baseline->second->TrianglesCount << " triangles adjacent" << endl;
     
    941997      baseline = mol->TesselStruct->LinesOnBoundary.begin();   // restart if we reach end due to newly inserted lines
    942998      flag = false;
    943     }
    944 
    945     // write temporary envelope
    946     if ((DoSingleStepOutput && (mol->TesselStruct->TrianglesOnBoundaryCount % 1 == 0))) { // if we have a new triangle and want to output each new triangle configuration
    947       class BoundaryTriangleSet *triangle = (mol->TesselStruct->TrianglesOnBoundary.end()--)->second;
    948       sprintf(NumberName, "-%04d-%s_%s_%s", TriangleFilesWritten, triangle->endpoints[0]->node->Name, triangle->endpoints[1]->node->Name, triangle->endpoints[2]->node->Name);
    949       if (DoTecplotOutput) {
    950         string NameofTempFile(filename);
    951         NameofTempFile.append(NumberName);
    952         for(size_t npos = NameofTempFile.find_first_of(' '); npos != string::npos; npos = NameofTempFile.find(' ', npos))
    953         NameofTempFile.erase(npos, 1);
    954         NameofTempFile.append(TecplotSuffix);
    955         *out << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
    956         tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc);
    957         write_tecplot_file(out, tempstream, mol->TesselStruct, mol, TriangleFilesWritten);
    958         tempstream->close();
    959         tempstream->flush();
    960         delete(tempstream);
    961       }
    962 
    963       if (DoRaster3DOutput) {
    964         string NameofTempFile(filename);
    965         NameofTempFile.append(NumberName);
    966         for(size_t npos = NameofTempFile.find_first_of(' '); npos != string::npos; npos = NameofTempFile.find(' ', npos))
    967         NameofTempFile.erase(npos, 1);
    968         NameofTempFile.append(Raster3DSuffix);
    969         *out << Verbose(1) << "Writing temporary non convex hull to file " << NameofTempFile << ".\n";
    970         tempstream = new ofstream(NameofTempFile.c_str(), ios::trunc);
    971         write_raster3d_file(out, tempstream, mol->TesselStruct, mol);
    972 //        // include the current position of the virtual sphere in the temporary raster3d file
    973 //        // make the circumsphere's center absolute again
    974 //        helper.CopyVector(BaseRay->endpoints[0]->node->node);
    975 //        helper.AddVector(BaseRay->endpoints[1]->node->node);
    976 //        helper.Scale(0.5);
    977 //        (*it)->OptCenter.AddVector(&helper);
    978 //        Vector *center = mol->DetermineCenterOfAll(out);
    979 //        (*it)->OptCenter.SubtractVector(center);
    980 //        delete(center);
    981 //        // and add to file plus translucency object
    982 //        *tempstream << "# current virtual sphere\n";
    983 //        *tempstream << "8\n  25.0    0.6     -1.0 -1.0 -1.0     0.2        0 0 0 0\n";
    984 //        *tempstream << "2\n  " << (*it)->OptCenter.x[0] << " "
    985 //          << (*it)->OptCenter.x[1] << " " << (*it)->OptCenter.x[2]
    986 //          << "\t" << RADIUS << "\t1 0 0\n";
    987 //        *tempstream << "9\n  terminating special property\n";
    988         tempstream->close();
    989         tempstream->flush();
    990         delete(tempstream);
    991       }
    992       if (DoTecplotOutput || DoRaster3DOutput)
    993         TriangleFilesWritten++;
    994999    }
    9951000  }
  • src/boundary.hpp

    r1953f9 rf3278b  
    1717#define DEBUG 1
    1818#define DoSingleStepOutput 0
     19#define SingleStepWidth 1
    1920#define DoTecplotOutput 1
    2021#define DoRaster3DOutput 1
  • src/builder.cpp

    r1953f9 rf3278b  
    13481348            cout << "\t-A <source>\tCreate adjacency list from bonds parsed from 'dbond'-style file." <<endl;
    13491349            cout << "\t-b xx xy xz yy yz zz\tCenter atoms in domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl;
    1350             cout << "\t-B <basis>\tSetting basis to store to MPQC config files." << endl;
     1350            cout << "\t-B xx xy xz yy yz zz\tBound atoms by domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl;
    13511351            cout << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl;
    13521352            cout << "\t-D <bond distance>\tDepth-First-Search Analysis of the molecule, giving cycles and tree/back edges." << endl;
     
    13581358            cout << "\t-h/-H/-?\tGive this help screen." << endl;
    13591359            cout << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl;
     1360            cout << "\t-M <basis>\tSetting basis to store to MPQC config files." << endl;
    13601361            cout << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl;
    13611362            cout << "\t-N <radius> <file>\tGet non-convex-envelope." << endl;
     
    15061507        if (config_present == present) {
    15071508          switch(argv[argptr-1][1]) {
    1508             case 'B':
     1509            case 'M':
    15091510              if ((argptr >= argc) || (argv[argptr][0] == '-')) {
    15101511                ExitFlag = 255;
     
    17671768                // center
    17681769                mol->CenterInBox((ofstream *)&cout);
     1770                argptr+=6;
     1771              }
     1772              break;
     1773            case 'B':
     1774              ExitFlag = 1;
     1775              if ((argptr+5 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) ) {
     1776                ExitFlag = 255;
     1777                cerr << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl;
     1778              } else {
     1779                SaveFlag = true;
     1780                j = -1;
     1781                cout << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
     1782                for (int i=0;i<6;i++) {
     1783                  mol->cell_size[i] = atof(argv[argptr+i]);
     1784                }
     1785                // center
     1786                mol->BoundInBox((ofstream *)&cout);
    17691787                argptr+=6;
    17701788              }
  • src/molecules.cpp

    r1953f9 rf3278b  
    741741  delete(Minv);
    742742  delete(Center);
     743  return status;
     744};
     745
     746
     747/** Bounds the molecule in the box whose lengths are defined by vector \a *BoxLengths.
     748 * \param *out output stream for debugging
     749 */
     750bool molecule::BoundInBox(ofstream *out)
     751{
     752  bool status = true;
     753  Vector x;
     754  double *M = ReturnFullMatrixforSymmetric(cell_size);
     755  double *Minv = x.InverseMatrix(M);
     756
     757  // go through all atoms
     758  atom *ptr = start;  // start at first in list
     759  while (ptr->next != end) {  // continue with second if present
     760    ptr = ptr->next;
     761    //ptr->Output(1,1,out);
     762    // multiply its vector with matrix inverse
     763    x.CopyVector(&ptr->x);
     764    x.MatrixMultiplication(Minv);
     765    // truncate to [0,1] for each axis
     766    for (int i=0;i<NDIM;i++) {
     767      while (x.x[i] >= 1.)
     768        x.x[i] -= 1.;
     769      while (x.x[i] < 0.)
     770        x.x[i] += 1.;
     771    }
     772    x.MatrixMultiplication(M);
     773    ptr->x.CopyVector(&x);
     774  }
     775  delete(M);
     776  delete(Minv);
    743777  return status;
    744778};
  • src/molecules.hpp

    r1953f9 rf3278b  
    175175  void CalculateOrbitals(class config &configuration);
    176176  bool CenterInBox(ofstream *out);
     177  bool BoundInBox(ofstream *out);
    177178  void CenterEdge(ofstream *out, Vector *max);
    178179  void CenterOrigin(ofstream *out);
Note: See TracChangeset for help on using the changeset viewer.