Changeset cb7676 for src


Ignore:
Timestamp:
Apr 6, 2012, 11:44:09 AM (13 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:
4187a7
Parents:
93eae36
git-author:
Frederik Heber <heber@…> (04/04/12 11:16:14)
git-committer:
Frederik Heber <heber@…> (04/06/12 11:44:09)
Message:

FillSphericalSurface now works on selected molecule and requires an alignment axis.

  • the axis is used to perform the rotation assuming the filler molecule is oriented on this direction.
  • also, it now uses CopyAtoms_withBonds.
Location:
src/Actions/FillAction
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/FillAction/FillSphericalSurfaceAction.cpp

    r93eae36 rcb7676  
    2020#include "CodePatterns/MemDebug.hpp"
    2121
    22 #include "Atom/atom.hpp"
    23 #include "Atom/CopyAtoms/CopyAtoms_Simple.hpp"
     22#include "Atom/CopyAtoms/CopyAtoms_withBonds.hpp"
    2423#include "CodePatterns/Log.hpp"
    2524#include "Filling/Cluster.hpp"
    2625#include "Filling/Filler.hpp"
    2726#include "Filling/Inserter/Inserter.hpp"
    28 #include "Filling/Inserter/SimpleInserter.hpp"
     27#include "Filling/Inserter/SurfaceInserter.hpp"
    2928#include "Filling/Mesh/MeshAdaptor.hpp"
    3029#include "Filling/Predicates/IsVoidNode_FillPredicate.hpp"
     30#include "molecule.hpp"
    3131#include "Shapes/BaseShapes.hpp"
    3232#include "World.hpp"
     
    4949/** =========== define the function ====================== */
    5050Action::state_ptr FillSphericalSurfaceAction::performCall() {
    51   typedef std::vector<atom*> AtomVector;
    52 
    5351  // obtain information
    5452  getParametersfromValueStorage();
    5553
    5654  // check for selected atoms
    57   std::vector<atom *> atoms(World::getInstance().getSelectedAtoms());
    58   if (atoms.size() == 0) {
    59     ELOG(1, "There are no atoms selected.");
     55  // get the filler molecule and move to origin
     56  const std::vector< molecule *> molecules = World::getInstance().getSelectedMolecules();
     57  if (molecules.size() != 1) {
     58    ELOG(1, "No exactly one molecule selected, aborting,");
    6059    return Action::failure;
    6160  }
    62   AtomIdSet atomIds;
    63   BOOST_FOREACH(atom * const _atom, atoms) {
    64     atomIds.insert( _atom );
     61  molecule *filler = *(molecules.begin());
     62  LOG(1, "INFO: Chosen molecule has " << filler->size() << " atoms.");
     63
     64  // center filler's tip at origin
     65  Vector max;
     66  filler->CenterEdge(&max);
     67
     68  // determine center with respect to alignment axis
     69  Vector sum = zeroVec;
     70  for (molecule::iterator it2=filler->begin();it2 !=filler->end();++it2) {
     71    const Vector helper = (**it2).getPosition().partition(params.AlignedAxis).second;
     72    sum += helper;
     73  }
     74  sum *= 1./filler->size();
     75
     76  // translate molecule's closest atom to origin (such that is resides on the filler spot)
     77  LOG(1, "DEBUG: molecule is off Alignment axis by " << sum << ", shifting ...");
     78  {
     79    Vector translater = -1.*sum;
     80    filler->Translate(&translater);
    6581  }
    6682
     
    7894    Mesh *mesh = new MeshAdaptor(func);
    7995    Inserter *inserter = new Inserter(
    80         Inserter::impl_ptr(new SimpleInserter));
     96        Inserter::impl_ptr(new SurfaceInserter(s, params.AlignedAxis)));
    8197
    8298    // fill
    8399    {
    84100      Filler *fillerFunction = new Filler(*mesh, *voidnode_predicate, *inserter);
    85       ClusterInterface::Cluster_impl cluster( new Cluster( atomIds.getAtomIds(), Sphere()) ); //TODO: calculate true bounding box of atomIds
    86       CopyAtoms_Simple copyMethod;
     101      ClusterInterface::Cluster_impl cluster( new Cluster( filler->getAtomIds(), filler->getBoundingShape() ) );
     102      CopyAtoms_withBonds copyMethod;
    87103      successflag = (*fillerFunction)(copyMethod, cluster);
    88104      delete fillerFunction;
  • src/Actions/FillAction/FillSphericalSurfaceAction.def

    r93eae36 rcb7676  
    99class atom;
    1010
     11#include "LinearAlgebra/Vector.hpp"
     12
    1113// i.e. there is an integer with variable name Z that can be found in
    1214// ValueStorage by the token "Z" -> first column: int, Z, "Z"
    1315// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
    14 #define paramtypes (Vector)(double)(int)(double)
    15 #define paramtokens ("center")("radius")("count")("min-distance")
    16 #define paramdescriptions ("center of the sphere")("sphere size")("number of instances to be added, changed according to geometric needs")("minimum distance between added instances")
    17 #define paramdefaults ("0.,0.,0.")(NODEFAULT)("12")("1.")
    18 #define paramreferences (center)(radius)(N)(mindistance)
     16#define paramtypes (Vector)(double)(int)(double)(Vector)
     17#define paramtokens ("center")("radius")("count")("min-distance")("Alignment-Axis")
     18#define paramdescriptions ("center of the sphere")("sphere size")("number of instances to be added, changed according to geometric needs")("minimum distance between added instances")("The filler molecule is rotated relative to this alignment axis")
     19#define paramdefaults ("0.,0.,0.")(NODEFAULT)("12")("1.")(NODEFAULT)
     20#define paramreferences (center)(radius)(N)(mindistance)(AlignedAxis)
    1921
    2022#undef statetypes
     
    3133// finally the information stored in the ActionTrait specialization
    3234#define DESCRIPTION "\
    33 fill homogenous points on a sphere surface with instances of the selected atoms."
     35fill homogenous points on a sphere surface with instances of the selected molecule."
    3436#undef SHORTFORM
Note: See TracChangeset for help on using the changeset viewer.