| [610c11] | 1 | /*
 | 
|---|
 | 2 |  * Project: MoleCuilder
 | 
|---|
 | 3 |  * Description: creates and alters molecular systems
 | 
|---|
 | 4 |  * Copyright (C)  2012 University of Bonn. All rights reserved.
 | 
|---|
| [acc9b1] | 5 |  * Copyright (C)  2013 Frederik Heber. All rights reserved.
 | 
|---|
| [610c11] | 6 |  * Please see the COPYING file or "Copyright notice" in builder.cpp for details.
 | 
|---|
 | 7 |  * 
 | 
|---|
 | 8 |  *
 | 
|---|
 | 9 |  *   This file is part of MoleCuilder.
 | 
|---|
 | 10 |  *
 | 
|---|
 | 11 |  *    MoleCuilder is free software: you can redistribute it and/or modify
 | 
|---|
 | 12 |  *    it under the terms of the GNU General Public License as published by
 | 
|---|
 | 13 |  *    the Free Software Foundation, either version 2 of the License, or
 | 
|---|
 | 14 |  *    (at your option) any later version.
 | 
|---|
 | 15 |  *
 | 
|---|
 | 16 |  *    MoleCuilder is distributed in the hope that it will be useful,
 | 
|---|
 | 17 |  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
 | 18 |  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
 | 19 |  *    GNU General Public License for more details.
 | 
|---|
 | 20 |  *
 | 
|---|
 | 21 |  *    You should have received a copy of the GNU General Public License
 | 
|---|
 | 22 |  *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>. 
 | 
|---|
 | 23 |  */
 | 
|---|
 | 24 | 
 | 
|---|
 | 25 | /*
 | 
|---|
 | 26 |  * ManyBodyPotential_Tersoff.cpp
 | 
|---|
 | 27 |  *
 | 
|---|
 | 28 |  *  Created on: Sep 26, 2012
 | 
|---|
 | 29 |  *      Author: heber
 | 
|---|
 | 30 |  */
 | 
|---|
 | 31 | 
 | 
|---|
 | 32 | 
 | 
|---|
 | 33 | // include config.h
 | 
|---|
 | 34 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 35 | #include <config.h>
 | 
|---|
 | 36 | #endif
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 | #include "CodePatterns/MemDebug.hpp"
 | 
|---|
 | 39 | 
 | 
|---|
 | 40 | #include "ManyBodyPotential_Tersoff.hpp"
 | 
|---|
 | 41 | 
 | 
|---|
| [ed2551] | 42 | #include <boost/assign/list_of.hpp> // for 'map_list_of()'
 | 
|---|
| [610c11] | 43 | #include <boost/bind.hpp>
 | 
|---|
 | 44 | #include <cmath>
 | 
|---|
| [ed2551] | 45 | #include <string>
 | 
|---|
| [610c11] | 46 | 
 | 
|---|
 | 47 | #include "CodePatterns/Assert.hpp"
 | 
|---|
| [ffc368] | 48 | //#include "CodePatterns/Info.hpp"
 | 
|---|
| [f904d5] | 49 | #include "CodePatterns/Log.hpp"
 | 
|---|
| [610c11] | 50 | 
 | 
|---|
| [7b019a] | 51 | #include "FunctionApproximation/Extractors.hpp"
 | 
|---|
| [d52819] | 52 | #include "FunctionApproximation/TrainingData.hpp"
 | 
|---|
| [610c11] | 53 | #include "Potentials/helpers.hpp"
 | 
|---|
| [b760bc3] | 54 | #include "Potentials/ParticleTypeCheckers.hpp"
 | 
|---|
| [610c11] | 55 | 
 | 
|---|
| [7b019a] | 56 | class Fragment;
 | 
|---|
 | 57 | 
 | 
|---|
| [ed2551] | 58 | // static definitions
 | 
|---|
 | 59 | const ManyBodyPotential_Tersoff::ParameterNames_t
 | 
|---|
 | 60 | ManyBodyPotential_Tersoff::ParameterNames =
 | 
|---|
 | 61 |       boost::assign::list_of<std::string>
 | 
|---|
 | 62 |       ("A")
 | 
|---|
 | 63 |       ("B")
 | 
|---|
 | 64 |       ("lambda")
 | 
|---|
 | 65 |       ("mu")
 | 
|---|
 | 66 |       ("beta")
 | 
|---|
 | 67 |       ("n")
 | 
|---|
 | 68 |       ("c")
 | 
|---|
 | 69 |       ("d")
 | 
|---|
 | 70 |       ("h")
 | 
|---|
 | 71 | //      ("R")
 | 
|---|
 | 72 | //      ("S")
 | 
|---|
 | 73 | //      ("lambda3")
 | 
|---|
 | 74 | //      ("alpha")
 | 
|---|
 | 75 | //      ("chi")
 | 
|---|
 | 76 | //      ("omega")
 | 
|---|
 | 77 |     ;
 | 
|---|
 | 78 | const std::string ManyBodyPotential_Tersoff::potential_token("tersoff");
 | 
|---|
 | 79 | 
 | 
|---|
| [713888] | 80 | ManyBodyPotential_Tersoff::ManyBodyPotential_Tersoff() :
 | 
|---|
 | 81 |     EmpiricalPotential(),
 | 
|---|
| [a82d33] | 82 |     params(parameters_t(MAXPARAMS, 0.)),
 | 
|---|
| [713888] | 83 |     R(3.2),
 | 
|---|
 | 84 |     S(3.5),
 | 
|---|
 | 85 |     lambda3(0.),
 | 
|---|
 | 86 |     alpha(0.),
 | 
|---|
 | 87 |     chi(1.),
 | 
|---|
 | 88 |     omega(1.),
 | 
|---|
 | 89 |     triplefunction(&Helpers::NoOp_Triplefunction)
 | 
|---|
 | 90 | {}
 | 
|---|
 | 91 | 
 | 
|---|
| [e7579e] | 92 | ManyBodyPotential_Tersoff::ManyBodyPotential_Tersoff(
 | 
|---|
| [775dd1a] | 93 |     const ParticleTypes_t &_ParticleTypes
 | 
|---|
| [e7579e] | 94 |     ) :
 | 
|---|
| [fdd23a] | 95 |     EmpiricalPotential(_ParticleTypes),
 | 
|---|
| [e7579e] | 96 |     params(parameters_t(MAXPARAMS, 0.)),
 | 
|---|
| [752dc7] | 97 |     R(3.2),
 | 
|---|
 | 98 |     S(3.5),
 | 
|---|
| [990a62] | 99 |     lambda3(0.),
 | 
|---|
 | 100 |     alpha(0.),
 | 
|---|
 | 101 |     chi(1.),
 | 
