Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kT to validation #99

Draft
wants to merge 4 commits into
base: trunk-major
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hoomd_validation/hard_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def run_npt_sim(job, device):

# box updates
boxmc = hoomd.hpmc.update.BoxMC(
betaP=job.cached_statepoint['pressure'], trigger=hoomd.trigger.Periodic(1)
P=job.cached_statepoint['pressure'], trigger=hoomd.trigger.Periodic(1)
)
boxmc.volume = dict(weight=1.0, mode='ln', delta=1e-6)

Expand Down
2 changes: 1 addition & 1 deletion hoomd_validation/hard_sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def run_npt_sim(job, device):
initial_state = job.fn('initial_state.gsd')
# box updates
boxmc = hoomd.hpmc.update.BoxMC(
betaP=job.cached_statepoint['pressure'], trigger=hoomd.trigger.Periodic(1)
P=job.cached_statepoint['pressure'], trigger=hoomd.trigger.Periodic(1)
)
boxmc.volume = dict(weight=1.0, mode='ln', delta=1e-6)

Expand Down
18 changes: 7 additions & 11 deletions hoomd_validation/lj_fluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,11 +487,11 @@ def make_mc_simulation(job, device, initial_state, sim_mode, extra_loggables=Non
extra_loggables = []

# integrator
mc = hoomd.hpmc.integrate.Sphere(nselect=1)
mc = hoomd.hpmc.integrate.Sphere(nselect=1, kT=job.cached_statepoint['kT'])
mc.shape['A'] = dict(diameter=0.0)

# pair potential
epsilon = LJ_PARAMS['epsilon'] / job.cached_statepoint['kT'] # noqa F841
epsilon = LJ_PARAMS['epsilon'] # noqa F841
sigma = LJ_PARAMS['sigma']
r_on = job.cached_statepoint['r_on']
r_cut = job.cached_statepoint['r_cut']
Expand Down Expand Up @@ -659,7 +659,7 @@ def run_npt_mc_sim(job, device):

# box updates
boxmc = hoomd.hpmc.update.BoxMC(
betaP=job.cached_statepoint['pressure'] / job.cached_statepoint['kT'],
P=job.cached_statepoint['pressure'],
trigger=hoomd.trigger.Periodic(1),
)
boxmc.volume = dict(weight=1.0, mode='ln', delta=0.01)
Expand Down Expand Up @@ -861,10 +861,9 @@ def analyze(*jobs):
'hoomd-data/md/compute/ThermodynamicQuantities/potential_energy'
]
else:
energies[sim_mode] = (
log_traj['hoomd-data/hpmc/pair/LennardJones/energy']
* job.cached_statepoint['kT']
)
energies[sim_mode] = log_traj[
'hoomd-data/hpmc/pair/LennardJones/energy'
]

energies[sim_mode] /= job.cached_statepoint['num_particles']

Expand Down Expand Up @@ -1186,10 +1185,7 @@ def distribution_analyze(*jobs):
)
else:
potential_energy_samples[sim_mode].extend(
list(
log_traj['hoomd-data/hpmc/pair/LennardJones/energy']
* job.cached_statepoint['kT']
)
list(log_traj['hoomd-data/hpmc/pair/LennardJones/energy'])
)

