| [ffc368] | 1 | /*
 | 
|---|
 | 2 |  * Project: MoleCuilder
 | 
|---|
 | 3 |  * Description: creates and alters molecular systems
 | 
|---|
 | 4 |  * Copyright (C)  2012 University of Bonn. All rights reserved.
 | 
|---|
 | 5 |  * 
 | 
|---|
 | 6 |  *
 | 
|---|
 | 7 |  *   This file is part of MoleCuilder.
 | 
|---|
 | 8 |  *
 | 
|---|
 | 9 |  *    MoleCuilder is free software: you can redistribute it and/or modify
 | 
|---|
 | 10 |  *    it under the terms of the GNU General Public License as published by
 | 
|---|
 | 11 |  *    the Free Software Foundation, either version 2 of the License, or
 | 
|---|
 | 12 |  *    (at your option) any later version.
 | 
|---|
 | 13 |  *
 | 
|---|
 | 14 |  *    MoleCuilder is distributed in the hope that it will be useful,
 | 
|---|
 | 15 |  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
 | 16 |  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
 | 17 |  *    GNU General Public License for more details.
 | 
|---|
 | 18 |  *
 | 
|---|
 | 19 |  *    You should have received a copy of the GNU General Public License
 | 
|---|
 | 20 |  *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
 | 
|---|
 | 21 |  */
 | 
|---|
 | 22 | 
 | 
|---|
 | 23 | /*
 | 
|---|
 | 24 |  * ManyBodyPotential_TersoffUnitTest.cpp
 | 
|---|
 | 25 |  *
 | 
|---|
 | 26 |  *  Created on: Oct 04, 2012
 | 
|---|
 | 27 |  *      Author: heber
 | 
|---|
 | 28 |  */
 | 
|---|
 | 29 | 
 | 
|---|
 | 30 | // include config.h
 | 
|---|
 | 31 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 32 | #include <config.h>
 | 
|---|
 | 33 | #endif
 | 
|---|
 | 34 | 
 | 
|---|
 | 35 | using namespace std;
 | 
|---|
 | 36 | 
 | 
|---|
 | 37 | #include <cppunit/CompilerOutputter.h>
 | 
|---|
 | 38 | #include <cppunit/extensions/TestFactoryRegistry.h>
 | 
|---|
 | 39 | #include <cppunit/ui/text/TestRunner.h>
 | 
|---|
 | 40 | 
 | 
|---|
 | 41 | #include "ManyBodyPotential_TersoffUnitTest.hpp"
 | 
|---|
 | 42 | 
 | 
|---|
 | 43 | #include <boost/assign.hpp>
 | 
|---|
 | 44 | #include <boost/function.hpp>
 | 
|---|
 | 45 | 
 | 
|---|
 | 46 | #include <limits>
 | 
|---|
 | 47 | 
 | 
|---|
 | 48 | #include "CodePatterns/Assert.hpp"
 | 
|---|
 | 49 | #include "CodePatterns/Log.hpp"
 | 
|---|
 | 50 | 
 | 
|---|
 | 51 | #include "FunctionApproximation/FunctionArgument.hpp"
 | 
|---|
 | 52 | #include "Potentials/Specifics/ManyBodyPotential_Tersoff.hpp"
 | 
|---|
 | 53 | #include "Potentials/helpers.hpp"
 | 
|---|
 | 54 | 
 | 
|---|
 | 55 | using namespace boost::assign;
 | 
|---|
 | 56 | 
 | 
|---|
 | 57 | #ifdef HAVE_TESTRUNNER
 | 
|---|
 | 58 | #include "UnitTestMain.hpp"
 | 
|---|
 | 59 | #endif /*HAVE_TESTRUNNER*/
 | 
|---|
 | 60 | 
 | 
|---|
 | 61 | /********************************************** Test classes **************************************/
 | 
|---|
 | 62 | 
 | 
|---|
 | 63 | // Registers the fixture into the 'registry'
 | 
|---|
 | 64 | CPPUNIT_TEST_SUITE_REGISTRATION( ManyBodyPotential_TersoffTest );
 | 
