Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
5fe6fe6
update structure
srmnitc Mar 30, 2025
6908f7c
add the new build module
srmnitc Apr 1, 2025
1351ff2
modify bulk
srmnitc Apr 1, 2025
bb1dd0d
modify bulk
srmnitc Apr 1, 2025
9755c7c
add defects
srmnitc Apr 1, 2025
7cb5cf6
add io module
srmnitc Apr 1, 2025
866cfbd
update structure
srmnitc Apr 1, 2025
a53d084
continue refactoring vacancy
srmnitc Apr 1, 2025
2a03c86
update defect to add vacancy method
srmnitc Apr 2, 2025
2678675
update substitutional impurities
srmnitc Apr 2, 2025
6d62ad8
update interstitial impurities
srmnitc Apr 2, 2025
6ace6f9
update make crystal method
srmnitc Apr 2, 2025
47c5327
update rotation
srmnitc Apr 2, 2025
e993847
update further
srmnitc Apr 2, 2025
e0b26ab
fix transfer of sample
srmnitc Apr 3, 2025
1292e60
fix translation function
srmnitc Apr 3, 2025
3215522
fix shear function
srmnitc Apr 3, 2025
bbb1a64
fix plot function
srmnitc Apr 3, 2025
a251569
fix plot function
srmnitc Apr 3, 2025
ad2aadc
restructure imports
srmnitc Apr 3, 2025
5bccf50
fix system imports
srmnitc Apr 3, 2025
7f1643f
allow multicomponent creation routines
srmnitc Apr 3, 2025
5e10e16
update write method
srmnitc Apr 3, 2025
4902127
update write
srmnitc Apr 3, 2025
0f5330e
fix qe tests
srmnitc Apr 4, 2025
a213f5d
fix rotate
srmnitc Apr 4, 2025
e227042
fix store
srmnitc Apr 4, 2025
175769e
change API doc of vacxancy
srmnitc Apr 4, 2025
2520023
partly fix
srmnitc Apr 4, 2025
342a6c2
update graph
srmnitc Jul 24, 2025
ef44a3f
number of fixes for tests
srmnitc Jul 24, 2025
a6eca9b
update tests
srmnitc Jul 24, 2025
b2afefb
update vis tests
srmnitc Jul 24, 2025
f393c20
update general notebooks
srmnitc Jul 24, 2025
d60d108
add first draft of datamodels
srmnitc Jul 25, 2025
ee72527
change to new style structure serialisation
srmnitc Jul 25, 2025
2118219
add dislocation models
srmnitc Jul 25, 2025
d09ec5e
add sf
srmnitc Jul 25, 2025
203e450
update folder structure
srmnitc Jul 25, 2025
81ea018
add point defects
srmnitc Jul 25, 2025
297a82d
add templates for defects in structure
srmnitc Jul 25, 2025
489ffda
update funcs to only use sample_id
srmnitc Jul 25, 2025
68869cf
fix bug in name
srmnitc Jul 25, 2025
234c3c9
update defect building
srmnitc Jul 25, 2025
56e501a
add stacking fault
srmnitc Jul 25, 2025
5c6a386
add gb
srmnitc Jul 25, 2025
6829053
fix func signatures of all the functions
srmnitc Jul 25, 2025
dd32948
update signatures of dislocations
srmnitc Jul 27, 2025
93c786f
add GB
srmnitc Jul 27, 2025
6415c0e
add SF
srmnitc Jul 27, 2025
fcaec2d
add point defects
srmnitc Jul 27, 2025
46dec98
add a defect model
srmnitc Jul 28, 2025
6ac7205
add defects
srmnitc Jul 28, 2025
ac9db8a
add basemodels for structure manipulations
srmnitc Jul 28, 2025
e27b754
add basemodels for structure manipulations
srmnitc Jul 28, 2025
65b1534
update attributes method
srmnitc Aug 25, 2025
2756077
update trfs
srmnitc Aug 25, 2025
5561815
add force method
srmnitc Aug 26, 2025
f0a651b
update vacancy
srmnitc Aug 27, 2025
10ba6d1
update tests
srmnitc Aug 28, 2025
e4e2ac2
add write method
srmnitc Aug 28, 2025
afe0fc5
restructure write and mp
srmnitc Aug 28, 2025
d6a3594
update datamodels with phys quant
srmnitc Aug 28, 2025
daba97a
add more items
srmnitc Aug 29, 2025
c6ba73f
add from graph for potentials
srmnitc Sep 1, 2025
ffe8859
add software
srmnitc Sep 1, 2025
80ea6dd
add add_dft
srmnitc Sep 1, 2025
1f9dc0c
add to and from for methods
srmnitc Sep 1, 2025
cc4df62
add to for dof individuals
srmnitc Sep 1, 2025
9a17496
add to for ensemble individuals
srmnitc Sep 1, 2025
e41fd8b
add to for xcfunctionals
srmnitc Sep 1, 2025
0a29eeb
add basic sketch of workflow serialisation
srmnitc Sep 1, 2025
346522c
add validators for software and workflow
srmnitc Sep 1, 2025
13caeeb
add from graph methods
srmnitc Sep 1, 2025
f18fb72
update models
srmnitc Sep 9, 2025
ca587e2
further refine property
srmnitc Sep 9, 2025
a7719b1
more updates for workflow
srmnitc Sep 9, 2025
cce78b0
add parsers
srmnitc Sep 9, 2025
0119756
add calculated properties
srmnitc Sep 9, 2025
5793c7d
change activity
srmnitc Sep 9, 2025
48b14b9
add parsing of structure
srmnitc Sep 9, 2025
7fe4c51
working code for full workflow serialisation
srmnitc Sep 9, 2025
afe0f34
add new notebook
srmnitc Sep 9, 2025
572dd4d
further modify pyiron parsers
srmnitc Sep 9, 2025
82d7db4
bug fixes for regenerating sample
srmnitc Sep 10, 2025
7ce61cc
protect against wrong ids
srmnitc Sep 10, 2025
9752fc7
update props
srmnitc Sep 10, 2025
4d97508
further updates
srmnitc Sep 10, 2025
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
4 changes: 4 additions & 0 deletions atomrdf/build/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from atomrdf.build.bulk import bulk

