Example #1
0
FindLowestEigenvalue::FindLowestEigenvalue(std::shared_ptr<pele::BasePotential> landscape_potential, const size_t boxdimension,
        const pele::Array<double> ranvec, const size_t lbfgsniter)
    : m_lowesteigpot(std::make_shared<pele::LowestEigPotential>(landscape_potential, ranvec.copy(), boxdimension)),
      m_ranvec((ranvec.copy() /= norm(ranvec))),
      m_lbfgs(m_lowesteigpot, m_ranvec.copy())
{
    if (isinf(double(1) / norm(ranvec))) {
        throw std::runtime_error("FindLowestEigenvalue: 1/norm(ranvec) is isinf");
    }
    m_lbfgs.set_max_iter(lbfgsniter);
}
Example #2
0
MODIFIED_FIRE::MODIFIED_FIRE(std::shared_ptr<pele::BasePotential> potential,
        pele::Array<double>& x0, double dtstart, double dtmax, double maxstep,
        size_t Nmin, double finc, double fdec, double fa, double astart, double
        tol, bool stepback)
    : GradientOptimizer(potential,x0,tol), //call GradientOptimizer constructor
      _dtstart(dtstart), _dt(dtstart),
      _dtmax(dtmax), _maxstep(maxstep), _Nmin(Nmin),
      _finc(finc), _fdec(fdec), _fa(fa),
      _astart(astart), _a(astart), _fold(f_),
      _ifnorm(0),_vnorm(0),
      _v(x0.size(),0), _dx(x0.size()), _xold(x0.copy()),_gold(g_.copy()),
      _fire_iter_number(0), _N(x_.size()),
      _stepback(stepback)
{}
Example #3
0
double bench_potential(std::shared_ptr<pele::BasePotential> pot, pele::Array<double> x, size_t neval)
{
    auto grad = x.copy();
    Timer t;
    t.start();
    for (size_t i = 0; i < neval; ++i) {
        // change x by some amount and recompute the energy
        double dx = .1;
        if (i % 5 == 0) dx *= -1;
        x[i % x.size()] += dx;
        pot->get_energy_gradient(x, grad);
//        if (i % 500 == 0) {
//            std::cout << i << " energy " << energy << "\n";
//        }
    }
    t.stop();

    return t.get();
}
Example #4
0
void MC::set_coordinates(pele::Array<double>& coords, double energy)
{
    m_coords = coords.copy();
    m_energy = energy;
}
Example #5
0
GetDisplacementPerParticle::GetDisplacementPerParticle(pele::Array<double> initial_coordinates_,
        const size_t boxdimension_)
    : m_initial_coordinates(initial_coordinates_.copy()),
      m_boxdimension(boxdimension_),
      m_nr_particles(initial_coordinates_.size() / boxdimension_)
{}