Skip to content

Commit

Permalink
add table access functions
Browse files Browse the repository at this point in the history
  • Loading branch information
srmnitc committed Mar 14, 2024
1 parent dd53dbe commit 083c0dd
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions calphy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]))

0 comments on commit 083c0dd

Please sign in to comment.