|---|
 | 65 | 
 | 
|---|
 | 66 | ManyBodyPotential_TersoffTest::configurations_t ManyBodyPotential_TersoffTest::configurations;
 | 
|---|
 | 67 | 
 | 
|---|
 | 68 | /** This function looks up all distances ik and jk to a given ij and
 | 
|---|
 | 69 |  * returns a vector of pairs.
 | 
|---|
 | 70 |  */
 | 
|---|
 | 71 | std::vector<FunctionModel::arguments_t>
 | 
|---|
 | 72 | triplefunction(const argument_t &arguments, const double cutoff)
 | 
|---|
 | 73 | {
 | 
|---|
| [eb1efe] | 74 |   const ManyBodyPotential_TersoffTest::configuration_t &CurrentConfiguration =
 | 
|---|
 | 75 |       ManyBodyPotential_TersoffTest::configurations[arguments.globalid];
 | 
|---|
| [ffc368] | 76 |   std::vector<FunctionModel::arguments_t> result;
 | 
|---|
 | 77 |   // go through current configuration and gather all other distances
 | 
|---|
 | 78 |   ManyBodyPotential_TersoffTest::configuration_t::const_iterator firstiter =
 | 
|---|
| [eb1efe] | 79 |       CurrentConfiguration.begin();
 | 
|---|
| [ffc368] | 80 |   std::advance(firstiter, arguments.indices.first);
 | 
|---|
 | 81 |   ManyBodyPotential_TersoffTest::configuration_t::const_iterator seconditer =
 | 
|---|
| [eb1efe] | 82 |       CurrentConfiguration.begin();
 | 
|---|
| [ffc368] | 83 |   std::advance(seconditer, arguments.indices.second);
 | 
|---|
 | 84 |   for (ManyBodyPotential_TersoffTest::configuration_t::const_iterator iter =
 | 
|---|
| [eb1efe] | 85 |       CurrentConfiguration.begin();
 | 
|---|
 | 86 |       iter != CurrentConfiguration.end();
 | 
|---|
| [ffc368] | 87 |       ++iter) {
 | 
|---|
 | 88 |     // skip k==i and k==j
 | 
|---|
 | 89 |     if ((iter == firstiter) || (iter == seconditer))
 | 
|---|
 | 90 |       continue;
 | 
|---|
 | 91 |     FunctionModel::arguments_t args(2);
 | 
|---|
 | 92 |     // ik
 | 
|---|
 | 93 |     args[0].distance = firstiter->distance(*iter);
 | 
|---|
 | 94 |     args[0].indices = std::make_pair(
 | 
|---|
| [eb1efe] | 95 |         std::distance(CurrentConfiguration.begin(), firstiter),
 | 
|---|
 | 96 |         std::distance(CurrentConfiguration.begin(), iter)
 | 
|---|
| [ffc368] | 97 |     );
 | 
|---|
| [eb1efe] | 98 |     args[0].globalid = arguments.globalid;
 | 
|---|
| [ffc368] | 99 |     // jk
 | 
|---|
 | 100 |     args[1].distance = seconditer->distance(*iter);
 | 
|---|
 | 101 |     args[1].indices = std::make_pair(
 | 
|---|
| [eb1efe] | 102 |         std::distance(CurrentConfiguration.begin(), seconditer),
 | 
|---|
 | 103 |         std::distance(CurrentConfiguration.begin(), iter)
 | 
|---|
| [ffc368] | 104 |     );
 | 
|---|
| [eb1efe] | 105 |     args[1].globalid = arguments.globalid;
 | 
|---|
| [ffc368] | 106 |     result.push_back(args);
 | 
|---|
 | 107 |   }
 | 
|---|
 | 108 |   return result;
 | 
|---|
 | 109 | }
 | 
|---|
 | 110 | 
 | 
|---|
 | 111 | void ManyBodyPotential_TersoffTest::setUp()
 | 