|---|
 | 102 |     omega(1.),
 | 
|---|
| [775dd1a] | 103 |     triplefunction(&Helpers::NoOp_Triplefunction)
 | 
|---|
| [dbf8c8] | 104 | {
 | 
|---|
 | 105 |   // have some decent defaults for parameter_derivative checking
 | 
|---|
 | 106 |   params[A] = 3000.;
 | 
|---|
 | 107 |   params[B] = 300.;
 | 
|---|
 | 108 |   params[lambda] = 5.;
 | 
|---|
 | 109 |   params[mu] = 3.;
 | 
|---|
 | 110 |   params[beta] = 2.;
 | 
|---|
 | 111 |   params[n] = 1.;
 | 
|---|
 | 112 |   params[c] = 0.01;
 | 
|---|
 | 113 |   params[d] = 1.;
 | 
|---|
 | 114 |   params[h] = 0.01;
 | 
|---|
 | 115 | }
 | 
|---|
| [e7579e] | 116 | 
 | 
|---|
 | 117 | ManyBodyPotential_Tersoff::ManyBodyPotential_Tersoff(
 | 
|---|
| [ed2551] | 118 |     const ParticleTypes_t &_ParticleTypes,
 | 
|---|
| [ffc368] | 119 |     const double &_R,
 | 
|---|
 | 120 |     const double &_S,
 | 
|---|
| [e7579e] | 121 |     const double &_A,
 | 
|---|
 | 122 |     const double &_B,
 | 
|---|
| [ffc368] | 123 |     const double &_lambda,
 | 
|---|
 | 124 |     const double &_mu,
 | 
|---|
| [e7579e] | 125 |     const double &_lambda3,
 | 
|---|
 | 126 |     const double &_alpha,
 | 
|---|
 | 127 |     const double &_beta,
 | 
|---|
| [ffc368] | 128 |     const double &_chi,
 | 
|---|
 | 129 |     const double &_omega,
 | 
|---|
| [e7579e] | 130 |     const double &_n,
 | 
|---|
 | 131 |     const double &_c,
 | 
|---|
 | 132 |     const double &_d,
 | 
|---|
| [b15ae7] | 133 |     const double &_h) :
 | 
|---|
| [fdd23a] | 134 |   EmpiricalPotential(_ParticleTypes),
 | 
|---|
| [e7579e] | 135 |   params(parameters_t(MAXPARAMS, 0.)),
 | 
|---|
| [752dc7] | 136 |   R(_R),
 | 
|---|
 | 137 |   S(_S),
 | 
|---|
| [990a62] | 138 |   lambda3(_lambda3),
 | 
|---|
 | 139 |   alpha(_alpha),
 | 
|---|
 | 140 |   chi(_chi),
 | 
|---|
 | 141 |   omega(_mu),
 | 
|---|
| [775dd1a] | 142 |   triplefunction(&Helpers::NoOp_Triplefunction)
 | 
|---|
| [e7579e] | 143 | {
 | 
|---|
| [ffc368] | 144 | //  Info info(__func__);
 | 
|---|
| [752dc7] | 145 | //  R = _R;
 | 
|---|
 | 146 | //  S = _S;
 | 
|---|
| [e7579e] | 147 |   params[A] = _A;
 | 
|---|
 | 148 |   params[B] = _B;
 | 
|---|
| [ffc368] | 149 |   params[lambda] = _lambda;
 | 
|---|
 | 150 |   params[mu] = _mu;
 | 
|---|
| [990a62] | 151 | //  lambda3 = _lambda3;
 | 
|---|
 | 152 | //  alpha = _alpha;
 | 
|---|
| [e7579e] | 153 |   params[beta] = _beta;
 | 
|---|
| [990a62] | 154 | //  chi = _chi;
 | 
|---|
 | 155 | //  omega = _omega;
 | 
|---|
| [e7579e] | 156 |   params[n] = _n;
 | 
|---|
 | 157 |   params[c] = _c;
 | 
|---|
 | 158 |   params[d] = _d;
 | 
|---|
 | 159 |   params[h] = _h;
 | 
|---|
 | 160 | }
 | 
|---|
 | 161 | 
 | 
|---|
| [086070] | 162 | void ManyBodyPotential_Tersoff::setParameters(const parameters_t &_params)
 | 
|---|
 | 163 | {
 | 
|---|
 | 164 |   const size_t paramsDim = _params.size();
 | 
|---|
 | 165 |   ASSERT( paramsDim <= getParameterDimension(),
 | 
|---|
 | 166 |       "ManyBodyPotential_Tersoff::setParameters() - we need not more than "
 | 
|---|
 | 167 |       +toString(getParameterDimension())+" parameters.");
 | 
|---|
 | 168 |   for (size_t i=0; i< paramsDim; ++i)
 | 
|---|
 | 169 |     params[i] = _params[i];
 | 
|---|
 | 170 | 
 | 
|---|
 | 171 | #ifndef NDEBUG
 | 
|---|
 | 172 |   parameters_t check_params(getParameters());
 | 
|---|
 | 173 |   check_params.resize(paramsDim); // truncate to same size
 | 
|---|
 | 174 |   ASSERT( check_params == _params,
 | 
|---|
 | 175 |       "ManyBodyPotential_Tersoff::setParameters() - failed, mismatch in to be set "
 | 
|---|
 | 176 |       +toString(_params)+" and set "+toString(check_params)+" params.");
 | 
|---|
 | 177 | #endif
 | 
|---|
 | 178 | }
 | 
|---|
 | 179 | 
 | 
|---|
| [4f82f8] | 180 | ManyBodyPotential_Tersoff::results_t
 | 
|---|
| [610c11] | 181 | ManyBodyPotential_Tersoff::operator()(
 | 
|---|
 | 182 |     const arguments_t &arguments
 | 
|---|
 | 183 |     ) const
 | 
