Ignore:
Timestamp:
Apr 10, 2018, 6:43:30 AM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
AutomationFragmentation_failures, Candidate_v1.6.1, ChemicalSpaceEvaluator, Exclude_Hydrogens_annealWithBondGraph, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, PythonUI_with_named_parameters, StoppableMakroAction, TremoloParser_IncreasedPrecision
Children:
9861d0
Parents:
038ccd
git-author:
Frederik Heber <frederik.heber@…> (06/27/17 21:17:18)
git-committer:
Frederik Heber <frederik.heber@…> (04/10/18 06:43:30)
Message:

Fixing annealWithBondgraph().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Dynamics/ForceAnnealing.hpp

    r038ccd r2f3905  
    457457        const double &bondforce = projected_forces[0][side][index];
    458458        const double &oldbondforce = projected_forces[1][side][index];
    459         const double bondforcedifference = (bondforce - oldbondforce);
     459        const double bondforcedifference = fabs(bondforce - oldbondforce);
     460        LOG(4, "DEBUG: bondforce for " << (side == leftside ? "left" : "right")
     461            << " side of bond is " << bondforce);
     462        LOG(4, "DEBUG: oldbondforce for " << (side == leftside ? "left" : "right")
     463            << " side of bond is " << oldbondforce);
    460464        // if difference or bondforce itself is zero, do nothing
    461465        if ((fabs(bondforce) < MYEPSILON) || (fabs(bondforcedifference) < MYEPSILON))
    462466          continue;
     467
     468        // get BondVector to bond
    463469        const BondVectors::mapped_t::const_iterator bviter =
    464470            bondvectors.find(current_bond);
    465471        ASSERT( bviter != bondvectors.end(),
    466472            "ForceAnnealing() - cannot find current_bond ?");
     473        ASSERT( fabs(bviter->second.Norm() -1.) < MYEPSILON,
     474            "ForceAnnealing() - norm of BondVector is not one");
    467475        const Vector &BondVector = bviter->second;
    468476
     
    484492
    485493        // calculate step width
    486         Vector PositionUpdate;
    487494        double stepwidth =
    488495            fabs(projected_PositionDifference)/bondforcedifference;
     
    491498          if (currentStep != 1)
    492499            ELOG(1, "INFO: Barzilai-Borwein stepwidth is zero, using deltat " << currentDeltat << " instead.");
    493           PositionUpdate = currentDeltat * BondVector;
     500          stepwidth = currentDeltat;
    494501        }
    495         LOG(3, "DEBUG: Update would be " << PositionUpdate);
     502        Vector PositionUpdate = stepwidth * currentGradient;
     503        LOG(3, "DEBUG: Update would be " << stepwidth << "*" << currentGradient << " = " << PositionUpdate);
    496504
    497505        // add PositionUpdate for all nodes in the bondside_set
     
    502510          ASSERT( diter != distance_map[side].end(),
    503511              "ForceAnnealing() - could not find distance to an atom.");
    504           const double factor = pow(damping_factor, diter->second);
     512          const double factor = pow(damping_factor, diter->second+1);
    505513          LOG(3, "DEBUG: Update for atom #" << *setiter << " will be "
    506514              << factor << "*" << PositionUpdate);
Note: See TracChangeset for help on using the changeset viewer.