Esempio n. 1
0
Group Transform::apply(const Group& g)
{
  std::vector<Vec3d> vv;
  Vec3d vtmp;
  double x1, y1, z1;
  int s = g.n_atom_;
  for (int i = 0; i < s; ++i) {
    vtmp = g.coordinates_[i];
    x1 = rotv1_ * vtmp;
    y1 = rotv2_ * vtmp;
    z1 = rotv3_ * vtmp;
    vtmp.set_coordinate(x1, y1, z1);
    vtmp += translation_;
    vv.push_back(vtmp);
  }
  Group gtmp(vv);

  return gtmp;
}
Esempio n. 2
0
double NLF1::evalF() // Evaluate Function
{
  int result = 0;
  ColumnVector gtmp(dim);

  double time0 = get_wall_clock_time();
  // *** CHANGE *** //
  if (!application.getF(mem_xc,fvalue)) {
    fcn_v(NLPFunction, dim, mem_xc, fvalue, gtmp, result, vptr);
    application.update(result,dim,mem_xc,fvalue,gtmp);
    nfevals++;
  }
  // *** CHANGE *** //
  function_time = get_wall_clock_time() - time0;

  if (debug_)
  cout << "NLF1::evalF()\n" 
    << "nfevals       = " << nfevals << "\n"
    << "fvalue        = " << fvalue << "\n"
    << "function time = " << function_time << "\n";
  return fvalue;
}
Esempio n. 3
0
ColumnVector NLF1::evalCF(const ColumnVector& x) // Evaluate Function at x
{
  int    result = 0;
  ColumnVector cfx(ncnln);
  Matrix gtmp(dim,ncnln);

  double time0 = get_wall_clock_time();
  // *** CHANGE *** //
  if (!application.getCF(x,cfx)) {
    confcn(NLPFunction, dim, x, cfx, gtmp, result);
    application.constraint_update(result,dim,ncnln,x,cfx,gtmp);
  }
  // *** CHANGE *** //
  function_time = get_wall_clock_time() - time0;

  if (debug_)
    cout << "NLF1::evalCF(x)\n" 
         << "nfevals       = " << nfevals << "\n"
       //  << "fvalue        = " << cfx << "\n"
         << "function time = " << function_time << "\n";
  return cfx;
}
Esempio n. 4
0
double NLF1::evalF(const ColumnVector& x) // Evaluate Function at x
{
  int    result = 0;
  double fx;
  ColumnVector gtmp(dim);

  double time0 = get_wall_clock_time();
  // *** CHANGE *** //
  if (!application.getF(x,fx)) {
    fcn_v(NLPFunction, dim, x, fx, gtmp, result, vptr);
    application.update(result,dim,x,fx,gtmp);
    nfevals++;
  }
  // *** CHANGE *** //
  function_time = get_wall_clock_time() - time0;

  if (debug_)
  cout << "NLF1::evalF(x)\n" 
    << "nfevals       = " << nfevals << "\n"
    << "fvalue        = " << fx << "\n"
    << "function time = " << function_time << "\n";
  return fx;
}