|---|
 | 112 | {
 | 
|---|
 | 113 |   // failing asserts should be thrown
 | 
|---|
 | 114 |   ASSERT_DO(Assert::Throw);
 | 
|---|
 | 115 | 
 | 
|---|
 | 116 |   setVerbosity(10);
 | 
|---|
 | 117 | 
 | 
|---|
 | 118 |   // we use parameters from tremolo/defaults/tersoff/tersoff.potentials
 | 
|---|
 | 119 |   // [Tersoff, '89]
 | 
|---|
 | 120 |   params.resize(ManyBodyPotential_Tersoff::MAXPARAMS,0.);
 | 
|---|
| [752dc7] | 121 | //  params[ManyBodyPotential_Tersoff::R] = 1.800000e+00;
 | 
|---|
 | 122 | //  params[ManyBodyPotential_Tersoff::S] = 2.100000e+00;
 | 
|---|
| [ffc368] | 123 |   params[ManyBodyPotential_Tersoff::A] = 1.393600e+03;
 | 
|---|
 | 124 |   params[ManyBodyPotential_Tersoff::B] = 3.467000e+02;
 | 
|---|
 | 125 |   params[ManyBodyPotential_Tersoff::lambda] = 3.487900e+00;
 | 
|---|
 | 126 |   params[ManyBodyPotential_Tersoff::mu] = 2.211900e+00;
 | 
|---|
| [990a62] | 127 | //  params[ManyBodyPotential_Tersoff::lambda3] = 0.;
 | 
|---|
 | 128 | //  params[ManyBodyPotential_Tersoff::alpha] = 0.;
 | 
|---|
| [ffc368] | 129 |   params[ManyBodyPotential_Tersoff::beta] = 1.572400e-07;
 | 
|---|
| [990a62] | 130 | //  params[ManyBodyPotential_Tersoff::chi] = 1.;
 | 
|---|
 | 131 | //  params[ManyBodyPotential_Tersoff::omega] = 1.;
 | 
|---|
| [ffc368] | 132 |   params[ManyBodyPotential_Tersoff::n] = 7.275100e-01;
 | 
|---|
 | 133 |   params[ManyBodyPotential_Tersoff::c] = 3.804900e+04;
 | 
|---|
 | 134 |   params[ManyBodyPotential_Tersoff::d] = 4.384000e+00;
 | 
|---|
 | 135 |   params[ManyBodyPotential_Tersoff::h] = -5.705800e-01;
 | 
|---|
 | 136 | 
 | 
|---|
 | 137 |   // initial configuration as in tremolo/default/tersoff/tersoff.data with
 | 
|---|
 | 138 |   // Si renamed to C.
 | 
|---|
 | 139 |   // create test configurations of 5 C atoms, constructed via:
 | 
|---|
 | 140 |   // for file in tersoff.vis.00?0.xyz; do
 | 
|---|
 | 141 |   // echo -e "\t{\n\t\tconfiguration_t positions;\n\t\tpositions +="
 | 
|---|
 | 142 |   // tail -n 5 $file | awk -F " " {'print "\t\t\t\tVector("$2","$3","$4")"(NR!=5 ? "," : ";")'}
 | 
|---|
 | 143 |   // echo -e -n "\t}\n"
 | 
|---|
 | 144 |   // done
 | 
|---|
 | 145 |   {
 | 
|---|
 | 146 |     configuration_t positions;
 | 
|---|
 | 147 |     positions +=
 | 
|---|
 | 148 |         Vector(1.000000e+01,1.100000e+01,1.100000e+01),
 | 
|---|
 | 149 |         Vector(1.120000e+01,1.000000e+01,1.000000e+01),
 | 
|---|
 | 150 |         Vector(8.800000e+00,1.000000e+01,1.000000e+01),
 | 
|---|
 | 151 |         Vector(1.000000e+01,1.200000e+01,1.000000e+01),
 | 
|---|
 | 152 |         Vector(1.000000e+01,1.100000e+01,1.240000e+01);
 | 
|---|
 | 153 |     configurations.push_back(positions);
 | 
|---|
 | 154 |   }
 | 
|---|
 | 155 |   {
 | 
|---|
 | 156 |     configuration_t positions;
 | 
|---|
 | 157 |     positions +=
 | 
|---|
 | 158 |         Vector(1.000000e+01,1.099315e+01,1.099482e+01),
 | 
|---|
 | 159 |         Vector(1.119779e+01,1.000179e+01,1.000235e+01),
 | 
|---|
 | 160 |         Vector(8.802208e+00,1.000179e+01,1.000235e+01),
 | 
|---|
 | 161 |         Vector(1.000000e+01,1.200262e+01,9.999421e+00),
 | 
|---|
 | 162 |         Vector(1.000000e+01,1.100066e+01,1.240107e+01);
 | 
|---|
 | 163 |     configurations.push_back(positions);
 | 
|---|
 | 164 |   }
 | 
|---|
 | 165 |   {
 | 
|---|
 | 166 |     configuration_t positions;
 | 
|---|
 | 167 |     positions +=
 | 
|---|
 | 168 |         Vector(1.000000e+01,1.097354e+01,1.098018e+01),
 | 
|---|
 | 169 |         Vector(1.119164e+01,1.000675e+01,1.000902e+01),
 | 
|---|
 | 170 |         Vector(8.808358e+00,1.000675e+01,1.000902e+01),
 | 
|---|
 | 171 |         Vector(1.000000e+01,1.201036e+01,9.997816e+00),
 | 
|---|
 | 172 |         Vector(1.000000e+01,1.100260e+01,1.240397e+01);
 | 
|---|
 | 173 |     configurations.push_back(positions);
 | 
|---|
 | 174 |   }
 | 
|---|
 | 175 |   {
 | 
|---|
 | 176 |     configuration_t positions;
 | 
|---|
 | 177 |     positions +=
 | 
|---|
 | 178 |         Vector(1.000000e+01,1.094419e+01,1.095884e+01),
 | 
|---|
 | 179 |         Vector(1.118308e+01,1.001364e+01,1.001884e+01),
 | 
|---|
 | 180 |         Vector(8.816924e+00,1.001364e+01,1.001884e+01),
 | 
|---|
 | 181 |         Vector(1.000000e+01,1.202283e+01,9.995566e+00),
 | 
|---|
 | 182 |         Vector(1.000000e+01,1.100570e+01,1.240790e+01);
 | 
|---|
 | 183 |     configurations.push_back(positions);
 | 
|---|
 | 184 |   }
 | 
|---|
 | 185 |   {
 | 
|---|
 | 186 |     configuration_t positions;
 | 
|---|
 | 187 |     positions +=
 | 
|---|
 | 188 |         Vector(1.000000e+01,1.090791e+01,1.093293e+01),
 | 
|---|
 | 189 |         Vector(1.117318e+01,1.002158e+01,1.003102e+01),
 | 
|---|
 | 190 |         Vector(8.826818e+00,1.002158e+01,1.003102e+01),
 | 
|---|
 | 191 |         Vector(1.000000e+01,1.203924e+01,9.993210e+00),
 | 
|---|
 | 192 |         Vector(1.000000e+01,1.100969e+01,1.241182e+01);
 | 
|---|
 | 193 |     configurations.push_back(positions);
 | 
|---|
 | 194 |   }
 | 
|---|
 | 195 |   {
 | 
|---|
 | 196 |     configuration_t positions;
 | 
|---|
 | 197 |     positions +=
 | 
|---|
 | 198 |         Vector(1.000000e+01,1.086664e+01,1.090321e+01),
 | 
|---|
 | 199 |         Vector(1.116216e+01,1.003043e+01,1.004546e+01),
 | 
|---|
 | 200 |         Vector(8.837839e+00,1.003043e+01,1.004546e+01),
 | 
|---|
 | 201 |         Vector(1.000000e+01,1.205848e+01,9.991167e+00),
 | 
|---|
 | 202 |         Vector(1.000000e+01,1.101403e+01,1.241470e+01);
 | 
|---|
 | 203 |     configurations.push_back(positions);
 | 
|---|
 | 204 |   }
 | 
|---|
 | 205 |   {
 | 
|---|
 | 206 |     configuration_t positions;
 | 
|---|
 | 207 |     positions +=
 | 
|---|
 | 208 |         Vector(1.000000e+01,1.082297e+01,1.087033e+01),
 | 
|---|
 | 209 |         Vector(1.115036e+01,1.003997e+01,1.006213e+01),
 | 
|---|
 | 210 |         Vector(8.849644e+00,1.003997e+01,1.006213e+01),
 | 
|---|
 | 211 |         Vector(1.000000e+01,1.207923e+01,9.989652e+00),
 | 
|---|
 | 212 |         Vector(1.000000e+01,1.101786e+01,1.241577e+01);
 | 
|---|
 | 213 |     configurations.push_back(positions);
 | 
|---|
 | 214 |   }
 | 
|---|
 | 215 |   {
 | 
|---|
 | 216 |     configuration_t positions;
 | 
|---|
 | 217 |     positions +=
 | 
|---|
 | 218 |         Vector(1.000000e+01,1.077905e+01,1.083482e+01),
 | 
|---|
 | 219 |         Vector(1.113831e+01,1.004988e+01,1.008085e+01),
 | 
|---|
 | 220 |         Vector(8.861694e+00,1.004988e+01,1.008085e+01),
 | 
|---|
 | 221 |         Vector(1.000000e+01,1.210048e+01,9.989022e+00),
 | 
|---|
 | 222 |         Vector(1.000000e+01,1.102071e+01,1.241446e+01);
 | 
|---|
 | 223 |     configurations.push_back(positions);
 | 
|---|
 | 224 |   }
 | 
|---|
 | 225 |   {
 | 
|---|
 | 226 |     configuration_t positions;
 | 
|---|
 | 227 |     positions +=
 | 
|---|
 | 228 |         Vector(1.000000e+01,1.073683e+01,1.079745e+01),
 | 
|---|
 | 229 |         Vector(1.112678e+01,1.005973e+01,1.010129e+01),
 | 
|---|
 | 230 |         Vector(8.873218e+00,1.005973e+01,1.010129e+01),
 | 
|---|
 | 231 |         Vector(1.000000e+01,1.212139e+01,9.989594e+00),
 | 
|---|
 | 232 |         Vector(1.000000e+01,1.102232e+01,1.241038e+01);
 | 
|---|
 | 233 |     configurations.push_back(positions);
 | 
|---|
 | 234 |   }
 | 
|---|
 | 235 |   {
 | 
|---|
 | 236 |     configuration_t positions;
 | 
|---|
 | 237 |     positions +=
 | 
|---|
 | 238 |         Vector(1.000000e+01,1.069834e+01,1.075920e+01),
 | 
|---|
 | 239 |         Vector(1.111685e+01,1.006891e+01,1.012296e+01),
 | 
|---|
 | 240 |         Vector(8.883151e+00,1.006891e+01,1.012296e+01),
 | 
|---|
 | 241 |         Vector(1.000000e+01,1.214131e+01,9.991602e+00),
 | 
|---|
 | 242 |         Vector(1.000000e+01,1.102252e+01,1.240327e+01);
 | 
|---|
 | 243 |     configurations.push_back(positions);
 | 
|---|
 | 244 |   }
 | 
|---|
 | 245 | 
 | 
|---|
 | 246 |   // cut from tersoff.etot via:
 | 
|---|
 | 247 |   // for i in `seq 0 1 9`; do
 | 
|---|
 | 248 |   // grep $i.000000e-01 tersoff.etot | awk -F" " {'print "\t\t\t\t"$2","'}
 | 
|---|
 | 249 |   // done
 | 
|---|
 | 250 |   // (though timestep 0 is missing and is added manually)
 | 
|---|
 | 251 |   output +=
 | 
|---|
 | 252 |       -1.333927e+01,
 | 
|---|
 | 253 |       -1.359628e+01,
 | 
|---|
 | 254 |       -1.420701e+01,
 | 
|---|
 | 255 |       -1.479974e+01,
 | 
|---|
 | 256 |       -1.537942e+01,
 | 
|---|
 | 257 |       -1.584603e+01,
 | 
|---|
 | 258 |       -1.615832e+01,
 | 
|---|
 | 259 |       -1.630598e+01,
 | 
|---|
 | 260 |       -1.626654e+01,
 | 
|---|
 | 261 |       -1.603360e+01;
 | 
|---|
 | 262 | 
 | 
|---|
 | 263 |   CPPUNIT_ASSERT_EQUAL( output.size(), configurations.size() );
 | 
|---|
 | 264 | }
 | 