# from atomrdf.build.bulk import lattice
import atomrdf.build.defect as defect
8 changes: 8 additions & 0 deletions atomrdf/build/buildutils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from atomrdf.sample import Property

#declassing special variables
def _declass(item):
if isinstance(item, Property):
return item.value
else:
return item
179 changes: 179 additions & 0 deletions atomrdf/build/bulk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
import numpy as np

from ase.data import atomic_numbers, chemical_symbols, reference_states
from ase.atoms import Atoms
from ase.build import bulk as asebulk

from atomrdf.datamodels.structure import AtomicScaleSample
import atomrdf.properties as ap


def bulk(
name: str,
crystalstructure: str = None,
a: float = None,
b: float = None,
c: float = None,
*,
alpha: float = None,
covera: float = None,
u: float = None,
orthorhombic: bool = False,
cubic: bool = False,
basis=None,
repeat: int = 1,
graph=None,
get_metadata: bool = False,
) -> tuple[Atoms, AtomicScaleSample]:

sdict = _compute_structure_metadata(name, crystalstructure, a, b, c, covera)

atoms = _create_atoms(
name,
crystalstructure,
sdict["a"],
sdict["b"],
sdict["c"],
alpha,
covera,
u,
orthorhombic,
cubic,
basis,
repeat,
)
sdict["spacegroup_symbol"] = ap.get_spacegroup_symbol(atoms)
sdict["spacegroup_number"] = ap.get_spacegroup_number(atoms)
data = _generate_atomic_sample_data(atoms, sdict, repeat)

if graph is not None:
sample = AtomicScaleSample(**data)
sample.to_graph(graph)
atoms.info["id"] = sample.id
atoms.info["graph"] = graph

