Changeset 38bcbe


Ignore:
Timestamp:
Apr 23, 2021, 8:43:27 PM (5 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Candidate_v1.7.0, stable
Children:
ea30e6
Parents:
4de4f6
git-author:
Frederik Heber <frederik.heber@…> (10/04/20 21:45:25)
git-committer:
Frederik Heber <frederik.heber@…> (04/23/21 20:43:27)
Message:

StretchBondAction will used tabled distances when given distance is less or equal zero.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • doc/userguide/userguide.xml

    r4de4f6 r38bcbe  
    12771277            undo).</para>
    12781278          </warning>
     1279          <note>The action will uses typical bond distances, taken from
     1280          <link linkend='bond.create-adjacency'>bond-table</link> to scale
     1281          the bond length if the desired bond length is non-positive.</note>
    12791282        </section>
    12801283        <section xml:id="bond.change-bond-angle">
  • src/Actions/MoleculeAction/StretchBondAction.cpp

    r4de4f6 r38bcbe  
    6262  const std::vector< atom *> atoms = World::getInstance().getSelectedAtoms();
    6363  StretchBondUtil stretcher(atoms);
    64   bool status = stretcher(params.bonddistance.get());
     64
     65  const double bonddistance = params.bonddistance.get();
     66  bool status = stretcher(bonddistance);
    6567
    6668  if (status) {
  • src/Bond/StretchBond.cpp

    r4de4f6 r38bcbe  
    5151#include "Descriptors/AtomIdDescriptor.hpp"
    5252#include "Descriptors/MoleculeIdDescriptor.hpp"
     53#include "Element/element.hpp"
     54#include "Graph/BondGraph.hpp"
    5355#include "Graph/BoostGraphCreator.hpp"
    5456#include "Graph/BreadthFirstSearchGatherer.hpp"
     
    9395}
    9496
    95 bool StretchBondUtil::operator()(const double newdistance)
     97bool StretchBondUtil::operator()(double newdistance)
    9698{
     99  if (newdistance <= 0.) {
     100    // get typical distance from table
     101    BondGraph *&BG = World::getInstance().getBondGraph();
     102    newdistance = BG->GetBondLength(
     103        atoms[0]->getElementNo(),
     104        atoms[1]->getElementNo());
     105    LOG(1, "INFO: Using typical bond distance of " << newdistance
     106        << " between " << atoms[0]->getElement().getSymbol() << " and "
     107        << atoms[1]->getElement().getSymbol() << ".");
     108  }
     109
    97110  const Vector NormalVector = (atoms[0]->getPosition() - atoms[1]->getPosition())* (1./olddistance);
    98111  const double shift = 0.5*(newdistance - olddistance);
  • src/Graph/BondGraph.hpp

    r4de4f6 r38bcbe  
    414414  }
    415415
    416 private:
    417   /** Convenience function to place access to World::getLinkedCell() into source module.
    418    *
    419    * @return ref to LinkedCell_View
    420    */
    421   LinkedCell::LinkedCell_View getLinkedCell(const double max_distance) const;
    422 
    423   /** Convenience function to place access to World::getDomain() into source module.
    424    *
    425    * @return ref to Box
    426    */
    427   Box &getDomain() const;
    428 
    429   /** Convenience function to place access to WorldTime::getTime() into source module.
    430    *
    431    * @return current time step
    432    */
    433   unsigned int getTime() const;
    434 
    435416  /** Returns the BondLengthMatrix entry for a given index pair.
    436417   * \param firstelement index/atom number of first element (row index)
     
    441422      int firstelement,
    442423      int secondelement) const;
     424
     425private:
     426  /** Convenience function to place access to World::getLinkedCell() into source module.
     427   *
     428   * @return ref to LinkedCell_View
     429   */
     430  LinkedCell::LinkedCell_View getLinkedCell(const double max_distance) const;
     431
     432  /** Convenience function to place access to World::getDomain() into source module.
     433   *
     434   * @return ref to Box
     435   */
     436  Box &getDomain() const;
     437
     438  /** Convenience function to place access to WorldTime::getTime() into source module.
     439   *
     440   * @return current time step
     441   */
     442  unsigned int getTime() const;
    443443
    444444  /** Returns bond criterion for given pair based on a bond length matrix.
Note: See TracChangeset for help on using the changeset viewer.