|---|
 | 184 | {
 | 
|---|
| [ffc368] | 185 | //  Info info(__func__);
 | 
|---|
| [2e9486] | 186 |   double result = 0.;
 | 
|---|
 | 187 |   for(arguments_t::const_iterator argiter = arguments.begin();
 | 
|---|
 | 188 |       argiter != arguments.end();
 | 
|---|
 | 189 |       ++argiter) {
 | 
|---|
 | 190 |     const argument_t &r_ij = *argiter;
 | 
|---|
| [b760bc3] | 191 |     ASSERT( ParticleTypeChecker::checkArgumentsAgainstParticleTypes(
 | 
|---|
 | 192 |         arguments_t(1, r_ij), getParticleTypes()),
 | 
|---|
 | 193 |         "ManyBodyPotential_Tersoff::operator() - types don't match with ones in arguments.");
 | 
|---|
 | 194 |  
 | 
|---|
| [2e9486] | 195 |     const double cutoff = function_cutoff(r_ij.distance);
 | 
|---|
 | 196 |     const double temp = (cutoff == 0.) ?
 | 
|---|
 | 197 |         0. :
 | 
|---|
 | 198 |         cutoff * (
 | 
|---|
 | 199 |             function_prefactor(
 | 
|---|
 | 200 |                 alpha,
 | 
|---|
 | 201 |                 function_eta(r_ij))
 | 
|---|
 | 202 |             * function_smoother(
 | 
|---|
 | 203 |                 params[A],
 | 
|---|
 | 204 |                 params[lambda],
 | 
|---|
 | 205 |                 r_ij.distance)
 | 
|---|
 | 206 |             +
 | 
|---|
 | 207 |             function_prefactor(
 | 
|---|
 | 208 |                 params[beta],
 | 
|---|
 | 209 |                 function_zeta(r_ij))
 | 
|---|
 | 210 |             * function_smoother(
 | 
|---|
 | 211 |                 -params[B],
 | 
|---|
 | 212 |                 params[mu],
 | 
|---|
 | 213 |                 r_ij.distance)
 | 
|---|
 | 214 |         );
 | 
|---|
 | 215 |     result += temp;
 | 
|---|
 | 216 |   }
 | 
|---|
| [ffc368] | 217 | //  LOG(2, "DEBUG: operator()(" << r_ij.distance << ") = " << result);
 | 
|---|
| [b15ae7] | 218 |   return std::vector<result_t>(1, result);
 | 
|---|
| [610c11] | 219 | }
 | 
|---|
 | 220 | 
 | 
|---|
| [ffc368] | 221 | ManyBodyPotential_Tersoff::derivative_components_t
 | 
|---|
 | 222 | ManyBodyPotential_Tersoff::derivative(
 | 
|---|
 | 223 |     const arguments_t &arguments
 | 
|---|
 | 224 |     ) const
 | 
|---|
 | 225 | {
 | 
|---|
 | 226 | //  Info info(__func__);
 | 
|---|
 | 227 |   return ManyBodyPotential_Tersoff::derivative_components_t();
 | 
|---|
 | 228 | }
 | 
|---|
 | 229 | 
 | 
|---|
 | 230 | ManyBodyPotential_Tersoff::results_t
 | 
|---|
 | 231 | ManyBodyPotential_Tersoff::parameter_derivative(
 | 
|---|
 | 232 |     const arguments_t &arguments,
 | 
|---|
 | 233 |     const size_t index
 | 
|---|
 | 234 |     ) const
 | 