if 'md' in sim_mode:
Expand Down
12 changes: 4 additions & 8 deletions hoomd_validation/lj_union.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,14 +517,14 @@ def make_mc_simulation(job, device, initial_state, sim_mode, extra_loggables=Non
extra_loggables = []

# integrator
mc = hoomd.hpmc.integrate.Sphere(nselect=1)
mc = hoomd.hpmc.integrate.Sphere(nselect=1, kT=job.cached_statepoint['kT'])
mc.shape['A'] = dict(diameter=0.0)
mc.shape['R'] = dict(diameter=0.0, orientable=True)

# pair potential
lennard_jones = hoomd.hpmc.pair.LennardJones()
lennard_jones.params[('A', 'A')] = dict(
epsilon=LJ_PARAMS['epsilon'] / job.cached_statepoint['kT'],
epsilon=LJ_PARAMS['epsilon'],
sigma=LJ_PARAMS['sigma'],
r_on=LJ_PARAMS['r_on'],
r_cut=LJ_PARAMS['r_cut'],
Expand Down Expand Up @@ -691,7 +691,7 @@ def run_npt_mc_sim(job, device):

# box updates
boxmc = hoomd.hpmc.update.BoxMC(
betaP=job.cached_statepoint['pressure'] / job.cached_statepoint['kT'],
P=job.cached_statepoint['pressure'],
trigger=hoomd.trigger.Periodic(1),
)
boxmc.volume = dict(weight=1.0, mode='ln', delta=0.01)
Expand Down Expand Up @@ -905,10 +905,7 @@ def analyze(*jobs):
'hoomd-data/md/compute/ThermodynamicQuantities/potential_energy'
]
else:
energies[sim_mode] = (
log_traj['hoomd-data/hpmc/pair/Union/energy']
* job.cached_statepoint['kT']
)
energies[sim_mode] = log_traj['hoomd-data/hpmc/pair/Union/energy']

energies[sim_mode] /= job.cached_statepoint['num_particles']

Expand Down Expand Up @@ -1236,7 +1233,6 @@ def distribution_analyze(*jobs):
else:
potential_energy_samples[sim_mode].extend(
log_traj['hoomd-data/hpmc/pair/Union/energy']
* job.cached_statepoint['kT']
)

if 'md' in sim_mode:
Expand Down
21 changes: 10 additions & 11 deletions hoomd_validation/patchy_particle_pressure.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def job_statepoints():


def make_potential(
delta_rad, sq_well_lambda, sigma, kT, long_range_interaction_scale_factor
delta_rad, sq_well_lambda, sigma, long_range_interaction_scale_factor
):
"""Make the Kern-Frenkel pair potential.

Expand All @@ -129,8 +129,8 @@ def make_potential(
sq_well_lambda * sigma,
]
epsilon = [
-1 / kT,
-1 / kT * long_range_interaction_scale_factor,
-1,
-1 * long_range_interaction_scale_factor,
]
step = hoomd.hpmc.pair.Step()
step.params[('A', 'A')] = dict(epsilon=epsilon, r=r)
Expand Down Expand Up @@ -188,15 +188,14 @@ def create_initial_state(*jobs):

# Use hard sphere + patches Monte Carlo to randomize the initial
# configuration
mc = hoomd.hpmc.integrate.Sphere(default_d=0.05, default_a=0.1)
mc = hoomd.hpmc.integrate.Sphere(default_d=0.05, default_a=0.1, kT=temperature)
diameter = 1.0
mc.shape['A'] = dict(diameter=diameter, orientable=True)
delta = 2 * numpy.arcsin(numpy.sqrt(chi))
angular_step = make_potential(
delta,
lambda_,
diameter,
temperature,
long_range_interaction_scale_factor,
)
mc.pair_potentials = [angular_step]
Expand Down Expand Up @@ -267,14 +266,13 @@ def make_mc_simulation(job, device, initial_state, sim_mode, extra_loggables=Non
'long_range_interaction_scale_factor'
]
diameter = 1.0
mc = hoomd.hpmc.integrate.Sphere(default_d=0.05, default_a=0.1)
mc = hoomd.hpmc.integrate.Sphere(default_d=0.05, default_a=0.1, kT=temperature)
mc.shape['A'] = dict(diameter=diameter, orientable=True)
delta = 2 * numpy.arcsin(numpy.sqrt(chi))
angular_step = make_potential(
delta,
lambda_,
diameter,
temperature,
long_range_interaction_scale_factor,
)
mc.pair_potentials = [angular_step]
Expand All @@ -285,7 +283,7 @@ def make_mc_simulation(job, device, initial_state, sim_mode, extra_loggables=Non

logger = hoomd.logging.Logger(categories=['scalar', 'sequence'])
logger.add(mc, quantities=['translate_moves'])
logger.add(sdf, quantities=['betaP'])
logger.add(sdf, quantities=['P'])
logger.add(compute_density, quantities=['density'])
logger.add(angular_step, quantities=['energy'])
for loggable, quantity in extra_loggables:
Expand Down Expand Up @@ -433,7 +431,8 @@ def run_npt_sim(job, device):

# box updates
boxmc = hoomd.hpmc.update.BoxMC(
betaP=job.cached_statepoint['pressure'], trigger=hoomd.trigger.Periodic(1)
P=job.cached_statepoint['pressure'] * job.cached_statepoint['temperature'],
trigger=hoomd.trigger.Periodic(1),
)
boxmc.volume = dict(weight=1.0, mode='ln', delta=1e-6)

Expand Down Expand Up @@ -622,7 +621,7 @@ def analyze(*jobs):

timesteps[sim_mode] = log_traj['hoomd-data/Simulation/timestep']

pressures[sim_mode] = log_traj['hoomd-data/hpmc/compute/SDF/betaP']
pressures[sim_mode] = log_traj['hoomd-data/hpmc/compute/SDF/P']

densities[sim_mode] = log_traj[
'hoomd-data/custom_actions/ComputeDensity/density'
Expand Down Expand Up @@ -663,7 +662,7 @@ def analyze(*jobs):
ax=ax,
timesteps=timesteps,
data=pressures,
ylabel=r'$\beta P$',
ylabel=r'$\P$',
expected=job.cached_statepoint['pressure'],
max_points=500,
)
Expand Down
2 changes: 1 addition & 1 deletion hoomd_validation/simple_polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def run_npt_sim(job, device):

# box updates
boxmc = hoomd.hpmc.update.BoxMC(
betaP=job.cached_statepoint['pressure'], trigger=hoomd.trigger.Periodic(1)
P=job.cached_statepoint['pressure'], trigger=hoomd.trigger.Periodic(1)
)
boxmc.volume = dict(weight=1.0, mode='ln', delta=1e-6)

Expand Down