|---|
 | 265 | 
 | 
|---|
 | 266 | void ManyBodyPotential_TersoffTest::tearDown()
 | 
|---|
 | 267 | {
 | 
|---|
 | 268 |   configurations.clear();
 | 
|---|
 | 269 | }
 | 
|---|
 | 270 | 
 | 
|---|
 | 271 | /** UnitTest for operator()
 | 
|---|
 | 272 |  */
 | 
|---|
 | 273 | void ManyBodyPotential_TersoffTest::operatorTest()
 | 
|---|
 | 274 | {
 | 
|---|
 | 275 |   boost::function<
 | 
|---|
 | 276 |       std::vector<FunctionModel::arguments_t>(const argument_t &, const double)
 | 
|---|
 | 277 |     > fct =
 | 
|---|
 | 278 |       triplefunction;
 | 
|---|
 | 279 |   ManyBodyPotential_Tersoff tersoff(fct);
 | 
|---|
 | 280 |   tersoff.setParameters(params);
 | 
|---|
| [752dc7] | 281 |   const_cast<double &>(tersoff.R) = 1.8;
 | 
|---|
 | 282 |   const_cast<double &>(tersoff.S) = 2.1;
 | 
|---|
| [ffc368] | 283 |   for (size_t index = 0; index < configurations.size(); ++index) {
 | 
|---|
| [eb1efe] | 284 |     const configuration_t &CurrentConfiguration = configurations[index];
 | 
|---|
| [ffc368] | 285 |     double temp = 0.;
 | 
|---|
| [eb1efe] | 286 |     for (size_t i=0; i < CurrentConfiguration.size(); ++i)
 | 
|---|
 | 287 |       for (size_t j=0; j < CurrentConfiguration.size(); ++j) {
 | 
|---|
| [ffc368] | 288 |         if (i == j)
 | 
|---|
 | 289 |           continue;
 | 
|---|
 | 290 |         argument_t arg;
 | 
|---|
 | 291 |         arg.indices = std::make_pair(i,j);
 | 
|---|
| [eb1efe] | 292 |         arg.distance = CurrentConfiguration[i].distance(CurrentConfiguration[j]);
 | 
|---|
 | 293 |         arg.globalid = index; // this is needed for the triplefunction to the configuration
 | 
|---|
| [ffc368] | 294 |         FunctionModel::arguments_t args(1,arg);
 | 
|---|
 | 295 |         const ManyBodyPotential_Tersoff::results_t res = tersoff(args);
 | 
|---|
 | 296 |         temp += res[0];
 | 
|---|
 | 297 |       }
 | 
|---|
 | 298 |     // this little precision is because tremolo does seem to handle coordinates
 | 
|---|
 | 299 |     // a little differently than we do, the precise difference in the x coordinate
 | 
|---|
 | 300 |     // of the first and second position for the second configuration is easy to
 | 
|---|
 | 301 |     // see as 1.119779. However, tremolo obtains 1.1197792 for unknown reasons.
 | 
|---|
| [752dc7] | 302 |     // Maybe, there is some float floating around in the code ... see strtod() bugs
 | 
|---|
 | 303 | //    LOG(2, "Comparing " << output[index] << " and " << .5*temp);
 | 
|---|
| [ffc368] | 304 |     CPPUNIT_ASSERT(
 | 
|---|
 | 305 |         Helpers::isEqual(
 | 
|---|
 | 306 |             output[index],
 | 
|---|
 | 307 |             .5*temp,
 | 
|---|
 | 308 |             1.e-4/std::numeric_limits<double>::epsilon()
 | 
|---|
 | 309 |         )
 | 
|---|
 | 310 |     );
 | 
|---|
 | 311 |   }
 | 
|---|
 | 312 | }
 | 
