hremd
#
Perform Hamiltonian replica exchange sampling.
Modules:
-
femto
–A comprehensive toolkit for predicting free energies
Functions:
-
run_hremd
–Run a Hamiltonian replica exchange simulation.
run_hremd
#
run_hremd(
simulation: Simulation,
states: list[dict[str, float]],
config: HREMD,
output_dir: Path | None = None,
swap_mask: set[tuple[int, int]] | None = None,
force_groups: set[int] | int = -1,
initial_coords: list[State] | None = None,
analysis_fn: (
Callable[[int, ndarray, ndarray], None] | None
) = None,
analysis_interval: int | None = None,
) -> tuple[ndarray, ndarray, list[State]]
Run a Hamiltonian replica exchange simulation.
Parameters:
-
simulation
(Simulation
) –The main simulation object to sample using.
-
states
(list[dict[str, float]]
) –The states to sample at. This should be a dictionary with keys corresponding to global context parameters.
-
config
(HREMD
) –The sampling configuration.
-
output_dir
(Path | None
, default:None
) –The directory to store the sampled energies and statistics to, and any trajectory / checkpoint files if requested in the config. If
None
, no output of any kind will be written. -
swap_mask
(set[tuple[int, int]] | None
, default:None
) –Pairs of states that should not be swapped.
-
force_groups
(set[int] | int
, default:-1
) –The force groups to consider when computing the reduced potentials
-
initial_coords
(list[State] | None
, default:None
) –The initial coordinates of each state. If not provided, the coordinates will be taken from the simulation object.
-
analysis_fn
(Callable[[int, ndarray, ndarray], None] | None
, default:None
) –A function to call after every
analysis_interval
cycles. It should take as arguments the current cycle number, the reduced potentials withshape=(n_states, n_samples)
and the number of samples of each state withshape=(n_states,)
. -
analysis_interval
(int | None
, default:None
) –The interval with which to call the analysis function. If
None
, no analysis will be performed.
Returns:
-
tuple[ndarray, ndarray, list[State]]
–The reduced potentials, the number of samples of each state, and the final coordinates of each state.
Source code in femto/md/hremd.py
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 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 |
|