|---|
 | 235 | {
 | 
|---|
 | 236 | //  Info info(__func__);
 | 
|---|
 | 237 | //  ASSERT( arguments.size() == 1,
 | 
|---|
| [2e9486] | 238 | //      "ManyBodyPotential_Tersoff::parameter_derivative() - requires exactly one argument.");
 | 
|---|
| [56c5de4] | 239 | 
 | 
|---|
| [2e9486] | 240 |   double result = 0.;
 | 
|---|
 | 241 |   for(arguments_t::const_iterator argiter = arguments.begin();
 | 
|---|
 | 242 |       argiter != arguments.end();
 | 
|---|
 | 243 |       ++argiter) {
 | 
|---|
 | 244 |     const argument_t &r_ij = *argiter;
 | 
|---|
| [b760bc3] | 245 |     ASSERT( ParticleTypeChecker::checkArgumentsAgainstParticleTypes(
 | 
|---|
 | 246 |         arguments_t(1, r_ij), getParticleTypes()),
 | 
|---|
 | 247 |         "ManyBodyPotential_Tersoff::operator() - types don't match with ones in arguments.");
 | 
|---|
| [55fe788] | 248 | 
 | 
|---|
| [ffc368] | 249 |   switch (index) {
 | 
|---|
| [752dc7] | 250 | //    case R:
 | 
|---|
 | 251 | //    {
 | 
|---|
| [2e9486] | 252 | //      result += 0.;
 | 
|---|
| [752dc7] | 253 | //      break;
 | 
|---|
 | 254 | //    }
 | 
|---|
 | 255 | //    case S:
 | 
|---|
 | 256 | //    {
 | 
|---|
| [2e9486] | 257 | //      result += 0.;
 | 
|---|
| [752dc7] | 258 | //      break;
 | 
|---|
 | 259 | //    }
 | 
|---|
| [ffc368] | 260 |     case A:
 | 
|---|
 | 261 |     {
 | 
|---|
| [ca8d82] | 262 |       const double cutoff = function_cutoff(r_ij.distance);
 | 
|---|
| [2e9486] | 263 |       result += (cutoff == 0.) ?
 | 
|---|
| [ca8d82] | 264 |           0. :
 | 
|---|
 | 265 |           cutoff *
 | 
|---|
 | 266 |               function_prefactor(
 | 
|---|
 | 267 |                   alpha,
 | 
|---|
 | 268 |                   function_eta(r_ij))
 | 
|---|
 | 269 |               * function_smoother(
 | 
|---|
 | 270 |                   1.,
 | 
|---|
 | 271 |                   params[lambda],
 | 
|---|
 | 272 |                   r_ij.distance);
 | 
|---|
 | 273 | //          cutoff * function_prefactor(
 | 
|---|
 | 274 | //              alpha,
 | 
|---|
 | 275 | //              function_eta(r_ij))
 | 
|---|
 | 276 | //          * function_smoother(
 | 
|---|
 | 277 | //              1.,
 | 
|---|
 | 278 | //              params[mu],
 | 
|---|
 | 279 | //              r_ij.distance);
 | 
|---|
| [ffc368] | 280 |       break;
 | 
|---|
 | 281 |     }
 | 
|---|
 | 282 |     case B:
 | 
|---|
 | 283 |     {
 | 
|---|
| [ca8d82] | 284 |       const double cutoff = function_cutoff(r_ij.distance);
 | 
|---|
| [2e9486] | 285 |       result += (cutoff == 0.) ?
 | 
|---|
| [ca8d82] | 286 |           0. :
 | 
|---|
 | 287 |           cutoff * function_prefactor(
 | 
|---|
 | 288 |               params[beta],
 | 
|---|
 | 289 |               function_zeta(r_ij))
 | 
|---|
 | 290 |           * function_smoother(
 | 
|---|
 | 291 |               -1.,
 | 
|---|
 | 292 |               params[mu],
 | 
|---|
 | 293 |               r_ij.distance);
 | 
|---|
 | 294 | //          cutoff * function_prefactor(
 | 
|---|
 | 295 | //              beta,
 | 
|---|
 | 296 | //              function_zeta(r_ij))
 | 
|---|
 | 297 | //          * function_smoother(
 | 
|---|
 | 298 | //              -params[B],
 | 
|---|
 | 299 | //              params[mu],
 | 
|---|
 | 300 | //              r_ij.distance)/params[B];
 | 
|---|
| [ffc368] | 301 |       break;
 | 
|---|
 | 302 |     }
 | 
|---|
 | 303 |     case lambda:
 | 
|---|
 | 304 |     {
 | 
|---|
 | 305 |       const double cutoff = function_cutoff(r_ij.distance);
 | 
|---|
| [2e9486] | 306 |       result += (cutoff == 0.) ?
 | 
|---|
| [ffc368] | 307 |           0. :
 | 
|---|
| [ca8d82] | 308 |           -r_ij.distance * cutoff *
 | 
|---|
 | 309 |               function_prefactor(
 | 
|---|
 | 310 |                   alpha,
 | 
|---|
 | 311 |                   function_eta(r_ij))
 | 
|---|
 | 312 |               * function_smoother(
 | 
|---|
 | 313 |                   params[A],
 | 
|---|
 | 314 |                   params[lambda],
 | 
|---|
 | 315 |                   r_ij.distance);
 | 
|---|
| [ffc368] | 316 |       break;
 | 
|---|
 | 317 |     }
 | 
|---|
 | 318 |     case mu:
 | 
|---|
 | 319 |     {
 | 
|---|
 | 320 |       const double cutoff = function_cutoff(r_ij.distance);
 | 
|---|
| [2e9486] | 321 |       result += (cutoff == 0.) ?
 | 
|---|
| [ffc368] | 322 |           0. :
 | 
|---|
| [f904d5] | 323 |           -r_ij.distance * cutoff *(
 | 
|---|
| [ffc368] | 324 |           function_prefactor(
 | 
|---|
 | 325 |               params[beta],
 | 
|---|
 | 326 |               function_zeta(r_ij))
 | 
|---|
 | 327 |           * function_smoother(
 | 
|---|
 | 328 |               -params[B],
 | 
|---|
 | 329 |               params[mu],
 | 
|---|
 | 330 |               r_ij.distance)
 | 
|---|
 | 331 |       );
 | 
|---|
 | 332 |       break;
 | 
|---|
 | 333 |     }
 | 
|---|
| [990a62] | 334 | //    case lambda3:
 | 
|---|
 | 335 | //    {
 | 
|---|
| [2e9486] | 336 | //      result += 0.;
 | 
|---|
| [990a62] | 337 | //      break;
 | 
|---|
 | 338 | //    }
 | 
|---|
 | 339 | //    case alpha:
 | 
|---|
 | 340 | //    {
 | 
|---|
 | 341 | //      const double temp =
 | 
|---|
 | 342 | //          pow(alpha*function_eta(r_ij), params[n]);
 | 
|---|
 | 343 | //      const double cutoff = function_cutoff(r_ij.distance);
 | 
|---|
| [2e9486] | 344 | //      result += (cutoff == 0.) || (alpha == 0. )?
 | 
|---|
| [990a62] | 345 | //          0. :
 | 
|---|
 | 346 | //          function_smoother(
 | 
|---|
| [ca8d82] | 347 | //              params[A],
 | 
|---|
| [990a62] | 348 | //              params[lambda],
 | 
|---|
 | 349 | //              r_ij.distance)
 | 
|---|
 | 350 | //          * (-.5) * alpha * (temp/alpha)
 | 
|---|
 | 351 | //          / (1. + temp)
 | 
|---|
 | 352 | //          ;
 | 
|---|
 | 353 | //      break;
 | 
|---|
 | 354 | //    }
 | 
|---|
 | 355 | //    case chi:
 | 
|---|
 | 356 | //    {
 | 
|---|
| [2e9486] | 357 | //      result += 0.;
 | 
|---|
| [990a62] | 358 | //      break;
 | 
|---|
 | 359 | //    }
 | 
|---|
 | 360 | //    case omega:
 | 
|---|
 | 361 | //    {
 | 
|---|
| [2e9486] | 362 | //      result += 0.;
 | 
|---|
| [990a62] | 363 | //      break;
 | 
|---|
 | 364 | //    }
 | 
|---|
| [ffc368] | 365 |     case beta:
 | 
|---|
 | 366 |     {
 | 
|---|
 | 367 |       const double temp =
 | 
|---|
 | 368 |           pow(params[beta]*function_zeta(r_ij), params[n]);
 | 
|---|
 | 369 |       const double cutoff = function_cutoff(r_ij.distance);
 | 
|---|
| [2e9486] | 370 |       result += (cutoff == 0.) || (params[beta] == 0. )?
 | 
|---|
| [ffc368] | 371 |           0. : cutoff *
 | 
|---|
 | 372 |           function_smoother(
 | 
|---|
 | 373 |               -params[B],
 | 
|---|
 | 374 |               params[mu],
 | 
|---|
 | 375 |               r_ij.distance)
 | 
|---|
| [f904d5] | 376 |           * (-.5)
 | 
|---|
 | 377 |           * function_prefactor(
 | 
|---|
 | 378 |               params[beta],
 | 
|---|
 | 379 |               function_zeta(r_ij))
 | 
|---|
 | 380 |           * (temp/params[beta])
 | 
|---|
| [ffc368] | 381 |           / (1. + temp)
 | 
|---|
 | 382 |           ;
 | 
|---|
 | 383 |       break;
 | 
|---|
 | 384 |     }
 | 
|---|
 | 385 |     case n:
 | 
|---|
 | 386 |     {
 | 
|---|
| [bc55c9] | 387 |       const double zeta = function_zeta(r_ij);
 | 
|---|
 | 388 |       const double temp = pow( params[beta]*zeta , params[n]);
 | 
|---|
| [ffc368] | 389 |       const double cutoff = function_cutoff(r_ij.distance);
 | 
|---|
| [bc55c9] | 390 |       const double tempres = ((cutoff == 0.) || (zeta == 0.)) ? // zeta must be caught if zero due to log
 | 
|---|
| [f904d5] | 391 |           0. : .5 * cutoff *
 | 
|---|
| [ffc368] | 392 |           function_smoother(
 | 
|---|
 | 393 |               -params[B],
 | 
|---|
 | 394 |               params[mu],
 | 
|---|
 | 395 |               r_ij.distance)
 | 
|---|
| [f904d5] | 396 |           * function_prefactor(
 | 
|---|
 | 397 |               params[beta],
 | 
|---|
 | 398 |               function_zeta(r_ij))
 | 
|---|
| [ffc368] | 399 |           * ( log(1.+temp)/(params[n]*params[n]) - temp
 | 
|---|
 | 400 |               * (log(function_zeta(r_ij)) + log(params[beta]))
 | 
|---|
 | 401 |               /(params[n]*(1.+temp)))
 | 
|---|
 | 402 |           ;
 | 
|---|
| [bc55c9] | 403 | //      if (tempres != tempres)
 | 
|---|
 | 404 | //      LOG(2, "DEBUG: tempres is NaN."); 
 | 
|---|
 | 405 | //      LOG(2, "DEBUG: Adding " << tempres << " for p.d. w.r.t n, temp=" << temp << ", cutoff=" << cutoff);
 | 
|---|
 | 406 |       result += tempres;
 | 
|---|
| [ffc368] | 407 |       break;
 | 
|---|
 | 408 |     }
 | 
|---|
 | 409 |     case c:
 | 
|---|
 | 410 |     {
 | 
|---|
| [f904d5] | 411 |       const double zeta = function_zeta(r_ij);
 | 
|---|
| [ca8d82] | 412 |       if (zeta == 0.)
 | 
|---|
 | 413 |         break;
 | 
|---|
| [f904d5] | 414 |       const double temp =
 | 
|---|
| [ca8d82] | 415 |           pow(zeta, params[n]-1.) * pow(params[beta],params[n]);
 | 
|---|
| [f904d5] | 416 |       const double cutoff = function_cutoff(r_ij.distance);
 | 
|---|
| [2e9486] | 417 |       const double tempres = (cutoff == 0.) ?
 | 
|---|
| [ca8d82] | 418 |           0. : cutoff *
 | 
|---|
| [f904d5] | 419 |           function_smoother(
 | 
|---|
 | 420 |               -params[B],
 | 
|---|
 | 421 |               params[mu],
 | 
|---|
 | 422 |               r_ij.distance)
 | 
|---|
 | 423 |           * function_prefactor(
 | 
|---|
 | 424 |               params[beta],
 | 
|---|
 | 425 |               zeta)
 | 
|---|
| [ca8d82] | 426 |            * (-1.) * temp / (1.+temp*zeta);
 | 
|---|
 | 427 |       double factor = function_derivative_c(r_ij);
 | 
|---|
| [2e9486] | 428 |       result += tempres*factor;
 | 
|---|
| [bc55c9] | 429 |       if (result != result)
 | 
|---|
 | 430 |         ELOG(1, "result is NaN, zeta=" << zeta << ", temp=" << temp << ", cutoff=" << cutoff << ", tempres=" << tempres << ", factor=" << factor);
 | 
|---|
| [ffc368] | 431 |       break;
 | 
|---|
 | 432 |     }
 | 
|---|
 | 433 |     case d:
 | 
|---|
 | 434 |     {
 | 
|---|
| [f904d5] | 435 |       const double zeta = function_zeta(r_ij);
 | 
|---|
 | 436 |       const double temp =
 | 
|---|
| [ca8d82] | 437 |           pow(zeta, params[n]-1.) * pow(params[beta],params[n]);
 | 
|---|
| [f904d5] | 438 |       const double cutoff = function_cutoff(r_ij.distance);
 | 
|---|
| [2e9486] | 439 |       const double tempres = (cutoff == 0.) ?
 | 
|---|
| [ca8d82] | 440 |           0. : cutoff *
 | 
|---|
| [f904d5] | 441 |           function_smoother(
 | 
|---|
 | 442 |               -params[B],
 | 
|---|
 | 443 |               params[mu],
 | 
|---|
 | 444 |               r_ij.distance)
 | 
|---|
 | 445 |           * function_prefactor(
 | 
|---|
 | 446 |               params[beta],
 | 
|---|
 | 447 |               zeta)
 | 
|---|
| [ca8d82] | 448 |            * (-1.) * temp / (1.+temp*zeta);
 | 
|---|
 | 449 |       double factor = function_derivative_d(r_ij);
 | 
|---|
| [2e9486] | 450 |       result += tempres*factor;
 | 
|---|
| [bc55c9] | 451 |       if (result != result)
 | 
|---|
 | 452 |         ELOG(1, "result is NaN, zeta=" << zeta << ", temp=" << temp << ", cutoff=" << cutoff << ", tempres=" << tempres << ", factor=" << factor);
 | 
|---|
| [ffc368] | 453 |       break;
 | 
|---|
 | 454 |     }
 | 
|---|
 | 455 |     case h:
 | 
|---|
 | 456 |     {
 | 
|---|
| [f904d5] | 457 |       const double zeta = function_zeta(r_ij);
 | 
|---|
 | 458 |       const double temp =
 | 
|---|
| [ca8d82] | 459 |           pow(zeta, params[n]-1.) * pow(params[beta],params[n]);
 | 
|---|
| [f904d5] | 460 |       const double cutoff = function_cutoff(r_ij.distance);
 | 
|---|
| [2e9486] | 461 |       const double tempres = (cutoff == 0.) ?
 | 
|---|
| [ca8d82] | 462 |           0. : cutoff *
 | 
|---|
| [f904d5] | 463 |           function_smoother(
 | 
|---|
 | 464 |               -params[B],
 | 
|---|
 | 465 |               params[mu],
 | 
|---|
 | 466 |               r_ij.distance)
 | 
|---|
 | 467 |           * function_prefactor(
 | 
|---|
 | 468 |               params[beta],
 | 
|---|
 | 469 |               zeta)
 | 
|---|
| [ca8d82] | 470 |            * (-1.) * temp / (1.+temp*zeta);
 | 
|---|
 | 471 |       double factor = function_derivative_h(r_ij);
 | 
|---|
| [2e9486] | 472 |       result += tempres*factor;
 | 
|---|
| [bc55c9] | 473 |       if (result != result)
 | 
|---|
 | 474 |         ELOG(1, "result is NaN, zeta=" << zeta << ", temp=" << temp << ", cutoff=" << cutoff << ", tempres=" << tempres << ", factor=" << factor);
 | 
|---|
| [ffc368] | 475 |       break;
 | 
|---|
 | 476 |     }
 | 
|---|
 | 477 |     default:
 | 
|---|
| [b15ae7] | 478 |       ASSERT(0, "ManyBodyPotential_Tersoff::parameter_derivative() - derivative to unknown parameter desired.");
 | 
|---|
| [ffc368] | 479 |       break;
 | 
|---|
 | 480 |   }
 | 
|---|
| [bc55c9] | 481 |   if (result != result)
 | 
|---|
 | 482 |     ELOG(1, "result is NaN.");
 | 
|---|
| [2e9486] | 483 |   }
 | 
|---|
 | 484 |   return results_t(1,-result);
 | 
|---|
| [ffc368] | 485 | }
 | 
