Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 3, 2024
1 parent 12aee64 commit 3967804
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 56 deletions.
4 changes: 3 additions & 1 deletion pyiron_dataclasses/v1/atomistic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from dataclasses import dataclass
from typing import List, Optional

import numpy as np
from typing import Optional, List

from pyiron_dataclasses.v1.dft import OutputGenericDFT


Expand Down
62 changes: 31 additions & 31 deletions pyiron_dataclasses/v1/converter.py
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
from pint import UnitRegistry

from pyiron_dataclasses.v1.job import (
Executable,
Interactive,
GenericDict,
Server,
)
from pyiron_dataclasses.v1.atomistic import (
Cell,
GenericInput,
GenericOutput,
Structure,
Units,
Cell,
)
from pyiron_dataclasses.v1.dft import (
OutputGenericDFT,
ElectronicStructure,
DensityOfStates,
ChargeDensity,
DensityOfStates,
ElectronicStructure,
OutputGenericDFT,
)
from pyiron_dataclasses.v1.job import (
Executable,
GenericDict,
Interactive,
Server,
)
from pyiron_dataclasses.v1.lammps import (
LammpsJob,
LammpsInput,
LammpsInputFiles,
LammpsJob,
LammpsOutput,
LammpsPotential,
LammpsInputFiles,
)
from pyiron_dataclasses.v1.sphinx import (
SphinxJob,
SphinxInput,
SphinxInputParameters,
SphinxRho,
BornOppenheimer,
PawPot,
ScfDiag,
Species,
SphinxAtom,
SphinxMain,
SphinxBasis,
SphinxWaves,
SphinxOutput,
SphinxKpoint,
SphinxElectrostaticPotential,
SphinxElement,
SphinxEvalForces,
SphinxStructure,
SphinxRicQN,
SphinxInternalInput,
Species,
SphinxInitialGuess,
SphinxInput,
SphinxInputParameters,
SphinxInternalInput,
SphinxJob,
SphinxKpoint,
SphinxMain,
SphinxOutput,
SphinxPawHamiltonian,
SphinxPreConditioner,
SphinxElectrostaticPotential,
ScfDiag,
PawPot,
BornOppenheimer,
SphinxRho,
SphinxRicQN,
SphinxStructure,
SphinxWaves,
)
from pyiron_dataclasses.v1.vasp import (
VaspJob,
OutCar,
PotCar,
VaspInput,
VaspJob,
VaspOutput,
VaspResources,
PotCar,
OutCar,
)


Expand Down
3 changes: 2 additions & 1 deletion pyiron_dataclasses/v1/dft.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from dataclasses import dataclass
from typing import List, Optional

import numpy as np
from typing import Optional, List


@dataclass
Expand Down
3 changes: 1 addition & 2 deletions pyiron_dataclasses/v1/lammps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from dataclasses import dataclass
from typing import Optional, List

from typing import List, Optional

