-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from chrisiacovella/reduced-potential-update
Reduced potential update
- Loading branch information
Showing
6 changed files
with
229 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from openmmtools.testsystems import LennardJonesFluid | ||
|
||
# Use the LennardJonesFluid example from openmmtools to initialize particle positions and topology | ||
# For this example, the topology provides the masses for the particles | ||
# The default LennardJonesFluid example considers the system to be Argon with 39.9 amu | ||
lj_fluid = LennardJonesFluid(reduced_density=0.1, nparticles=1000) | ||
|
||
|
||
from chiron.potential import LJPotential | ||
from openmm import unit | ||
|
||
# initialize the LennardJones potential in chiron | ||
# | ||
sigma = 0.34 * unit.nanometer | ||
epsilon = 0.238 * unit.kilocalories_per_mole | ||
cutoff = 3.0 * sigma | ||
|
||
lj_potential = LJPotential( | ||
lj_fluid.topology, sigma=sigma, epsilon=epsilon, cutoff=cutoff | ||
) | ||
|
||
from chiron.states import SamplerState, ThermodynamicState | ||
|
||
# define the sampler state | ||
sampler_state = SamplerState( | ||
x0=lj_fluid.positions, box_vectors=lj_fluid.system.getDefaultPeriodicBoxVectors() | ||
) | ||
|
||
# define the thermodynamic state | ||
thermodynamic_state = ThermodynamicState( | ||
potential=lj_potential, temperature=300 * unit.kelvin | ||
) | ||
|
||
from chiron.neighbors import NeighborListNsqrd, OrthogonalPeriodicSpace | ||
|
||
# define the neighbor list for an orthogonal periodic space | ||
skin = 0.5 * unit.nanometer | ||
|
||
nbr_list = NeighborListNsqrd( | ||
OrthogonalPeriodicSpace(), cutoff=cutoff, skin=skin, n_max_neighbors=180 | ||
) | ||
from chiron.neighbors import PairList | ||
|
||
|
||
# build the neighbor list from the sampler state | ||
nbr_list.build_from_state(sampler_state) | ||
|
||
from chiron.reporters import SimulationReporter | ||
|
||
# initialize a reporter to save the simulation data | ||
filename = "test_lj.h5" | ||
import os | ||
|
||
if os.path.isfile(filename): | ||
os.remove(filename) | ||
reporter = SimulationReporter("test_mc_lj.h5", lj_fluid.topology, 1) | ||
|
||
from chiron.mcmc import MetropolisDisplacementMove | ||
|
||
mc_move = MetropolisDisplacementMove( | ||
seed=1234, | ||
displacement_sigma=0.01 * unit.nanometer, | ||
nr_of_moves=1000, | ||
simulation_reporter=reporter, | ||
) | ||
|
||
mc_move.run(sampler_state, thermodynamic_state, nbr_list, True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.