-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from pyiron/output_modul
Separate module for output classes
- Loading branch information
Showing
3 changed files
with
43 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import dataclasses | ||
|
||
from pylammpsmpi import LammpsASELibrary | ||
|
||
|
||
@dataclasses.dataclass | ||
class LammpsOutput: | ||
@classmethod | ||
def fields(cls): | ||
return tuple(field.name for field in dataclasses.fields(cls)) | ||
|
||
@classmethod | ||
def get(cls, engine: LammpsASELibrary, *quantities: str) -> dict: | ||
return {q: getattr(cls, q)(engine) for q in quantities} | ||
|
||
|
||
@dataclasses.dataclass | ||
class LammpsMDOutput(LammpsOutput): | ||
positions: callable = LammpsASELibrary.interactive_positions_getter | ||
cell: callable = LammpsASELibrary.interactive_cells_getter | ||
forces: callable = LammpsASELibrary.interactive_forces_getter | ||
temperature: callable = LammpsASELibrary.interactive_temperatures_getter | ||
energy_pot: callable = LammpsASELibrary.interactive_energy_pot_getter | ||
energy_tot: callable = LammpsASELibrary.interactive_energy_tot_getter | ||
pressure: callable = LammpsASELibrary.interactive_pressures_getter | ||
velocities: callable = LammpsASELibrary.interactive_velocities_getter | ||
|
||
|
||
@dataclasses.dataclass | ||
class LammpsStaticOutput(LammpsOutput): | ||
forces: callable = LammpsASELibrary.interactive_forces_getter | ||
energy: callable = LammpsASELibrary.interactive_energy_pot_getter | ||
stress: callable = LammpsASELibrary.interactive_pressures_getter |