Skip to content

Commit 38c05ed

Browse files
committed
version 0.1.0 of APTrajectories
1 parent d15fb0e commit 38c05ed

22 files changed

+223355
-20687
lines changed

.DS_Store

6 KB
Binary file not shown.

Example/fin_evapos.h5

0 Bytes
Binary file not shown.

Example/tip_pos.h5

-22.8 MB
Binary file not shown.

Example/tip_pos_charge.h5

-669 KB
Binary file not shown.

Example/tip_surf_ind.h5

-669 KB
Binary file not shown.

Example_pyiron/.DS_Store

6 KB
Binary file not shown.

Example_pyiron/test.h5

2.21 MB
Binary file not shown.

Example_pyiron/test_hdf5/.DS_Store

6 KB
Binary file not shown.
4 KB
Binary file not shown.
379 KB
Binary file not shown.
28.8 KB
Binary file not shown.
28.8 KB
Binary file not shown.

Readme.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
$Robin-Rolland^{[1]}$ type simulations for APT trajectories.
1+
# Installation
2+
3+
Install by using
4+
'''pip install APTrajectories'''
5+
6+
For usage, see the [example Notebook](example.ipynb) notebook
7+
8+
# $Robin-Rolland^{[1]}$ type simulations for APT trajectories.
29

310
![conductor surface](conductor_surface.PNG)
411

Binary file not shown.
Binary file not shown.

RobinRollandModel/datautils.py

+172-92
Large diffs are not rendered by default.

RobinRollandModel/main.py

+274-128
Large diffs are not rendered by default.

RobinRollandModel/pyironjob.py

+46-53
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,70 @@
1+
"""Module for pyiron job based on the RRmodel module"""
12
from pyiron_base.utils.error import ImportAlarm
23
from pyiron_base.jobs.job.template import TemplateJob
3-
import h5py
4-
import numpy as np
54
from pyiron_base.jobs.job.jobtype import JobType
5+
import h5io
66
try:
77
from RobinRollandModel.main import RRModel
88
from RobinRollandModel.datautils import TipGenerator
99
except ImportError:
1010
import_alarm = ImportAlarm("Unable to import RobinRollandmodel")
1111

12+
1213
class RRModelAPTjob(TemplateJob):
14+
"""pyiron job class for RRModelAPT simulation"""
15+
1316
def __init__(self, project, job_name):
1417
super().__init__(project, job_name)
15-
self.input['e_field'] = 4
16-
self.input['tip_height'] = 80
17-
self.input['tip_radius'] = 20
18-
self.input['z_height'] = 50
19-
self.input['tip_shank_angle'] = None
20-
self.input['basic_structure'] = None
21-
self.input['num_atoms'] = 5 #number of atoms to evaporate
18+
self.input["e_field"] = 4
19+
self.input["tip_height"] = 80
20+
self.input["tip_radius"] = 20
21+
self.input["z_height"] = 50
22+
self.input["tip_shank_angle"] = None
23+
self.input["basic_structure"] = None
24+
self.input["num_atoms"] = 5 # number of atoms to evaporate
2225

2326
def create_input_structure(self):
24-
tip_generator = TipGenerator(structure=self.input.basic_structure,
25-
h=self.input.tip_height,
26-
ah=self.input.tip_radius,
27-
alpha=self.input.tip_shank_angle,
28-
zheight=self.input.z_height)
29-
self.input['structure'] = tip_generator.create_tip_pyiron(self.project) # structure of the tip
27+
"""Creates the tip structure"""
28+
tip_generator = TipGenerator(
29+
structure=self.input.basic_structure,
30+
h=self.input.tip_height,
31+
ah=self.input.tip_radius,
32+
alpha=self.input.tip_shank_angle,
33+
zheight=self.input.z_height,
34+
)
35+
self.input["structure"] = tip_generator.create_tip_pyiron(
36+
self.project
37+
) # structure of the tip
3038
return tip_generator
3139

32-
def run_static(self,**kwargs):
40+
def run_static(self, **kwargs):
3341
tip_generator = self.create_input_structure()
34-
#self.input['structure']= tip_generator.create_tip_pyiron(self.project)
35-
job = RRModel(tip_generator=tip_generator,
36-
structure=self.input.structure,
37-
e_field=self.input.e_field)
38-
job.run_evaporation(num_atoms=self.input.num_atoms,path=self.working_directory,**kwargs)
42+
# self.input['structure']= tip_generator.create_tip_pyiron(self.project)
43+
job = RRModel(
44+
tip_generator=tip_generator,
45+
structure=self.input.structure,
46+
e_field=self.input.e_field,
47+
)
48+
job.run_evaporation(
49+
num_atoms=self.input.num_atoms, path=self.working_directory, **kwargs
50+
)
3951
self.collect_output()
40-
41-
self.status.finished = True
4252

53+
self.status.finished = True
4354

4455
def collect_output(self, path=None):
4556
if path is None:
4657
path = self.working_directory
47-
48-
fin_evapos = {}
49-
with h5py.File(f'{path}/fin_evapos.h5','r') as output:
50-
for varname in output.keys ():
51-
atom = float(str(varname).replace('step=',''))
52-
fin_evapos[atom] = np.asarray(output[varname])
53-
self.output['evaporation_trajectories'] = fin_evapos
54-
55-
tip_pos = {}
56-
with h5py.File(f'{path}/tip_pos.h5','r') as output:
57-
for varname in output.keys ():
58-
atom = float(str(varname).replace('step=',''))
59-
tip_pos[atom] = np.asarray(output[varname])
60-
self.output['tip_structures'] = tip_pos
61-
62-
tip_pos_charge = {}
63-
with h5py.File(f'{path}/tip_pos_charge.h5','r') as output:
64-
for varname in output.keys ():
65-
atom = float(str(varname).replace('step=',''))
66-
tip_pos_charge[atom] = np.asarray(output[varname])
67-
self.output['equilibrium_charges'] = tip_pos_charge
68-
69-
tip_surf_ind = {}
70-
with h5py.File(f'{path}/tip_surf_ind.h5','r') as output:
71-
for varname in output.keys ():
72-
atom = float(str(varname).replace('step=',''))
73-
tip_surf_ind[atom] = np.asarray(output[varname])
74-
self.output['surface_indices'] = tip_surf_ind
75-
#self.to_hdf() #is a duplication of output to job hdf5 file
7658

77-
JobType.register(RRModelAPTjob)
59+
fin_evapos = h5io.read_hdf5(f'{path}/fin_evapos.h5')
60+
tip_pos = h5io.read_hdf5(f'{path}/tip_pos.h5')
61+
tip_pos_charge = h5io.read_hdf5(f'{path}/tip_pos_charge.h5')
62+
tip_surf_ind = h5io.read_hdf5(f'{path}/tip_surf_ind.h5')
63+
self.output["evaporation_trajectories"] = fin_evapos
64+
self.output["tip_structures"] = tip_pos
65+
self.output["equilibrium_charges"] = tip_pos_charge
66+
self.output["surface_indices"] = tip_surf_ind
67+
self.to_hdf() #is a duplication of output to job hdf5 file
68+
69+
70+
JobType.register(RRModelAPTjob)

0 commit comments

Comments
 (0)