source: src/Potentials/Specifics/ManyBodyPotential_Tersoff.cpp@ ddb998

Fix_FitPotential_needs_atomicnumbers
Last change on this file since ddb998 was ddb998, checked in by Frederik Heber <heber@…>, 9 years ago

tempcommit: Renamed PotentialSubgraph -> PotentialGraph.

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