|---|
 | 313 | 
 | 
|---|
 | 314 | /** UnitTest for derivative()
 | 
|---|
 | 315 |  */
 | 
|---|
 | 316 | void ManyBodyPotential_TersoffTest::derivativeTest()
 | 
|---|
 | 317 | {
 | 
|---|
 | 318 | //  boost::function<
 | 
|---|
 | 319 | //      std::vector<FunctionModel::arguments_t>(const argument_t &, const double)
 | 
|---|
 | 320 | //    > fct =
 | 
|---|
 | 321 | //      triplefunction;
 | 
|---|
 | 322 | //  ManyBodyPotential_Tersoff tersoff(fct);
 | 
|---|
 | 323 | //  tersoff.setParameters(params);
 | 
|---|
 | 324 | //  CPPUNIT_ASSERT(
 | 
|---|
 | 325 | //      Helpers::isEqual(
 | 
|---|
 | 326 | //          0.,
 | 
|---|
 | 327 | //          tersoff.derivative(
 | 
|---|
 | 328 | //              FunctionModel::arguments_t(1,argument_t(1.))
 | 
|---|
 | 329 | //          )[0]
 | 
|---|
 | 330 | //      )
 | 
|---|
 | 331 | //  );
 | 
|---|
 | 332 | }
 | 