|---|
 | 486 | 
 | 
|---|
| [ca8d82] | 487 | ManyBodyPotential_Tersoff::result_t
 | 
|---|
 | 488 | ManyBodyPotential_Tersoff::function_derivative_c(
 | 
|---|
 | 489 |     const argument_t &r_ij
 | 
|---|
 | 490 |   ) const
 | 
|---|
 | 491 | {
 | 
|---|
 | 492 |   double result = 0.;
 | 
|---|
 | 493 |   std::vector<arguments_t> triples = triplefunction(r_ij, S);
 | 
|---|
 | 494 |   for (std::vector<arguments_t>::const_iterator iter = triples.begin();
 | 
|---|
 | 495 |       iter != triples.end(); ++iter) {
 | 
|---|
 | 496 |     ASSERT( iter->size() == 2,
 | 
|---|
 | 497 |         "ManyBodyPotential_Tersoff::function_derivative_c() - the triples result must contain exactly two distances.");
 | 
|---|
 | 498 |     const argument_t &r_ik = (*iter)[0];
 | 
|---|
 | 499 |     const argument_t &r_jk = (*iter)[1];
 | 
|---|
 | 500 |     const double tempangle = params[h] - function_theta(r_ij.distance, r_ik.distance, r_jk.distance);
 | 
|---|
 | 501 |     const double cutoff = function_cutoff(r_ik.distance);
 | 
|---|
 | 502 |     result += (cutoff == 0.) ?
 | 
|---|
 | 503 |         0. : cutoff * omega * exp( Helpers::pow(lambda3 * (r_ij.distance - r_ik.distance) ,3)) * (
 | 
|---|
 | 504 |             params[c]/Helpers::pow(params[d],2)
 | 
|---|
 | 505 |             - params[c] / ( Helpers::pow(params[d],2) + Helpers::pow(tempangle,2) )
 | 
|---|
 | 506 |         );
 | 
|---|
 | 507 |   }
 | 
|---|
 | 508 |   return result;
 | 
|---|
 | 509 | }
 | 
