1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712
|
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#include <BALL/CONCEPT/classTest.h>
#include <BALLTestConfig.h>
///////////////////////////
#include <BALL/MOLMEC/CHARMM/charmm.h>
#include <BALL/MOLMEC/CHARMM/charmmNonBonded.h>
#include <BALL/MOLMEC/CHARMM/charmmBend.h>
#include <BALL/MOLMEC/CHARMM/charmmStretch.h>
#include <BALL/MOLMEC/CHARMM/charmmTorsion.h>
#include <BALL/MOLMEC/CHARMM/charmmImproperTorsion.h>
#include <BALL/FORMAT/PDBFile.h>
#include <BALL/FORMAT/HINFile.h>
#include <BALL/STRUCTURE/defaultProcessors.h>
#include <BALL/STRUCTURE/fragmentDB.h>
///////////////////////////
START_TEST(CharmmFF)
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
using namespace BALL;
CharmmFF* charmm;
CHECK(CharmmFF())
charmm = new CharmmFF();
TEST_NOT_EQUAL(charmm, 0)
RESULT
CHECK(~CharmmFF())
delete charmm;
RESULT
CHECK(CharmmFF(const CharmmFF& force_field))
CharmmFF a1;
CharmmFF a2(a1);
RESULT
CHECK(specificSetup())
CharmmFF a;
a.specificSetup();
RESULT
FragmentDB frag_db("fragments/Fragments.db");
{
// read the PDB file containing a single GLY
PDBFile f(BALL_TEST_DATA_PATH(CharmmFF_test_1.pdb));
System s;
f >> s;
f.close();
// normalize the names and build the bonds
s.apply(frag_db.normalize_names);
s.apply(frag_db.build_bonds);
// setup the force field
Options options;
options[CharmmFF::Option::ASSIGN_CHARGES] = "true";
options[CharmmFF::Option::ASSIGN_TYPENAMES] = "true";
options[CharmmFF::Option::ASSIGN_TYPES] = "true";
options[CharmmFF::Option::FILENAME] = "CHARMM/EEF1/param19_eef1.ini";
CharmmFF eef1(s, options);
CHECK(energy test 1 (GLY) [EEF1])
// check whether we got the right number of atoms
TEST_EQUAL(s.countAtoms(), 8)
eef1.updateEnergy();
PRECISION(5e-3)
TEST_REAL_EQUAL(eef1.getEnergy(), 157.4572251)
TEST_REAL_EQUAL(eef1.getStretchEnergy(), 30.83411352)
TEST_REAL_EQUAL(eef1.getBendEnergy(), 307.4544619)
TEST_REAL_EQUAL(eef1.getProperTorsionEnergy(), 2.11036776)
TEST_REAL_EQUAL(eef1.getImproperTorsionEnergy(), 5.48237888)
TEST_REAL_EQUAL(eef1.getTorsionEnergy(), 7.59275)
TEST_REAL_EQUAL(eef1.getVdWEnergy(), 26.64563664)
TEST_REAL_EQUAL(eef1.getESEnergy(), -53.3215644)
TEST_REAL_EQUAL(eef1.getSolvationEnergy(), -161.7481263)
RESULT
CHECK(gradient test 1 (GLY) [EEF1])
eef1.updateForces();
PRECISION(5e-3)
TEST_REAL_EQUAL(eef1.getRMSGradient(), 219.2263702)
RESULT
CHECK(force test 1 (GLY, stretch only) [EEF1])
// remove all components except for stretches
eef1.removeComponent("CHARMM NonBonded");
eef1.removeComponent("CHARMM Torsion");
eef1.removeComponent("CHARMM ImproperTorsion");
eef1.removeComponent("CHARMM Bend");
eef1.options[CharmmFF::Option::FILENAME] = "CHARMM/EEF1/param19_eef1.ini";
eef1.setup(s, options);
eef1.updateForces();
eef1.updateEnergy();
TEST_REAL_EQUAL(eef1.getEnergy(), 30.83411352)
TEST_REAL_EQUAL(eef1.getBendEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getProperTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getImproperTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getStretchEnergy(), 30.83411352)
TEST_REAL_EQUAL(eef1.getESEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getVdWEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getSolvationEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getRMSGradient(), 134.2599576)
Size i = 0;
Vector3 force;
AtomIterator atom_it = s.beginAtom();
for (; +atom_it; ++atom_it, ++i)
{
switch (i)
{
// values are taken from CHARMM calculaction
// (version 27b1 with param19_eef1.inp and toph19_eef1.inp,
// with modified nonbonded: atom rdiel cutnb 20. cutonnb 11. cutofnb 15.)
case 0: force = Vector3( 26.44796, 91.42712, -23.82851); break;
case 1: force = Vector3( 14.55307, 1.84307, -19.22059); break;
case 2: force = Vector3(-14.56795, -89.42944, 62.77158); break;
case 3: force = Vector3(-16.84492, -12.50059, -5.06838); break;
case 4: force = Vector3( -8.71000, 3.45793, -15.72975); break;
case 5: force = Vector3( -1.06629, -17.55152, -0.53075); break;
case 6: force = Vector3( 19.60441, 12.80711, 11.19068); break;
case 7: force = Vector3(-19.41627, 9.94631, -9.58428);
}
force = force - atom_it->getForce() * Constants::NA * 1e-13 / -4.184;
TEST_REAL_EQUAL(force.getLength(), 0.0)
}
RESULT
}
{
// read the PDB file containing a single GLY
PDBFile f(BALL_TEST_DATA_PATH(CharmmFF_test_1.pdb));
System s;
f >> s;
f.close();
// normalize the names and build the bonds
s.apply(frag_db.normalize_names);
s.apply(frag_db.build_bonds);
// setup the force field
Options options;
options[CharmmFF::Option::ASSIGN_CHARGES] = "true";
options[CharmmFF::Option::ASSIGN_TYPENAMES] = "true";
options[CharmmFF::Option::ASSIGN_TYPES] = "true";
options[CharmmFF::Option::FILENAME] = "CHARMM/EEF1/param19_eef1.ini";
CharmmFF eef1(s, options);
CHECK(energy test 2 (GLY) [EEF1])
// check whether we got the right number of atoms
TEST_EQUAL(s.countAtoms(), 8)
eef1.updateEnergy();
PRECISION(5e-3)
TEST_REAL_EQUAL(eef1.getEnergy(), 157.4572251)
TEST_REAL_EQUAL(eef1.getStretchEnergy(), 30.83411352)
TEST_REAL_EQUAL(eef1.getBendEnergy(), 307.4544619)
TEST_REAL_EQUAL(eef1.getProperTorsionEnergy(), 2.11036776)
TEST_REAL_EQUAL(eef1.getImproperTorsionEnergy(), 5.48237888)
TEST_REAL_EQUAL(eef1.getTorsionEnergy(), 7.59275)
TEST_REAL_EQUAL(eef1.getVdWEnergy(), 26.64563664)
TEST_REAL_EQUAL(eef1.getESEnergy(), -53.3215644)
TEST_REAL_EQUAL(eef1.getSolvationEnergy(), -161.7481263)
RESULT
CHECK(multiple calls to setup)
eef1.setup(s, options);
RESULT
CHECK(energy test 3 (GLY) [EEF1])
// check whether we got the right number of atoms
TEST_EQUAL(s.countAtoms(), 8)
eef1.updateEnergy();
PRECISION(5e-3)
TEST_REAL_EQUAL(eef1.getEnergy(), 157.4572251)
TEST_REAL_EQUAL(eef1.getStretchEnergy(), 30.83411352)
TEST_REAL_EQUAL(eef1.getBendEnergy(), 307.4544619)
TEST_REAL_EQUAL(eef1.getProperTorsionEnergy(), 2.11036776)
TEST_REAL_EQUAL(eef1.getImproperTorsionEnergy(), 5.48237888)
TEST_REAL_EQUAL(eef1.getTorsionEnergy(), 7.59275)
TEST_REAL_EQUAL(eef1.getVdWEnergy(), 26.64563664)
TEST_REAL_EQUAL(eef1.getESEnergy(), -53.3215644)
TEST_REAL_EQUAL(eef1.getSolvationEnergy(), -161.7481263)
RESULT
CHECK(multiple calls to setup/2)
eef1.setup(s, options);
RESULT
CHECK(energy test 4 (GLY) [EEF1])
// check whether we got the right number of atoms
TEST_EQUAL(s.countAtoms(), 8)
eef1.updateEnergy();
PRECISION(5e-3)
TEST_REAL_EQUAL(eef1.getEnergy(), 157.4572251)
TEST_REAL_EQUAL(eef1.getStretchEnergy(), 30.83411352)
TEST_REAL_EQUAL(eef1.getBendEnergy(), 307.4544619)
TEST_REAL_EQUAL(eef1.getProperTorsionEnergy(), 2.11036776)
TEST_REAL_EQUAL(eef1.getImproperTorsionEnergy(), 5.48237888)
TEST_REAL_EQUAL(eef1.getTorsionEnergy(), 7.59275)
TEST_REAL_EQUAL(eef1.getVdWEnergy(), 26.64563664)
TEST_REAL_EQUAL(eef1.getESEnergy(), -53.3215644)
TEST_REAL_EQUAL(eef1.getSolvationEnergy(), -161.7481263)
RESULT
}
CHECK(force test 2 (GLY, bend only) [EEF1])
// read the PDB file containing a single GLY
PDBFile f(BALL_TEST_DATA_PATH(CharmmFF_test_1.pdb));
System s;
f >> s;
f.close();
// check whether we got the right number of atoms
TEST_EQUAL(s.countAtoms(), 8)
// normalize the names and build the bonds
s.apply(frag_db.normalize_names);
s.apply(frag_db.build_bonds);
CharmmFF eef1;
// remove all components excecpt for bends
eef1.removeComponent("CHARMM Torsion");
eef1.removeComponent("CHARMM ImproperTorsion");
eef1.removeComponent("CHARMM NonBonded");
eef1.removeComponent("CHARMM Stretch");
eef1.options[CharmmFF::Option::ASSIGN_CHARGES] = "true";
eef1.options[CharmmFF::Option::ASSIGN_TYPENAMES] = "true";
eef1.options[CharmmFF::Option::ASSIGN_TYPES] = "true";
eef1.options[CharmmFF::Option::FILENAME] = "CHARMM/EEF1/param19_eef1.ini";
eef1.setup(s);
eef1.updateForces();
eef1.updateEnergy();
TEST_REAL_EQUAL(eef1.getEnergy(), 307.4544619)
TEST_REAL_EQUAL(eef1.getBendEnergy(), 307.4544619)
TEST_REAL_EQUAL(eef1.getProperTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getImproperTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getStretchEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getESEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getVdWEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getSolvationEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getRMSGradient(), 123.0344948)
Size i = 0;
Vector3 force;
AtomIterator atom_it = s.beginAtom();
for (; +atom_it; ++atom_it, ++i)
{
switch (i)
{
// values are taken from CHARMM calculaction
// (version 27b1 with param19_eef1.inp and toph19_eef1.inp,
// with modified nonbonded: atom rdiel cutnb 20. cutonnb 11. cutofnb 15.)
case 0: force = Vector3( 32.09360, -8.83321, 1.72968); break;
case 1: force = Vector3( 0.27122, -7.58892, -0.52235); break;
case 2: force = Vector3(-21.60332, -81.70418, 44.97363); break;
case 3: force = Vector3(-33.70472, 65.80094, -50.27192); break;
case 4: force = Vector3( 24.59176, 32.71333, 3.56059); break;
case 5: force = Vector3( -4.89956, 20.53095, 2.43037); break;
case 6: force = Vector3( 6.60390, -11.26640, 1.32471); break;
case 7: force = Vector3( -3.35288, -9.65251, -3.22471);
}
force = force - atom_it->getForce() * Constants::NA * 1e-13 / -4.184;
TEST_REAL_EQUAL(force.getLength(), 0.0)
}
RESULT
CHECK(force test 3 (GLY, torsion only) [EEF1])
// read the PDB file containing a single GLY
PDBFile f(BALL_TEST_DATA_PATH(CharmmFF_test_1.pdb));
System s;
f >> s;
f.close();
// check whether we got the right number of atoms
TEST_EQUAL(s.countAtoms(), 8)
// normalize the names and build the bonds
s.apply(frag_db.normalize_names);
s.apply(frag_db.build_bonds);
CharmmFF eef1;
// remove all components excecpt for proper torsions
eef1.removeComponent("CHARMM Bend");
eef1.removeComponent("CHARMM ImproperTorsion");
eef1.removeComponent("CHARMM NonBonded");
eef1.removeComponent("CHARMM Stretch");
eef1.options[CharmmFF::Option::ASSIGN_CHARGES] = "true";
eef1.options[CharmmFF::Option::ASSIGN_TYPENAMES] = "true";
eef1.options[CharmmFF::Option::ASSIGN_TYPES] = "true";
eef1.options[CharmmFF::Option::FILENAME] = "CHARMM/EEF1/param19_eef1.ini";
eef1.setup(s);
eef1.updateForces();
eef1.updateEnergy();
TEST_REAL_EQUAL(eef1.getEnergy(), 2.11036776)
TEST_REAL_EQUAL(eef1.getBendEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getProperTorsionEnergy(), 2.11036776)
TEST_REAL_EQUAL(eef1.getImproperTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getTorsionEnergy(), 2.11036776)
TEST_REAL_EQUAL(eef1.getStretchEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getESEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getVdWEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getSolvationEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getRMSGradient(), 4.60127032)
Size i = 0;
Vector3 force;
AtomIterator atom_it = s.beginAtom();
for (; +atom_it; ++atom_it, ++i)
{
switch (i)
{
// values are taken from CHARMM calculaction
// (version 27b1 with param19_eef1.inp and toph19_eef1.inp,
// with modified nonbonded: atom rdiel cutnb 20. cutonnb 11. cutofnb 15.)
case 0: force = Vector3(-1.03592, 0.56305, 1.01054); break;
case 1: force = Vector3(-0.29165, -0.83152, -0.30056); break;
case 2: force = Vector3( 2.52092, 0.25830, -1.49679); break;
case 3: force = Vector3(-0.58905, 0.51427, 0.68932); break;
case 4: force = Vector3(-2.73842, -1.08243, 1.15208); break;
case 5: force = Vector3( 2.13412, 0.57834, -1.05459); break;
case 6: force = Vector3( 0.00000, 0.00000, 0.00000); break;
case 7: force = Vector3( 0.00000, 0.00000, 0.00000);
}
force = force - atom_it->getForce() * Constants::NA * 1e-13 / -4.184;
TEST_REAL_EQUAL(force.getLength(), 0.0)
}
RESULT
CHECK(force test 4 (GLY, improper torsion only) [EEF1])
// read the PDB file containing a single GLY
PDBFile f(BALL_TEST_DATA_PATH(CharmmFF_test_1.pdb));
System s;
f >> s;
f.close();
// check whether we got the right number of atoms
TEST_EQUAL(s.countAtoms(), 8)
// normalize the names and build the bonds
s.apply(frag_db.normalize_names);
s.apply(frag_db.build_bonds);
CharmmFF eef1;
// remove all components excecpt for proper torsions
eef1.removeComponent("CHARMM Bend");
eef1.removeComponent("CHARMM Torsion");
eef1.removeComponent("CHARMM NonBonded");
eef1.removeComponent("CHARMM Stretch");
eef1.options[CharmmFF::Option::ASSIGN_CHARGES] = "true";
eef1.options[CharmmFF::Option::ASSIGN_TYPENAMES] = "true";
eef1.options[CharmmFF::Option::ASSIGN_TYPES] = "true";
eef1.options[CharmmFF::Option::FILENAME] = "CHARMM/EEF1/param19_eef1.ini";
eef1.setup(s);
eef1.updateForces();
eef1.updateEnergy();
TEST_REAL_EQUAL(eef1.getEnergy(), 5.48237888)
TEST_REAL_EQUAL(eef1.getBendEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getProperTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getImproperTorsionEnergy(), 5.48237888)
TEST_REAL_EQUAL(eef1.getTorsionEnergy(), 5.48237888)
TEST_REAL_EQUAL(eef1.getStretchEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getESEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getVdWEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getSolvationEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getRMSGradient(), 31.6410816)
Size i = 0;
Vector3 force;
AtomIterator atom_it = s.beginAtom();
for (; +atom_it; ++atom_it, ++i)
{
switch (i)
{
// values are taken from CHARMM calculaction
// (version 27b1 with param19_eef1.inp and toph19_eef1.inp,
// with modified nonbonded: atom rdiel cutnb 20. cutonnb 11. cutofnb 15.)
case 0: force = Vector3( 0.00000, 0.00000, 0.00000); break;
case 1: force = Vector3( 0.00000, 0.00000, 0.00000); break;
case 2: force = Vector3( 0.00000, 0.00000, 0.00000); break;
case 3: force = Vector3( 0.00000, 0.00000, 0.00000); break;
case 4: force = Vector3( 4.98047, 2.50327, -6.64754); break;
case 5: force = Vector3(-16.96076, -8.20699, 25.84288); break;
case 6: force = Vector3( 5.27421, 2.34230, -10.15213); break;
case 7: force = Vector3( 6.70608, 3.36142, -9.04320);
}
force = force - atom_it->getForce() * Constants::NA * 1e-13 / -4.184;
TEST_REAL_EQUAL(force.getLength(), 0.0)
}
RESULT
CHECK(force test 5 (GLY, VdW only) [EEF1])
// read the PDB file containing a single GLY
PDBFile f(BALL_TEST_DATA_PATH(CharmmFF_test_1.pdb));
System s;
f >> s;
f.close();
// check whether we got the right number of atoms
TEST_EQUAL(s.countAtoms(), 8)
// normalize the names and build the bonds
s.apply(frag_db.normalize_names);
s.apply(frag_db.build_bonds);
CharmmFF eef1;
// remove all components excecpt for VdW
eef1.removeComponent("CHARMM Torsion");
eef1.removeComponent("CHARMM ImproperTorsion");
eef1.removeComponent("CHARMM Bend");
eef1.removeComponent("CHARMM Stretch");
eef1.options[CharmmFF::Option::USE_EEF1] = "false";
eef1.options[CharmmFF::Option::ASSIGN_CHARGES] = "true";
eef1.options[CharmmFF::Option::ASSIGN_TYPENAMES] = "true";
eef1.options[CharmmFF::Option::ASSIGN_TYPES] = "true";
eef1.options[CharmmFF::Option::FILENAME] = "CHARMM/EEF1/param19_eef1.ini";
eef1.setup(s);
ClearChargeProcessor clear_charges;
s.apply(clear_charges);
eef1.updateForces();
eef1.updateEnergy();
TEST_REAL_EQUAL(eef1.getEnergy(), 26.64563664)
TEST_REAL_EQUAL(eef1.getBendEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getProperTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getImproperTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getStretchEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getESEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getVdWEnergy(), 26.64563664)
TEST_REAL_EQUAL(eef1.getSolvationEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getRMSGradient(), 59.16799416)
Size i = 0;
Vector3 force;
AtomIterator atom_it = s.beginAtom();
for (; +atom_it; ++atom_it, ++i)
{
switch (i)
{
// values are taken from CHARMM calculaction
// (version 27b1 with param19_eef1.inp and toph19_eef1.inp,
// with modified nonbonded: atom rdiel cutnb 20. cutonnb 11. cutofnb 15.)
case 0: force = Vector3(-29.88574, 42.58230, -9.95883); break;
case 1: force = Vector3( 0.00347, -0.15351, 0.08606); break;
case 2: force = Vector3( 0.12799, 5.71407, -0.44357); break;
case 3: force = Vector3( 0.11338, -0.22339, 0.06770); break;
case 4: force = Vector3( 0.00000, 0.00000, 0.00000); break;
case 5: force = Vector3( 25.47118, -20.67960, 10.22273); break;
case 6: force = Vector3( 4.45634, -27.56737, 0.20325); break;
case 7: force = Vector3( -0.28662, 0.32750, -0.17734);
}
force = force - atom_it->getForce() * Constants::NA * 1e-13 / -4.184;
TEST_REAL_EQUAL(force.getLength(), 0.0)
}
RESULT
CHECK(force test 6 (2 atoms, electrostatic only) [EEF1/CDIEL])
// read the PDB file containing a single GLY
PDBFile f(BALL_TEST_DATA_PATH(CharmmFF_test_2.pdb));
System s;
f >> s;
f.close();
// check whether we got the right number of atoms
TEST_EQUAL(s.countAtoms(), 2)
// normalize the names and build the bonds
s.apply(frag_db.normalize_names);
CharmmFF eef1;
// remove all components excecpt for electrostatics
eef1.removeComponent("CHARMM Torsion");
eef1.removeComponent("CHARMM ImproperTorsion");
eef1.removeComponent("CHARMM Bend");
eef1.removeComponent("CHARMM Stretch");
eef1.options[CharmmFF::Option::USE_EEF1] = "false";
eef1.options[CharmmFF::Option::ASSIGN_CHARGES] = "true";
eef1.options[CharmmFF::Option::ASSIGN_TYPENAMES] = "true";
eef1.options[CharmmFF::Option::ASSIGN_TYPES] = "true";
eef1.options[CharmmFF::Option::DISTANCE_DEPENDENT_DIELECTRIC] = "false";
eef1.options[CharmmFF::Option::FILENAME] = "CHARMM/EEF1/param19_eef1.ini";
// turn off vdW interactions
eef1.options[CharmmFF::Option::VDW_CUTOFF] = 0.1;
eef1.options[CharmmFF::Option::VDW_CUTON] = 0.05;
eef1.setup(s);
eef1.updateForces();
eef1.updateEnergy();
TEST_REAL_EQUAL(eef1.getEnergy(), -910.321)
TEST_REAL_EQUAL(eef1.getBendEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getProperTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getImproperTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getStretchEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getESEnergy(), -910.321)
TEST_REAL_EQUAL(eef1.getVdWEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getSolvationEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getRMSGradient(), 212.569)
Size i = 0;
Vector3 force;
AtomIterator atom_it = s.beginAtom();
for (; +atom_it; ++atom_it, ++i)
{
force = atom_it->getForce() * Constants::NA * 1e-13;
TEST_REAL_EQUAL(force.getLength(), 368.181)
}
RESULT
CHECK(force test 7 (2 atoms, electrostatic only) [EEF1/RDIEL])
// read the PDB file containing a single GLY
PDBFile f(BALL_TEST_DATA_PATH(CharmmFF_test_2.pdb));
System s;
f >> s;
f.close();
// check whether we got the right number of atoms
TEST_EQUAL(s.countAtoms(), 2)
// normalize the names and build the bonds
s.apply(frag_db.normalize_names);
CharmmFF eef1;
// remove all components excecpt for electrostatics
eef1.removeComponent("CHARMM Torsion");
eef1.removeComponent("CHARMM ImproperTorsion");
eef1.removeComponent("CHARMM Bend");
eef1.removeComponent("CHARMM Stretch");
eef1.options[CharmmFF::Option::USE_EEF1] = "false";
eef1.options[CharmmFF::Option::ASSIGN_CHARGES] = "true";
eef1.options[CharmmFF::Option::ASSIGN_TYPENAMES] = "true";
eef1.options[CharmmFF::Option::ASSIGN_TYPES] = "true";
eef1.options[CharmmFF::Option::FILENAME] = "CHARMM/EEF1/param19_eef1.ini";
// turn off vdW interactions
eef1.options[CharmmFF::Option::VDW_CUTOFF] = 0.1;
eef1.options[CharmmFF::Option::VDW_CUTON] = 0.05;
eef1.options[CharmmFF::Option::DISTANCE_DEPENDENT_DIELECTRIC] = "true";
eef1.setup(s);
eef1.updateForces();
eef1.updateEnergy();
TEST_REAL_EQUAL(eef1.getEnergy(), -368.181)
TEST_REAL_EQUAL(eef1.getBendEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getProperTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getImproperTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getTorsionEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getStretchEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getESEnergy(), -368.181)
TEST_REAL_EQUAL(eef1.getVdWEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getSolvationEnergy(), 0.0)
TEST_REAL_EQUAL(eef1.getRMSGradient(), 171.948)
Size i = 0;
Vector3 force, a1, a2;
AtomIterator atom_it = s.beginAtom();
for (; +atom_it; ++atom_it, ++i)
{
force = atom_it->getForce() * Constants::NA * 1e-13;
TEST_REAL_EQUAL(force.getLength(), 297.823)
}
RESULT
CHECK(force test 8 (2 atoms, ES switching function) [EEF1/RDIEL])
// read the PDB file containing two atoms
PDBFile f(BALL_TEST_DATA_PATH(CharmmFF_test_2.pdb));
System s;
f >> s;
f.close();
// check whether we got the right number of atoms
TEST_EQUAL(s.countAtoms(), 2)
// normalize the names and build the bonds
s.apply(frag_db.normalize_names);
CharmmFF eef1;
// remove all components excecpt for electrostatics
eef1.removeComponent("CHARMM Torsion");
eef1.removeComponent("CHARMM ImproperTorsion");
eef1.removeComponent("CHARMM Bend");
eef1.removeComponent("CHARMM Stretch");
eef1.options[CharmmFF::Option::USE_EEF1] = "false";
eef1.options[CharmmFF::Option::ASSIGN_CHARGES] = "true";
eef1.options[CharmmFF::Option::ASSIGN_TYPENAMES] = "true";
eef1.options[CharmmFF::Option::ASSIGN_TYPES] = "true";
eef1.options[CharmmFF::Option::FILENAME] = "CHARMM/EEF1/param19_eef1.ini";
// turn off vdW interactions
eef1.options[CharmmFF::Option::VDW_CUTOFF] = 0.1;
eef1.options[CharmmFF::Option::VDW_CUTON] = 0.05;
eef1.options[CharmmFF::Option::ELECTROSTATIC_CUTON] = 2.0;
eef1.options[CharmmFF::Option::ELECTROSTATIC_CUTOFF] = 4.0;
eef1.options[CharmmFF::Option::DISTANCE_DEPENDENT_DIELECTRIC] = "true";
eef1.setup(s);
Size i = 0;
Vector3 force;
Atom* a1;
Atom* a2;
AtomIterator atom_it = s.beginAtom();
for (; +atom_it; ++atom_it, ++i)
{
switch (i)
{
case 0: a1 = &*atom_it; break;
case 1: a2 = &*atom_it; break;
}
}
TEST_NOT_EQUAL(a1, 0)
TEST_NOT_EQUAL(a2, 0)
// set one atom to the origin
a1->setPosition(Vector3(0.0));
i = 0;
for (double d = 1.2; d < 6.0; d += 0.2, i++)
{
a2->setPosition(Vector3(d, 0.0, 0.0));
eef1.updateForces();
double energy = eef1.updateEnergy();
double force = a1->getForce().x * Constants::NA / 1e13;
switch (i)
{
case 0:
TEST_REAL_EQUAL(force, 2605.04)
TEST_REAL_EQUAL(energy, -1563.02)
break;
case 1:
TEST_REAL_EQUAL(force, 1640.49)
TEST_REAL_EQUAL(energy, -1148.34)
break;
case 2:
TEST_REAL_EQUAL(force, 1099)
TEST_REAL_EQUAL(energy, -879.201)
break;
case 3:
TEST_REAL_EQUAL(force, 771.864)
TEST_REAL_EQUAL(energy, -694.677)
break;
case 4:
TEST_REAL_EQUAL(force, 562.688)
TEST_REAL_EQUAL(energy, -562.688)
break;
case 5:
TEST_REAL_EQUAL(force, 483.433)
TEST_REAL_EQUAL(energy, -458.515)
break;
case 6:
TEST_REAL_EQUAL(force, 424.043)
TEST_REAL_EQUAL(energy, -368.004)
break;
case 7:
TEST_REAL_EQUAL(force, 375.014)
TEST_REAL_EQUAL(energy, -288.214)
break;
case 8:
TEST_REAL_EQUAL(force, 330.421)
TEST_REAL_EQUAL(energy, -217.707)
break;
case 9:
TEST_REAL_EQUAL(force, 286.361)
TEST_REAL_EQUAL(energy, -156.013)
break;
case 10:
TEST_REAL_EQUAL(force, 240.127)
TEST_REAL_EQUAL(energy, -103.309)
break;
case 11:
TEST_REAL_EQUAL(force, 189.744)
TEST_REAL_EQUAL(energy, -60.2396)
break;
case 12:
TEST_REAL_EQUAL(force, 133.7)
TEST_REAL_EQUAL(energy, -27.7899)
break;
case 13:
TEST_REAL_EQUAL(force, 70.7883)
TEST_REAL_EQUAL(energy, -7.21769)
break;
default: // above cutoff -> everything equals zero
TEST_REAL_EQUAL(force, 0.0)
TEST_REAL_EQUAL(energy, 0.0)
}
}
RESULT
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
END_TEST
|