Skip to content
Merged
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
14 changes: 14 additions & 0 deletions amorphouspy/src/amorphouspy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
cte_from_npt_fluctuations,
cte_from_volume_temperature_data,
)
from amorphouspy.properties.diffusion import (
compute_msd,
diffusion_simulation,
fit_arrhenius,
get_diffusion,
log_linear_dump_steps,
save_frames,
)
from amorphouspy.properties.elastic import elastic_simulation
from amorphouspy.properties.structural.all import (
analyze_structure,
Expand Down Expand Up @@ -63,6 +71,7 @@
"compute_cavities",
"compute_coordination",
"compute_guttmann_rings",
"compute_msd",
"compute_network_connectivity",
"compute_projected_rdf",
"compute_qn",
Expand All @@ -74,10 +83,12 @@
"cte_from_fluctuations_simulation",
"cte_from_npt_fluctuations",
"cte_from_volume_temperature_data",
"diffusion_simulation",
"elastic_simulation",
"extract_composition",
"extract_equilibration_frames",
"find_rdf_minimum",
"fit_arrhenius",
"fit_vft",
"formula_mass_g_per_mol",
"frames_from_melt_quench_result",
Expand All @@ -87,11 +98,13 @@
"get_ase_structure",
"get_atomic_mass",
"get_composition",
"get_diffusion",
"get_glass_density_from_model",
"get_neighbors",
"get_structure_dict",
"get_viscosity",
"load_lammps_dump",
"log_linear_dump_steps",
"md_simulation",
"melt_quench_simulation",
"parse_formula",
Expand All @@ -100,6 +113,7 @@
"run_melt_quench",
"run_structural_analysis",
"running_mean",
"save_frames",
"structure_from_parsed_output",
"temperature_scan_simulation",
"type_to_dict",
Expand Down
19 changes: 12 additions & 7 deletions amorphouspy/src/amorphouspy/lammps/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,18 @@ def frames_from_melt_quench_result(
atoms.set_velocities(stage_data["velocities"][i])
if "indices" in stage_data:
atoms.set_array("indices", stage_data["indices"][i])
atoms.info["temperature"] = stage_data["temperature"][i]
atoms.info["energy_pot"] = stage_data["energy_pot"][i]
atoms.info["energy_tot"] = stage_data["energy_tot"][i]
atoms.info["volume"] = stage_data["volume"][i]
atoms.info["pressure"] = stage_data["pressures"][i]
if "steps" in stage_data and i < len(stage_data["steps"]):
atoms.info["step"] = stage_data["steps"][i]
# Thermo-derived scalars are logged on a separate (thermo) cadence, so they can be shorter than
# the per-frame dump arrays (e.g. with a log-spaced dump schedule); guard each access.
for info_key, data_key in (
("temperature", "temperature"),
("energy_pot", "energy_pot"),
("energy_tot", "energy_tot"),
("volume", "volume"),
("pressure", "pressures"),
("step", "steps"),
):
if data_key in stage_data and i < len(stage_data[data_key]):
atoms.info[info_key] = stage_data[data_key][i]
if "forces" in stage_data:
atoms.arrays["forces"] = stage_data["forces"][i]
if "unwrapped_positions" in stage_data:
Expand Down
4 changes: 4 additions & 0 deletions amorphouspy/src/amorphouspy/lammps/md.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def md_simulation(
langevin: bool = False,
seed: int = 12345,
tmp_working_directory: str | Path | None = None,
input_control_file: dict | None = None,
) -> dict: # pylint: disable=too-many-positional-arguments
"""Perform a molecular dynamics simulation using LAMMPS.

Expand Down Expand Up @@ -56,6 +57,8 @@ def md_simulation(
With the specification of tmp_working_directory, the temporary directory is created in the specified
location. Therefore, tmp_working_directory needs to exist beforehand. Data will be cleaned after the
simulation is finished.
input_control_file: Optional LAMMPS input overrides merged on top of the
default generated controls.

Returns:
A dictionary containing the simulation steps and temperature data.
Expand All @@ -80,6 +83,7 @@ def md_simulation(
langevin=langevin,
seed=seed,
server_kwargs=server_kwargs,
input_control_file=input_control_file,
)

result = parsed_output.get("generic", None)
Expand Down
Loading
Loading