|---|
 | 510 | 
 | 
|---|
 | 511 | ManyBodyPotential_Tersoff::result_t
 | 
|---|
 | 512 | ManyBodyPotential_Tersoff::function_derivative_d(
 | 
|---|
 | 513 |     const argument_t &r_ij
 | 
|---|
 | 514 |   ) const
 | 
|---|
 | 515 | {
 | 
|---|
 | 516 |   double result = 0.;
 | 
|---|
 | 517 |   std::vector<arguments_t> triples = triplefunction(r_ij, S);
 | 
|---|
 | 518 |   for (std::vector<arguments_t>::const_iterator iter = triples.begin();
 | 
|---|
 | 519 |       iter != triples.end(); ++iter) {
 | 
|---|
 | 520 |     ASSERT( iter->size() == 2,
 | 
|---|
 | 521 |         "ManyBodyPotential_Tersoff::function_derivative_d() - the triples result must contain exactly two distances.");
 | 
|---|
 | 522 |     const argument_t &r_ik = (*iter)[0];
 | 
|---|
 | 523 |     const argument_t &r_jk = (*iter)[1];
 | 
|---|
 | 524 |     const double tempangle = params[h] - function_theta(r_ij.distance, r_ik.distance, r_jk.distance);
 | 
|---|
 | 525 |     const double cutoff = function_cutoff(r_ik.distance);
 | 
|---|
 | 526 |     result += (cutoff == 0.) ?
 | 
|---|
 | 527 |         0. : cutoff * omega  * exp( Helpers::pow(lambda3 * (r_ij.distance - r_ik.distance) ,3)) * (
 | 
|---|
 | 528 |           - Helpers::pow(params[c],2)/Helpers::pow(params[d],3)
 | 
|---|
 | 529 |           + Helpers::pow(params[c],2) * params[d]
 | 
|---|
 | 530 |             / Helpers::pow(Helpers::pow(params[d],2) + Helpers::pow(tempangle,2),2)
 | 
|---|
 | 531 |         );
 | 
|---|
 | 532 |   }
 | 
|---|
 | 533 |   return result;
 | 
|---|
 | 534 | }
 | 
|---|
 | 535 | 
 | 
|---|
 | 536 | ManyBodyPotential_Tersoff::result_t
 | 
|---|
 | 537 | ManyBodyPotential_Tersoff::function_derivative_h(
 | 
|---|
 | 538 |     const argument_t &r_ij
 | 
|---|
 | 539 |   ) const
 | 
|---|
 | 540 | {
 | 
|---|
 | 541 |   double result = 0.;
 | 
|---|
 | 542 |   std::vector<arguments_t> triples = triplefunction(r_ij, S);
 | 
|---|
 | 543 |   for (std::vector<arguments_t>::const_iterator iter = triples.begin();
 | 
|---|
 | 544 |       iter != triples.end(); ++iter) {
 | 
|---|
 | 545 |     ASSERT( iter->size() == 2,
 | 
|---|
 | 546 |         "ManyBodyPotential_Tersoff::function_derivative_h() - the triples result must contain exactly two distances.");
 | 
|---|
 | 547 |     const argument_t &r_ik = (*iter)[0];
 | 
|---|
 | 548 |     const argument_t &r_jk = (*iter)[1];
 | 
|---|
 | 549 |     const double tempangle = params[h] - function_theta(r_ij.distance, r_ik.distance, r_jk.distance);
 | 
|---|
 | 550 |     const double cutoff = function_cutoff(r_ik.distance);
 | 
|---|
 | 551 |     result += (cutoff == 0.) ?
 | 
|---|
 | 552 |         0. : cutoff * omega  * exp( Helpers::pow(lambda3 * (r_ij.distance - r_ik.distance) ,3)) * (
 | 
|---|
 | 553 |           ( Helpers::pow(params[c],2)*tempangle )
 | 
|---|
 | 554 |             / Helpers::pow(Helpers::pow(params[d],2) + Helpers::pow(tempangle,2),2)
 | 
|---|
 | 555 |         );
 | 
|---|
 | 556 |   }
 | 
|---|
 | 557 |   return result;
 | 
|---|
 | 558 | }
 | 
|---|
 | 559 | 
 | 
|---|
| [4f82f8] | 560 | ManyBodyPotential_Tersoff::result_t
 | 
|---|
| [610c11] | 561 | ManyBodyPotential_Tersoff::function_cutoff(
 | 
|---|
 | 562 |     const double &distance
 | 
|---|
 | 563 |   ) const
 | 
