From 083c0dd0c730979bd7a0f3277653a173dae4635b Mon Sep 17 00:00:00 2001 From: Sarath Menon Date: Thu, 14 Mar 2024 17:51:31 +0100 Subject: [PATCH] add table access functions --- calphy/utils.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/calphy/utils.py b/calphy/utils.py index 93645ac..f9f5ff8 100644 --- a/calphy/utils.py +++ b/calphy/utils.py @@ -81,3 +81,27 @@ def create_job_from_inputfile(pr, inputfile, potential, kernel=None): print(f'could not find {basedir_path}, skipping') +def get_energy_free(job): + return job["output/energy_free"] + +def get_temperature(job): + return job["output/temperature"] + +def get_phase(job): + raw = job.name.split('_') + if raw[-3] == 'liquid': + phase = 'liquid' + else: + phase = raw[1] + return phase + +def get_composition(job): + chem = job.project.db.get_item_by_id(job.id)['chemicalformula'] + comp_split = re.split('(\d+)', chem)[:-1] + if len(comp_split) == 2: + if comp_split[0] == 'Al': + return 0.00 + else: + return 1.00 + else: + return int(comp_split[3])/(int(comp_split[1])+int(comp_split[3])) \ No newline at end of file