if get_metadata:
return atoms, sdict
return atoms


def _generate_atomic_sample_data(atoms, sdict=None, repeat=None):
data = AtomicScaleSample.template()
data["material"]["element_ratio"]["value"] = ap.get_chemical_composition(atoms)

if sdict is not None:
if "structure" in sdict.keys():
data["material"]["crystal_structure"]["name"]["value"] = sdict["structure"]
if "spacegroup_symbol" in sdict.keys():
data["material"]["crystal_structure"]["spacegroup_symbol"]["value"] = sdict[
"spacegroup_symbol"
]
if "spacegroup_number" in sdict.keys():
data["material"]["crystal_structure"]["spacegroup_number"]["value"] = sdict[
"spacegroup_number"
]
if "structure" in sdict.keys():
data["material"]["crystal_structure"]["unit_cell"]["bravais_lattice"][
"value"
] = ap.get_bravais_lattice(sdict["structure"])
if "a" in sdict.keys():
if "b" not in sdict.keys():
sdict["b"] = sdict["a"]
if "c" not in sdict.keys():
sdict["c"] = sdict["a"]
data["material"]["crystal_structure"]["unit_cell"]["lattice_parameter"][
"value"
] = [
sdict["a"],
sdict["b"],
sdict["c"],
]

data["material"]["crystal_structure"]["unit_cell"]["angle"][
"value"
] = atoms.get_cell_lengths_and_angles()[3:]

data["simulation_cell"]["volume"]["value"] = ap.get_cell_volume(atoms)
data["simulation_cell"]["number_of_atoms"]["value"] = ap.get_number_of_atoms(atoms)
data["simulation_cell"]["length"]["value"] = ap.get_simulation_cell_length(atoms)
data["simulation_cell"]["vector"]["value"] = ap.get_simulation_cell_vector(atoms)
data["simulation_cell"]["angle"]["value"] = ap.get_simulation_cell_angle(atoms)

if repeat is not None:
if isinstance(repeat, int):
data["simulation_cell"]["repetitions"]["value"] = (repeat, repeat, repeat)
else:
data["simulation_cell"]["repetitions"]["value"] = repeat

data["atom_attribute"]["position"]["value"] = atoms.get_positions().tolist()
data["atom_attribute"]["species"]["value"] = atoms.get_chemical_symbols()
return data


def _create_atoms(
name,
crystalstructure,
a,
b,
c,
alpha,
covera,
u,
orthorhombic,
cubic,
basis,
repeat,
):
atoms = asebulk(
name,
crystalstructure=crystalstructure,
a=a,
b=b,
c=c,
alpha=alpha,
covera=covera,
u=u,
orthorhombic=orthorhombic,
cubic=cubic,
basis=basis,
)
if isinstance(repeat, (int, list, tuple)):
atoms = atoms.repeat(repeat)
return atoms


def _compute_structure_metadata(name, crystalstructure, a, b, c, covera):
sdict = {"a": a, "b": b, "c": c, "covera": covera}
atomic_number = atomic_numbers.get(name)
ref = reference_states[atomic_number]

xref = None
if ref:
xref = ref.get("symmetry")
if xref and name in chemical_symbols:
sdict["structure"] = xref

if crystalstructure:
sdict["structure"] = crystalstructure

if a is None and ref and "a" in ref:
sdict["a"] = ref["a"]

if b is None and ref and (bovera := ref.get("b/a")) and a:
sdict["b"] = bovera * a

if crystalstructure in ["hcp", "wurtzite"]:
if c:
covera = c / a
elif covera is None:
covera = ref.get("c/a") if xref == crystalstructure else np.sqrt(8 / 3)

if covera is None and ref and (ref_c_a := ref.get("c/a")):
covera = ref_c_a
if c is None and a:
sdict["c"] = covera * a

sdict["b"] = sdict["a"] if sdict["b"] is None else sdict["b"]
sdict["c"] = sdict["a"] if sdict["c"] is None else sdict["c"]

return sdict
Loading
Loading