|---|
 | 564 | {
 | 
|---|
| [ffc368] | 565 | //  Info info(__func__);
 | 
|---|
 | 566 |   double result = 0.;
 | 
|---|
| [752dc7] | 567 |   if (distance < R)
 | 
|---|
| [ffc368] | 568 |     result = 1.;
 | 
|---|
| [752dc7] | 569 |   else if (distance > S)
 | 
|---|
| [ffc368] | 570 |     result = 0.;
 | 
|---|
| [610c11] | 571 |   else {
 | 
|---|
| [752dc7] | 572 |     result = (0.5 + 0.5 * cos( M_PI * (distance - R)/(S-R)));
 | 
|---|
| [610c11] | 573 |   }
 | 
|---|
| [ffc368] | 574 | //  LOG(2, "DEBUG: function_cutoff(" << distance << ") = " << result);
 | 
|---|
 | 575 |   return result;
 | 
|---|
| [610c11] | 576 | }
 | 
|---|
 | 577 | 
 | 
|---|
| [4f82f8] | 578 | ManyBodyPotential_Tersoff::result_t
 | 
|---|
| [610c11] | 579 | ManyBodyPotential_Tersoff::function_prefactor(
 | 
|---|
 | 580 |     const double &alpha,
 | 
|---|
| [ffc368] | 581 |     const double &eta
 | 
|---|
| [610c11] | 582 |   ) const
 | 
|---|
 | 583 | {
 | 
|---|
| [ffc368] | 584 | //  Info info(__func__);
 | 
|---|
| [990a62] | 585 |   const double result = chi * pow(
 | 
|---|
| [ffc368] | 586 |       (1. + pow(alpha * eta, params[n])),
 | 
|---|
 | 587 |       -1./(2.*params[n]));
 | 
|---|
 | 588 | //  LOG(2, "DEBUG: function_prefactor(" << alpha << "," << eta << ") = " << result);
 | 
|---|
 | 589 |   return result;
 | 
|---|
 | 590 | }
 | 
|---|
 | 591 | 
 | 
|---|
 | 592 | ManyBodyPotential_Tersoff::result_t
 | 
|---|
 | 593 | ManyBodyPotential_Tersoff::function_smoother(
 | 
|---|
 | 594 |     const double &prefactor,
 | 
|---|
 | 595 |     const double &lambda,
 | 
|---|
 | 596 |     const double &distance
 | 
|---|
 | 597 |     ) const
 | 
|---|
 | 598 | {
 | 
|---|
 | 599 | //  Info info(__func__);
 | 
|---|
 | 600 |   const double result = prefactor * exp(-lambda * distance);
 | 
|---|
 | 601 | //  LOG(2, "DEBUG: function_smoother(" << prefactor << "," << lambda << "," << distance << ") = " << result);
 | 
|---|
 | 602 |   return result;
 | 
|---|
| [610c11] | 603 | }
 | 
|---|
 | 604 | 
 | 
|---|
| [4f82f8] | 605 | ManyBodyPotential_Tersoff::result_t
 | 
|---|
| [610c11] | 606 | ManyBodyPotential_Tersoff::function_eta(
 | 
|---|
 | 607 |     const argument_t &r_ij
 | 
|---|
 | 608 |   ) const
 | 
|---|
 | 609 | {
 | 
|---|
| [ffc368] | 610 | //  Info info(__func__);
 | 
|---|
| [610c11] | 611 |   result_t result = 0.;
 | 
|---|
 | 612 | 
 | 
|---|
 | 613 |   // get all triples within the cutoff
 | 
|---|
| [752dc7] | 614 |   std::vector<arguments_t> triples = triplefunction(r_ij, S);
 | 
|---|
| [610c11] | 615 |   for (std::vector<arguments_t>::const_iterator iter = triples.begin();
 | 
|---|
 | 616 |       iter != triples.end(); ++iter) {
 | 
|---|
 | 617 |     ASSERT( iter->size() == 2,
 | 
|---|
 | 618 |         "ManyBodyPotential_Tersoff::function_zeta() - the triples result must contain of exactly two distances.");
 | 
|---|
 | 619 |     const argument_t &r_ik = (*iter)[0];
 | 
|---|
 | 620 |     result += function_cutoff(r_ik.distance)
 | 
|---|
| [990a62] | 621 |         * exp( Helpers::pow(lambda3 * (r_ij.distance - r_ik.distance) ,3));
 | 
|---|
| [610c11] | 622 |   }
 | 
|---|
 | 623 | 
 | 
|---|
| [ffc368] | 624 | //  LOG(2, "DEBUG: function_eta(" << r_ij.distance << ") = " << result);
 | 
|---|
| [610c11] | 625 |   return result;
 | 
|---|
 | 626 | }
 | 
|---|
 | 627 | 
 | 
|---|
| [4f82f8] | 628 | ManyBodyPotential_Tersoff::result_t
 | 
|---|
| [610c11] | 629 | ManyBodyPotential_Tersoff::function_zeta(
 | 
|---|
 | 630 |     const argument_t &r_ij
 | 
|---|
 | 631 |   ) const
 | 
|---|
 | 632 | {
 | 
|---|
| [ffc368] | 633 | //  Info info(__func__);
 | 
|---|
| [610c11] | 634 |   result_t result = 0.;
 | 
|---|
 | 635 | 
 | 
|---|
 | 636 |   // get all triples within the cutoff
 | 
|---|
| [752dc7] | 637 |   std::vector<arguments_t> triples = triplefunction(r_ij, S);
 | 
|---|
| [610c11] | 638 |   for (std::vector<arguments_t>::const_iterator iter = triples.begin();
 | 
|---|
 | 639 |       iter != triples.end(); ++iter) {
 | 
|---|
 | 640 |     ASSERT( iter->size() == 2,
 | 
|---|
 | 641 |         "ManyBodyPotential_Tersoff::function_zeta() - the triples result must contain exactly two distances.");
 | 
|---|
 | 642 |     const argument_t &r_ik = (*iter)[0];
 | 
|---|
 | 643 |     const argument_t &r_jk = (*iter)[1];
 | 
|---|
 | 644 |     result +=
 | 
|---|
 | 645 |         function_cutoff(r_ik.distance)
 | 
|---|
| [990a62] | 646 |         * omega
 | 
|---|
| [610c11] | 647 |         * function_angle(r_ij.distance, r_ik.distance, r_jk.distance)
 | 
|---|
| [990a62] | 648 |         * exp( Helpers::pow(lambda3 * (r_ij.distance - r_ik.distance) ,3));
 | 
|---|
| [610c11] | 649 |   }
 | 
|---|
 | 650 | 
 | 
|---|
| [ffc368] | 651 | //  LOG(2, "DEBUG: function_zeta(" << r_ij.distance << ") = " << result);
 | 
|---|
| [610c11] | 652 |   return result;
 | 
|---|
 | 653 | }
 | 
