Skip to content

Latest commit

 

History

History
121 lines (97 loc) · 4.8 KB

README.md

File metadata and controls

121 lines (97 loc) · 4.8 KB

MultiState Iterative Boltzmann Inversion (MS-IBI)


pytest codecov Citing MSIBI

A package to help you manage and run coarse-grain potential optimizations using multistate iterative Boltzmann inversion.

Installing MSIBI

Install from conda-forge:

conda install -c conda-forge msibi

Install from source:

git clone https://github.com/cmelab/msibi.git
cd msibi
conda env create -f environment.yml
conda activate msibi
pip install .

Using MSIBI

The MSIBI package is designed to be very object oriented. Any force optimization runs requires at least one msibi.state.State instance, msibi.force.Force instance and msibi.optimize.MSIBI instance. More state and forces can be added as needed.

MSIBI uses Hoomd-Blue to run optimization simulations. It is not required that you be familiar with Hoomd to use MSIBI as the simulation script is automatically generated and ran. However, it is required that you pass in the choice of Hoomd method, Hoomd neighbor list, and Hoomd thermostat to the msibi.optimize.MSIBI instance.

Example: Single state, single force

  • Here is an example of learning a pair potential using a single state point with only one bead type.
import hoomd
from msibi import MSIBI, State, Pair 

optimizer = MSIBI(
	nlist=hoomd.md.nlist.Cell,
	integrator=hoomd.md.methods.ConstantVolume,
	thermostat=hoomd.md.methods.thermostats.MTTK,
	dt=0.0001,
	gsd_period=int(1e4)
)

# Create a State instance, pass in a path to the target trajectory
stateA = State(name="A", kT=2.0, traj_file="stateA.gsd", alpha=1.0, n_frames=50)
optimizer.add_state(stateA)

# Create a Pair instance to be optimized
pairAA = Pair(type1="A", type2="A", optimize=True, r_cut=3.0, nbins=100) 
# Call the set_lj() method to set an initial guess potential
pairAA.set_lj(r_min=0.001, r_cut=3.0, epsilon=1.0, sigma=1.0)
optimizer.add_force(pairAA)

# Run 20 MSIBI iterations
optimizer.run_optimization(n_steps=2e6, n_iterations=20)
pairAA.save_potential("AA_final.csv")

Example: Multiple states, multiple forces

  • Here is an example of learning a pair potential using multiple state points.
  • In this example, we set fixed bond and angle potentials which are assumed to have been learned from previous MSIBI runs.
import hoomd
from msibi import MSIBI, State, Pair, Bond, Angle 

optimizer = MSIBI(
	nlist=hoomd.md.nlist.Cell,
	integrator=hoomd.md.methods.ConstantVolume,
	thermostat=hoomd.md.methods.thermostats.MTTK,
	dt=0.0001,
	gsd_period=int(1e4)
)

# Create 3 State instances, pass in a path to the target trajectory
stateA = State(name="A", kT=2.0, traj_file="stateA.gsd", alpha=0.2, n_frames=50)
stateB = State(name="B", kT=4.0, traj_file="stateB.gsd", alpha=0.5, n_frames=50)
stateC = State(name="C", kT=6.0, traj_file="stateC.gsd", alpha=0.3, n_frames=50)
optimizer.add_state(stateA)
optimizer.add_state(stateB)
optimizer.add_state(stateC)

# Add bond and angle forces learned from previous MSIBI runs
bondAA = Bond(type1="A", type2="A", optimize=False)
bondAA.set_from_file("bondAA.csv")
optimize.add_force(bondAA)

angleAA = Angle(type1="A", type2="A", type3="A", optimize=False)
angleAA.set_from_file("angleAA.csv")
optimize.add_force(angleAA)

# Create a Pair instance to be optimized.
pairAA = Pair(type1="A", type2="A", optimize=True, r_cut=3.0, nbins=100) 
# Call the set_lj() method to set an initial guess potential
pairAA.set_lj(r_min=0.001, r_cut=3.0, epsilon=1.0, sigma=1.0)
optimizer.add_force(pairAA)

# Run 20 MSIBI iterations
optimizer.run_optimization(n_steps=2e6, n_iterations=20)
pairAA.save_potential("AA_final.csv")

Citing MSIBI

Details of the underlying method and its validation can be found here.

If you use this package, please cite the above paper. The BibTeX reference is

@article{Moore2014,
      author = "Moore, Timothy C. and Iacovella, Christopher R. and McCabe, Clare",
      title = "Derivation of coarse-grained potentials via multistate iterative Boltzmann inversion",
      journal = "The Journal of Chemical Physics",
      year = "2014",
      volume = "140",
      number = "22",
      doi = "http://dx.doi.org/10.1063/1.4880555"
}