-
Notifications
You must be signed in to change notification settings - Fork 4
Melting: Stacked pull request #635
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
base: main
Are you sure you want to change the base?
Changes from all commits
3db6bce
c73c68b
754bb5c
4e34260
7228f4b
5f5d5ff
98d66f5
396d06c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,4 @@ dependencies: | |
| - iprpy-data =2023.07.25 | ||
| - dynaphopy =1.18.0 | ||
| - lammpsparser =0.0.1 | ||
| - pyscal3 = 3.3.1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING | ||
| from typing import TYPE_CHECKING, Optional | ||
|
|
||
| import numpy as np | ||
| import pandas | ||
|
|
@@ -49,11 +49,12 @@ def optimize_positions_and_volume_with_lammpslib( | |
| maxiter: int = 100000, | ||
| maxeval: int = 10000000, | ||
| thermo: int = 10, | ||
| vmax: Optional[float] = None, | ||
| lmp=None, | ||
| **kwargs, | ||
| ) -> Atoms: | ||
| template_str = ( | ||
| LAMMPS_MINIMIZE_VOLUME | ||
| _get_vmax_command(vmax=vmax) | ||
| + "\n" | ||
| + LAMMPS_THERMO_STYLE | ||
| + "\n" | ||
|
|
@@ -154,12 +155,12 @@ def calc_molecular_dynamics_nvt_with_lammpslib( | |
| timestep: float = 0.001, | ||
| seed: int = 4928459, | ||
| dist: str = "gaussian", | ||
| disable_initial_velocity: bool = False, | ||
| velocity_rescale_factor: Optional[float] = 2.0, | ||
| lmp=None, | ||
| output_keys=OutputMolecularDynamics.keys(), | ||
| **kwargs, | ||
| ) -> dict: | ||
| if not disable_initial_velocity: | ||
| if velocity_rescale_factor is not None: | ||
| init_str = ( | ||
| LAMMPS_THERMO_STYLE | ||
| + "\n" | ||
|
|
@@ -180,6 +181,7 @@ def calc_molecular_dynamics_nvt_with_lammpslib( | |
| timestep=timestep, | ||
| seed=seed, | ||
| dist=dist, | ||
| velocity_rescale_factor=velocity_rescale_factor, | ||
| ) | ||
| else: | ||
| init_str = ( | ||
|
|
@@ -232,12 +234,17 @@ def calc_molecular_dynamics_npt_with_lammpslib( | |
| Pdamp: float = 1.0, | ||
| seed: int = 4928459, | ||
| dist: str = "gaussian", | ||
| disable_initial_velocity: bool = False, | ||
| velocity_rescale_factor: Optional[float] = 2.0, | ||
| couple_xyz: bool = False, | ||
| lmp=None, | ||
| output_keys=OutputMolecularDynamics.keys(), | ||
| **kwargs, | ||
| ) -> dict: | ||
| if not disable_initial_velocity: | ||
| if couple_xyz: | ||
| LAMMPS_ENSEMBLE_NPT_XYZ = LAMMPS_ENSEMBLE_NPT + " couple xyz" | ||
| else: | ||
| LAMMPS_ENSEMBLE_NPT_XYZ = LAMMPS_ENSEMBLE_NPT | ||
| if velocity_rescale_factor is not None: | ||
| init_str = ( | ||
| LAMMPS_THERMO_STYLE | ||
| + "\n" | ||
|
|
@@ -247,7 +254,7 @@ def calc_molecular_dynamics_npt_with_lammpslib( | |
| + "\n" | ||
| + LAMMPS_VELOCITY | ||
| + "\n" | ||
| + LAMMPS_ENSEMBLE_NPT | ||
| + LAMMPS_ENSEMBLE_NPT_XYZ | ||
| ) | ||
| input_template = Template(init_str).render( | ||
| thermo=thermo, | ||
|
|
@@ -261,6 +268,7 @@ def calc_molecular_dynamics_npt_with_lammpslib( | |
| timestep=timestep, | ||
| seed=seed, | ||
| dist=dist, | ||
| velocity_rescale_factor=velocity_rescale_factor, | ||
| ) | ||
| else: | ||
| init_str = ( | ||
|
|
@@ -270,7 +278,7 @@ def calc_molecular_dynamics_npt_with_lammpslib( | |
| + "\n" | ||
| + LAMMPS_THERMO | ||
| + "\n" | ||
| + LAMMPS_ENSEMBLE_NPT | ||
| + LAMMPS_ENSEMBLE_NPT_XYZ | ||
| ) | ||
| input_template = Template(init_str).render( | ||
| thermo=thermo, | ||
|
|
@@ -314,12 +322,12 @@ def calc_molecular_dynamics_nph_with_lammpslib( | |
| Pdamp: float = 1.0, | ||
| seed: int = 4928459, | ||
| dist: str = "gaussian", | ||
| disable_initial_velocity: bool = False, | ||
| velocity_rescale_factor: Optional[float] = 2.0, | ||
| lmp=None, | ||
| output_keys=OutputMolecularDynamics.keys(), | ||
| **kwargs, | ||
| ) -> dict: | ||
| if not disable_initial_velocity: | ||
| if velocity_rescale_factor is not None: | ||
| init_str = ( | ||
| LAMMPS_THERMO_STYLE | ||
| + "\n" | ||
|
|
@@ -340,6 +348,7 @@ def calc_molecular_dynamics_nph_with_lammpslib( | |
| timestep=timestep, | ||
| seed=seed, | ||
| dist=dist, | ||
| velocity_rescale_factor=velocity_rescale_factor, | ||
| ) | ||
| else: | ||
| init_str = ( | ||
|
|
@@ -389,12 +398,12 @@ def calc_molecular_dynamics_langevin_with_lammpslib( | |
| Tdamp: float = 0.1, | ||
| seed: int = 4928459, | ||
| dist: str = "gaussian", | ||
| disable_initial_velocity: bool = False, | ||
| velocity_rescale_factor: Optional[float] = 2.0, | ||
| lmp=None, | ||
| output_keys=OutputMolecularDynamics.keys(), | ||
| **kwargs, | ||
| ): | ||
| if not disable_initial_velocity: | ||
| if velocity_rescale_factor is not None: | ||
| init_str = ( | ||
| LAMMPS_THERMO_STYLE | ||
| + "\n" | ||
|
|
@@ -417,6 +426,7 @@ def calc_molecular_dynamics_langevin_with_lammpslib( | |
| timestep=timestep, | ||
| seed=seed, | ||
| dist=dist, | ||
| velocity_rescale_factor=velocity_rescale_factor, | ||
| ) | ||
| else: | ||
| init_str = ( | ||
|
|
@@ -473,6 +483,7 @@ def calc_molecular_dynamics_thermal_expansion_with_lammpslib( | |
| Pdamp: float = 1.0, | ||
| seed: int = 4928459, | ||
| dist: str = "gaussian", | ||
| couple_xyz: bool = False, | ||
| lmp=None, | ||
| output_keys=OutputThermalExpansion.keys(), | ||
| **kwargs, | ||
|
|
@@ -487,7 +498,11 @@ def calc_molecular_dynamics_thermal_expansion_with_lammpslib( | |
| + LAMMPS_VELOCITY | ||
| + "\n" | ||
| ) | ||
| run_str = LAMMPS_ENSEMBLE_NPT + "\n" + LAMMPS_RUN | ||
| if couple_xyz: | ||
| LAMMPS_ENSEMBLE_NPT_XYZ = LAMMPS_ENSEMBLE_NPT + " couple xyz" | ||
| else: | ||
| LAMMPS_ENSEMBLE_NPT_XYZ = LAMMPS_ENSEMBLE_NPT | ||
| run_str = LAMMPS_ENSEMBLE_NPT_XYZ + "\n" + LAMMPS_RUN | ||
| temperature_lst = np.arange(Tstart, Tstop + Tstep, Tstep).tolist() | ||
| return lammps_thermal_expansion_loop( | ||
| structure=structure, | ||
|
|
@@ -593,3 +608,13 @@ def evaluate_with_lammpslib( | |
| ) | ||
| lmp.close() | ||
| return results_dict | ||
|
|
||
|
|
||
| def _get_vmax_command(vmax: Optional[float]) -> str: | ||
| if vmax is not None: | ||
| if isinstance(vmax, float): | ||
| return LAMMPS_MINIMIZE_VOLUME + " vmax {vmax}".format(vmax=vmax) | ||
| else: | ||
| raise TypeError("vmax must be a float.") | ||
| else: | ||
| return LAMMPS_MINIMIZE_VOLUME | ||
|
Comment on lines
+613
to
+620
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Type check is too restrictive - rejects valid integer inputs. The 🐛 Proposed fix to accept both int and float def _get_vmax_command(vmax: Optional[float]) -> str:
if vmax is not None:
- if isinstance(vmax, float):
+ if isinstance(vmax, (int, float)):
return LAMMPS_MINIMIZE_VOLUME + " vmax {vmax}".format(vmax=vmax)
else:
- raise TypeError("vmax must be a float.")
+ raise TypeError("vmax must be a numeric value (int or float).")
else:
return LAMMPS_MINIMIZE_VOLUME🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
What is the latest version of pyscal3 Python package?💡 Result:
The latest released version of the pyscal3 Python package on PyPI is 3.3.2 (released March 2, 2026). [1]
Source: [1]
🏁 Script executed:
Repository: pyiron/atomistics
Length of output: 344
Remove extra space in dependency specification for formatting consistency.
The pyscal3 dependency uses
pyscal3 = 3.3.1with a space after the=sign, while all other dependencies in this file use the formatname =versionwith no space after the equals sign. Standardize this for consistency.🔧 Proposed fix
🤖 Prompt for AI Agents