Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed Oct 3, 2024
0 parents commit 5af05b3
Show file tree
Hide file tree
Showing 16 changed files with 760 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This workflow is used to check the differences and find conflict markers or whitespace errors

name: Black

on:
push:
branches: [ main ]
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
options: "--check --diff"
src: ./${{ github.event.repository.name }}
28 changes: 28 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow is used to upload and deploy a new release to PyPi
# Based on https://github.com/pypa/gh-action-pypi-publish

name: PyPi Release

on:
push:
pull_request:
workflow_dispatch:

jobs:
build:
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/${{ github.event.repository.name }}
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Build
shell: bash -l {0}
run: |
pip install versioneer[toml]==0.29
python setup.py sdist bdist_wheel
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
hooks:
- id: ruff
name: ruff lint
args: ["--select", "I", "--fix"]
files: ^pyiron_dataclasses/
- id: ruff-format
name: ruff format
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2018, Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include LICENSE
Empty file added pyiron_dataclasses/__init__.py
Empty file.
Empty file.
31 changes: 31 additions & 0 deletions pyiron_dataclasses/v1/calculation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from dataclasses import dataclass
from typing import List, Optional, Union


@dataclass
class CalculateMolecularDynamics:
temperature: float
pressure: Optional[Union[float, List[float]]]
n_ionic_steps: int
time_step: float
n_print: int
temperature_damping_timescale: float
pressure_damping_timescale: float
seed: Optional[int]
tloop: Optional[float]
initial_temperature: Optional[float]
langevin: bool
delta_temp: Optional[float]
delta_press: Optional[float]


@dataclass
class CalculateMinimize:
ionic_energy_tolerance: float
ionic_force_tolerance: float
e_tol: Optional[float]
f_tol: Optional[float]
max_iter: int
pressure: Optional[Union[float, List[float]]]
n_print: int
style: str
164 changes: 164 additions & 0 deletions pyiron_dataclasses/v1/generic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
from dataclasses import dataclass
import numpy as np
from typing import Optional, List


@dataclass
class DensityOfStates:
energies: str
int_densities: str
tot_densities: str


@dataclass
class ElectronicStructure:
efermi: float
eig_matrix: np.ndarray
k_points: np.ndarray
k_weights: np.ndarray
occ_matrix: np.ndarray
dos: DensityOfStates


@dataclass
class OutputGenericDFT:
energy_free: np.ndarray
energy_int: np.ndarray
energy_zero: np.ndarray
scf_energy_free: np.ndarray
scf_energy_int: np.ndarray
scf_energy_zero: np.ndarray
cbm_list: Optional[np.ndarray]
e_fermi_list: Optional[np.ndarray]
final_magmoms: Optional[np.ndarray]
magnetization: Optional[np.ndarray]
n_elect: Optional[float]
n_valence: Optional[dict]
potentiostat_output: Optional[np.ndarray]
bands_k_weights: Optional[np.ndarray]
kpoints_cartesian: Optional[np.ndarray]
bands_e_fermi: Optional[np.ndarray]
bands_occ: Optional[np.ndarray]
bands_eigen_values: Optional[np.ndarray]
scf_convergence: Optional[List[bool]]
scf_dipole_mom: Optional[np.ndarray]
scf_computation_time: Optional[np.ndarray]
valence_charges: Optional[np.ndarray]
vbm_list: Optional[np.ndarray]
bands: Optional[ElectronicStructure]
scf_energy_band: Optional[np.ndarray]
scf_electronic_entropy: Optional[np.ndarray]
scf_residue: Optional[np.ndarray]
computation_time: Optional[np.ndarray]
energy_band: Optional[np.ndarray]
electronic_entropy: Optional[np.ndarray]
residue: Optional[np.ndarray]


@dataclass
class GenericOutput:
cells: np.ndarray # N_steps * 3 *3 [Angstrom]
energy_pot: np.ndarray # N_steps [eV]
energy_tot: np.ndarray # N_steps [eV]
forces: np.ndarray # N_steps * N_atoms * 3 [eV/Angstrom]
positions: np.ndarray # N_steps * N_atoms * 3 [Angstrom]
volume: np.ndarray # N_steps
indices: Optional[np.ndarray] # N_steps * N_atoms
natoms: Optional[np.ndarray] # N_steps
pressures: Optional[np.ndarray] # N_steps * 3 * 3
steps: Optional[np.ndarray] # N_steps
stresses: Optional[np.ndarray] # N_steps
temperature: Optional[np.ndarray] # N_steps
unwrapped_positions: Optional[np.ndarray] # N_steps * N_atoms * 3 [Angstrom]
velocities: Optional[np.ndarray] # N_steps * N_atoms * 3 [Angstrom/fs]
dft: Optional[OutputGenericDFT]
elastic_constants: Optional[np.ndarray]


@dataclass
class ChargeDensity:
total: np.ndarray


@dataclass
class Server:
user: str
host: str
run_mode: str
cores: int
threads: int
new_h5: bool
accept_crash: bool
run_time: int # [seconds]
structure_id: Optional[int]
memory_limit: Optional[str]
queue: Optional[str]
qid: Optional[int]


@dataclass
class Executable:
version: str
name: str
operation_system_nt: bool
executable: Optional[str]
mpi: bool
accepted_return_codes: List[int]


@dataclass
class GenericDict:
restart_file_list: list
restart_file_dict: dict
exclude_nodes_hdf: list
exclude_groups_hdf: list


@dataclass
class Interactive:
interactive_flush_frequency: int
interactive_write_frequency: int


@dataclass
class GenericInput:
calc_mode: str
structure: str
fix_symmetry: Optional[bool]
k_mesh_spacing: Optional[float]
k_mesh_center_shift: Optional[np.ndarray]
reduce_kpoint_symmetry: Optional[bool]
restart_for_band_structure: Optional[bool]
path_name: Optional[str]
n_path: Optional[str]
fix_spin_constraint: Optional[bool]
max_iter: Optional[int]
temperature: Optional[float]
n_ionic_steps: Optional[int]
n_print: Optional[int]
temperature_damping_timescale: Optional[float]
pressure_damping_timescale: Optional[float]
time_step: Optional[int]


@dataclass
class Units:
length: str
mass: str


@dataclass
class Cell:
cell: np.ndarray # 3 * 3 [Angstrom]
pbc: np.ndarray # 3


@dataclass
class Structure:
dimension: int
indices: np.array
info: dict
positions: np.ndarray # N_atoms * 3 [Angstrom]
species: List[str]
cell: Cell
units: Units
31 changes: 31 additions & 0 deletions pyiron_dataclasses/v1/job.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from dataclasses import dataclass
from typing import List, Optional


@dataclass
class Executable:
name: str
operation_system_nt: bool
mpi: bool
accepted_return_codes: List[int]
version: Optional[str] = None
executable: Optional[str] = None


@dataclass
class Server:
user: str
host: str
run_mode: str
cores: int
threads: Optional[int] = 1
new_hdf: Optional[bool] = True
accept_crash: Optional[bool] = False
additional_arguments: Optional[dict] = None
gpus: Optional[int] = None
run_time: Optional[int] = None # [seconds]
memory_limit: Optional[str] = None
queue: Optional[str] = None
qid: Optional[int] = None
conda_environment_name: Optional[str] = None
conda_environment_path: Optional[str] = None
Loading

0 comments on commit 5af05b3

Please sign in to comment.