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

Use Github Co-pilot to add Docstrings and Type Hints #316

Merged
merged 31 commits into from
Aug 3, 2024
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
37272d3
Use Github Co-pilot to add Docstrings and Type Hints
jan-janssen Aug 3, 2024
4deddf7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 3, 2024
8c5536b
some fixes
jan-janssen Aug 3, 2024
66f58f8
Merge branch 'copilot' of github.com:pyiron/atomistics into copilot
jan-janssen Aug 3, 2024
2f5332d
merge
jan-janssen Aug 3, 2024
b4f5043
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 3, 2024
b75e479
more fixes
jan-janssen Aug 3, 2024
7ba5232
Merge branch 'copilot' of github.com:pyiron/atomistics into copilot
jan-janssen Aug 3, 2024
5b5c825
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 3, 2024
5a4ac4d
more and more fixes
jan-janssen Aug 3, 2024
b236bb4
Merge remote-tracking branch 'refs/remotes/origin/copilot' into copilot
jan-janssen Aug 3, 2024
f2cccf7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 3, 2024
103abe1
remove matplotlib
jan-janssen Aug 3, 2024
9d1da6e
Merge branch 'copilot' of github.com:pyiron/atomistics into copilot
jan-janssen Aug 3, 2024
dff7549
remove recursive link
jan-janssen Aug 3, 2024
8d36e83
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 3, 2024
18453a9
more type fixes
jan-janssen Aug 3, 2024
c87acdb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 3, 2024
55ee0b7
More and more type fixes
jan-janssen Aug 3, 2024
20a0afb
more fixes
jan-janssen Aug 3, 2024
ab2167f
more local debugging
jan-janssen Aug 3, 2024
ba12c71
fixes
jan-janssen Aug 3, 2024
b29ed9e
more fixes
jan-janssen Aug 3, 2024
c9db589
remove duplicated functions
jan-janssen Aug 3, 2024
cc3d4ce
Update tests
jan-janssen Aug 3, 2024
bf06866
Use mpich rather than openmpi
jan-janssen Aug 3, 2024
07cc09b
Switch to openmpi
jan-janssen Aug 3, 2024
c26d00f
Update thermal_expansion_with_lammps.ipynb
jan-janssen Aug 3, 2024
aa1090e
Update thermal_expansion_with_lammps.ipynb
jan-janssen Aug 3, 2024
ae90258
Delete .vscode/settings.json
jan-janssen Aug 3, 2024
950ab00
Update lammps_workflows.ipynb
jan-janssen Aug 3, 2024
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
Prev Previous commit
Next Next commit
more fixes
jan-janssen committed Aug 3, 2024
commit b29ed9ebe32d697510e7831b0d61e4392bb359fb
65 changes: 15 additions & 50 deletions atomistics/calculators/ase.py
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
from ase.calculators.calculator import PropertyNotImplementedError
from ase.constraints import UnitCellFilter
from ase.md.langevin import Langevin
from ase.md.npt import NPT
from ase.md.velocitydistribution import MaxwellBoltzmannDistribution
from ase.optimize.optimize import Optimizer

@@ -445,17 +446,21 @@ def calc_molecular_dynamics_npt_with_ase(
Returns:
dict: A dictionary containing the calculated properties at each MD step.
"""
dyn = Langevin(
atoms=structure,
timestep=timestep,
temperature_K=temperature,
friction=0.002,
externalstress=externalstress,
pfactor=pfactor,
ttime=ttime,
)
return _calc_molecular_dynamics_with_ase(
dyn=dyn,
dyn=NPT(
atoms=structure,
timestep=timestep,
temperature=None,
externalstress=externalstress,
ttime=ttime,
pfactor=pfactor,
temperature_K=temperature,
mask=None,
trajectory=None,
logfile=None,
loginterval=1,
append_trajectory=False,
),
structure=structure,
ase_calculator=ase_calculator,
temperature=temperature,
@@ -503,43 +508,3 @@ def _calc_molecular_dynamics_with_ase(
for k, v in calc_dict.items():
cache[k].append(v)
return {q: np.array(cache[q]) for q in output_keys}


def _calc_molecular_dynamics_with_ase(
dyn,
structure: Atoms,
ase_calculator: ASECalculator,
temperature: float,
run: int,
thermo: int,
output_keys: List[str],
) -> dict:
"""
Perform molecular dynamics simulation using ASE.

Args:
dyn: The ASE dynamics object.
structure (Atoms): The atomic structure to simulate.
ase_calculator (ASECalculator): The ASE calculator to use for energy and force calculations.
temperature (float): The desired temperature in Kelvin.
run (int): The number of MD steps to perform.
thermo (int): The interval at which to print thermodynamic properties.
output_keys (List[str]): The keys of the properties to include in the output dictionary.

Returns:
dict: A dictionary containing the calculated properties at each MD step.
"""
structure.calc = ase_calculator
MaxwellBoltzmannDistribution(atoms=structure, temperature_K=temperature)
cache = {q: [] for q in output_keys}
for i in range(int(run / thermo)):
dyn.run(thermo)
ase_instance = ASEExecutor(
ase_structure=structure, ase_calculator=ase_calculator
)
calc_dict = OutputMolecularDynamics(
**{k: getattr(ase_instance, k) for k in OutputMolecularDynamics.keys()}
).get(output_keys=output_keys)
for k, v in calc_dict.items():
cache[k].append(v)
return {q: np.array(cache[q]) for q in output_keys}