from pyiron_dataclasses.v1.atomistic import (
GenericInput,
Expand Down
4 changes: 2 additions & 2 deletions pyiron_dataclasses/v1/sphinx.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from dataclasses import dataclass
import numpy as np
from typing import List, Optional

import numpy as np

from pyiron_dataclasses.v1.atomistic import (
GenericInput,
GenericOutput,
Structure,
)
from pyiron_dataclasses.v1.dft import (
ElectronicStructure,
ChargeDensity,
ElectronicStructure,
)
from pyiron_dataclasses.v1.job import (
Executable,
Expand Down
4 changes: 2 additions & 2 deletions pyiron_dataclasses/v1/vasp.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from dataclasses import dataclass
import numpy as np

import numpy as np

from pyiron_dataclasses.v1.atomistic import (
GenericInput,
GenericOutput,
Structure,
)
from pyiron_dataclasses.v1.dft import (
ElectronicStructure,
ChargeDensity,
ElectronicStructure,
)
from pyiron_dataclasses.v1.job import (
Executable,
Expand Down
40 changes: 27 additions & 13 deletions tests/test_pyiron_atomistics_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

try:
from pyiron_atomistics import Project

skip_pyiron_atomistics_test = False
except ImportError:
skip_pyiron_atomistics_test = True
Expand All @@ -21,7 +22,8 @@ def get_node_from_job_dict(job_dict, node):


@unittest.skipIf(
skip_pyiron_atomistics_test, "pyiron_atomistics is not installed, so the pyiron_atomistics tests are skipped."
skip_pyiron_atomistics_test,
"pyiron_atomistics is not installed, so the pyiron_atomistics tests are skipped.",
)
class TestPyironAtomisticsLive(unittest.TestCase):
def setUp(self):
Expand All @@ -40,10 +42,13 @@ def test_sphinx_calc_minimize(self):
file_name=job.project_hdf5.file_name,
h5_path="/",
recursive=True,
slash='ignore',
slash="ignore",
)
job_sphinx = get_dataclass(job_dict[job.job_name])
self.assertEqual(job_sphinx.calculation_output.generic.energy_tot[-1], -228.78315943905295 * ureg.eV)
self.assertEqual(
job_sphinx.calculation_output.generic.energy_tot[-1],
-228.78315943905295 * ureg.eV,
)

def test_sphinx_calc_static(self):
ureg = UnitRegistry()
Expand All @@ -54,37 +59,43 @@ def test_sphinx_calc_static(self):
file_name=job.project_hdf5.file_name,
h5_path="/",
recursive=True,
slash='ignore',
slash="ignore",
)
job_sphinx = get_dataclass(job_dict[job.job_name])
self.assertEqual(job_sphinx.calculation_output.generic.energy_tot[-1], -228.78315953829286 * ureg.eV)
self.assertEqual(
job_sphinx.calculation_output.generic.energy_tot[-1],
-228.78315953829286 * ureg.eV,
)

def test_lammps_calc_static(self):
ureg = UnitRegistry()
job = self.project.create.job.Lammps("lmp_static")
job.structure = self.project.create.structure.ase.bulk("Al", cubic=True)
job.potential = '2002--Mishin-Y--Ni-Al--LAMMPS--ipr1'
job.potential = "2002--Mishin-Y--Ni-Al--LAMMPS--ipr1"
job.run()
job_dict = read_dict_from_hdf(
file_name=job.project_hdf5.file_name,
h5_path="/",
recursive=True,
slash='ignore',
slash="ignore",
)
job_lammps = get_dataclass(job_dict[job.job_name])
self.assertEqual(job_lammps.calculation_output.generic.energy_tot[-1], -13.4486826111902 * ureg.eV)
self.assertEqual(
job_lammps.calculation_output.generic.energy_tot[-1],
-13.4486826111902 * ureg.eV,
)

def test_lammps_calc_md(self):
job = self.project.create.job.Lammps("lmp_md")
job.structure = self.project.create.structure.ase.bulk("Al", cubic=True)
job.potential = '2002--Mishin-Y--Ni-Al--LAMMPS--ipr1'
job.potential = "2002--Mishin-Y--Ni-Al--LAMMPS--ipr1"
job.calc_md(temperature=200.0, n_ionic_steps=1000, n_print=100)
job.run()
job_dict = read_dict_from_hdf(
file_name=job.project_hdf5.file_name,
h5_path="/",
recursive=True,
slash='ignore',
slash="ignore",
)
job_lammps = get_dataclass(job_dict[job.job_name])
self.assertEqual(len(job_lammps.calculation_output.generic.energy_tot), 11)
Expand All @@ -93,13 +104,16 @@ def test_lammps_calc_minimize(self):
ureg = UnitRegistry()
job = self.project.create.job.Lammps("lmp_mini")
job.structure = self.project.create.structure.ase.bulk("Al", cubic=True)
job.potential = '2002--Mishin-Y--Ni-Al--LAMMPS--ipr1'
job.potential = "2002--Mishin-Y--Ni-Al--LAMMPS--ipr1"
job.run()
job_dict = read_dict_from_hdf(
file_name=job.project_hdf5.file_name,
h5_path="/",
recursive=True,
slash='ignore',
slash="ignore",
)
job_lammps = get_dataclass(job_dict[job.job_name])
self.assertEqual(job_lammps.calculation_output.generic.energy_tot[-1], -13.4486826111902 * ureg.eV)
self.assertEqual(
job_lammps.calculation_output.generic.energy_tot[-1],
-13.4486826111902 * ureg.eV,
)
12 changes: 8 additions & 4 deletions tests/test_pyiron_atomistics_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
class TestPyironAtomisticsStatic(TestCase):
def test_all(self):
ureg = UnitRegistry()
static_folder = os.path.join(os.path.dirname(__file__), "pyiron_atomistics_0_6_13")
static_folder = os.path.join(
os.path.dirname(__file__), "pyiron_atomistics_0_6_13"
)
energy_dict = {
"sx.h5": -228.7831594379917 * ureg.eV,
"lmp.h5": -9428.45286561574 * ureg.eV,
Expand All @@ -23,9 +25,11 @@ def test_all(self):
file_name=os.path.join(static_folder, hdf5_file),
h5_path="/",
recursive=True,
slash='ignore',
slash="ignore",
)[hdf5_file.split(".")[0]]
self.assertEqual(
get_dataclass(job_dict=job_dict).calculation_output.generic.energy_tot[-1],
energy_dict[hdf5_file]
get_dataclass(job_dict=job_dict).calculation_output.generic.energy_tot[
-1
],
energy_dict[hdf5_file],
)

0 comments on commit 3967804

Please sign in to comment.