|---|
 | 654 | 
 | 
|---|
| [4f82f8] | 655 | ManyBodyPotential_Tersoff::result_t
 | 
|---|
| [f904d5] | 656 | ManyBodyPotential_Tersoff::function_theta(
 | 
|---|
| [610c11] | 657 |     const double &r_ij,
 | 
|---|
 | 658 |     const double &r_ik,
 | 
|---|
 | 659 |     const double &r_jk
 | 
|---|
 | 660 |   ) const
 | 
|---|
 | 661 | {
 | 
|---|
 | 662 |   const double angle = Helpers::pow(r_ij,2) + Helpers::pow(r_ik,2) - Helpers::pow(r_jk,2);
 | 
|---|
| [ffc368] | 663 |   const double divisor = 2.* r_ij * r_ik;
 | 
|---|
 | 664 |   if (divisor != 0.) {
 | 
|---|
| [f904d5] | 665 |     LOG(2, "DEBUG: cos(theta)= " << angle/divisor);
 | 
|---|
 | 666 |     return angle/divisor;
 | 
|---|
| [ffc368] | 667 |   } else
 | 
|---|
 | 668 |     return 0.;
 | 
|---|
| [610c11] | 669 | }
 | 
|---|
| [ffc368] | 670 | 
 | 
|---|
| [f904d5] | 671 | ManyBodyPotential_Tersoff::result_t
 | 
|---|
 | 672 | ManyBodyPotential_Tersoff::function_angle(
 | 
|---|
 | 673 |     const double &r_ij,
 | 
|---|
 | 674 |     const double &r_ik,
 | 
|---|
 | 675 |     const double &r_jk
 | 
|---|
 | 676 |   ) const
 | 
|---|
 | 677 | {
 | 
|---|
 | 678 | //  Info info(__func__);
 | 
|---|
 | 679 |   const double result =
 | 
|---|
 | 680 |       1.
 | 
|---|
 | 681 |       + (Helpers::pow(params[c]/params[d], 2))
 | 
|---|
 | 682 |       - Helpers::pow(params[c], 2)/(Helpers::pow(params[d], 2) +
 | 
|---|
| [ca8d82] | 683 |           Helpers::pow(params[h] - function_theta(r_ij, r_ik, r_jk),2));
 | 
|---|
| [f904d5] | 684 | 
 | 
|---|
| [ca8d82] | 685 | //  LOG(2, "DEBUG: function_angle(" << r_ij << "," << r_ik << "," << r_jk << ") = " << result);
 | 
|---|
| [f904d5] | 686 |   return result;
 | 
|---|
 | 687 | }
 | 
|---|
 | 688 | 
 | 
|---|
| [7b019a] | 689 | FunctionModel::extractor_t
 | 
|---|
| [f0025d] | 690 | ManyBodyPotential_Tersoff::getSpecificExtractor() const
 | 
|---|
| [7b019a] | 691 | {
 | 
|---|
 | 692 |   FunctionModel::extractor_t returnfunction =
 | 
|---|
 | 693 |       boost::bind(&Extractors::gatherAllDistances,
 | 
|---|
 | 694 |           boost::bind(&Fragment::getPositions, _1),
 | 
|---|
 | 695 |           boost::bind(&Fragment::getCharges, _1),
 | 
|---|
 | 696 |           _2);
 | 
|---|
 | 697 |   return returnfunction;
 | 
|---|
 | 698 | }
 | 
|---|
 | 699 | 
 | 
|---|
| [0f5d38] | 700 | FunctionModel::filter_t ManyBodyPotential_Tersoff::getSpecificFilter() const
 | 
|---|
 | 701 | {
 | 
|---|
 | 702 |   FunctionModel::filter_t returnfunction =
 | 
|---|
| [51e0e3] | 703 |       boost::bind(&Extractors::filterArgumentsByParticleTypes,
 | 
|---|
 | 704 |           _1,
 | 
|---|
 | 705 |           getParticleTypes());
 | 
|---|
| [0f5d38] | 706 |   return returnfunction;
 | 
|---|
 | 707 | }
 | 
|---|
 | 708 | 
 | 
|---|
| [d52819] | 709 | void
 | 
|---|
 | 710 | ManyBodyPotential_Tersoff::setParametersToRandomInitialValues(
 | 
|---|
 | 711 |     const TrainingData &data)
 | 
|---|
 | 712 | {
 | 
|---|
 | 713 | //  params[ManyBodyPotential_Tersoff::R] = 1./AtomicLengthToAngstroem;
 | 
|---|
 | 714 | //  params[ManyBodyPotential_Tersoff::S] = 2./AtomicLengthToAngstroem;
 | 
|---|
 | 715 |   params[ManyBodyPotential_Tersoff::A] = 1e+4*rand()/(double)RAND_MAX;//1.393600e+03;
 | 
|---|
 | 716 |   params[ManyBodyPotential_Tersoff::B] = 1e+4*rand()/(double)RAND_MAX;//3.467000e+02;
 | 
|---|
 | 717 |   params[ManyBodyPotential_Tersoff::lambda] = 1e+1*rand()/(double)RAND_MAX;//3.487900e+00;
 | 
|---|
 | 718 |   params[ManyBodyPotential_Tersoff::mu] = 1e+1*rand()/(double)RAND_MAX;//2.211900e+00;
 | 
|---|
 | 719 |   //  params[ManyBodyPotential_Tersoff::lambda3] = 0.;
 | 
|---|
 | 720 |   //  params[ManyBodyPotential_Tersoff::alpha] = 0.;
 | 
|---|
 | 721 |   params[ManyBodyPotential_Tersoff::beta] = 1e-1*rand()/(double)RAND_MAX;//1.572400e-07;
 | 
|---|
 | 722 |   //  params[ManyBodyPotential_Tersoff::chi] = 1.;
 | 
|---|
 | 723 |   //  params[ManyBodyPotential_Tersoff::omega] = 1.;
 | 
|---|
 | 724 |   params[ManyBodyPotential_Tersoff::n] = 1e+1*rand()/(double)RAND_MAX;//7.275100e-01;
 | 
|---|
 | 725 |   params[ManyBodyPotential_Tersoff::c] = 1e+1*rand()/(double)RAND_MAX;//3.804900e+04;
 | 
|---|
 | 726 |   params[ManyBodyPotential_Tersoff::d] = 1e+1*rand()/(double)RAND_MAX;//4.384000e+00;
 | 
|---|
 | 727 |   params[ManyBodyPotential_Tersoff::h] = 1e+1*rand()/(double)RAND_MAX;//-5.705800e-01;
 | 
|---|
 | 728 | }
 | 
|---|
 | 729 | 
 | 
|---|