|---|
 | 333 | 
 | 
|---|
 | 334 | 
 | 
|---|
 | 335 | /** UnitTest for parameter_derivative()
 | 
|---|
 | 336 |  */
 | 
|---|
 | 337 | void ManyBodyPotential_TersoffTest::parameter_derivativeTest()
 | 
|---|
 | 338 | {
 | 
|---|
 | 339 | //  boost::function<
 | 
|---|
 | 340 | //      std::vector<FunctionModel::arguments_t>(const argument_t &, const double)
 | 
|---|
 | 341 | //    > fct =
 | 
|---|
 | 342 | //      triplefunction;
 | 
|---|
 | 343 | //  ManyBodyPotential_Tersoff tersoff(fct);
 | 
|---|
 | 344 | //  tersoff.setParameters(params);
 | 
|---|
 | 345 | //  CPPUNIT_ASSERT(
 | 
|---|
 | 346 | //      Helpers::isEqual(
 | 
|---|
 | 347 | //          0.,
 | 
|---|
 | 348 | //          tersoff.parameter_derivative(
 | 
|---|
 | 349 | //              FunctionModel::arguments_t(1,argument_t(1.)),
 | 
|---|
 | 350 | //              0
 | 
|---|
 | 351 | //          )[0]
 | 
|---|
 | 352 | //      )
 | 
|---|
 | 353 | //  );
 | 
|---|
 | 354 | //  CPPUNIT_ASSERT(
 | 
|---|
 | 355 | //      Helpers::isEqual(
 | 
|---|
 | 356 | //          0.,
 | 
|---|
 | 357 | //          tersoff.parameter_derivative(
 | 
|---|
 | 358 | //              FunctionModel::arguments_t(1,argument_t(1.)),
 | 
|---|
 | 359 | //              1
 | 
|---|
 | 360 | //          )[0]
 | 
|---|
 | 361 | //      )
 | 
|---|
 | 362 | //  );
 | 
|---|
 | 363 | //  CPPUNIT_ASSERT(
 | 
|---|
 | 364 | //      Helpers::isEqual(
 | 
|---|
 | 365 | //          1.,
 | 
|---|
 | 366 | //          tersoff.parameter_derivative(
 | 
|---|
 | 367 | //              FunctionModel::arguments_t(1,argument_t(1.)),
 | 
|---|
 | 368 | //              2
 | 
|---|
 | 369 | //          )[0]
 | 
|---|
 | 370 | //      )
 | 
|---|
 | 371 | //  );
 | 
|---|
 | 372 | }
 | 
|---|