Skip to content

Commit

Permalink
pre-releasing adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardonpa committed May 2, 2024
1 parent bbfdfdd commit 5fe04e3
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 128 deletions.
2 changes: 1 addition & 1 deletion .devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"customizations": {
"codespaces": {
"openFiles": [
"TdH2.ipynb"
"notebooks/TdH2.ipynb"
]
},
"vscode": {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tdb2mhdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ jobs:
const commit_hash = full_commit_hash.substring(0, 8);
let message = `🚀 All Done! The confirmation hash of your contribution is: [${commit_hash}](https://mhdb.mat-x.org/${commit_hash}).\n\n`;
message += `Your submission is now completed and all entries found in your TDB file(s) were added to MHDB-community. Please refer to \`NewData.ipynb\` for further instructions on how to access the database.\n`;
message += `Your submission is now completed and all entries found in your TDB file(s) were added to MHDB-community. Please refer to [\`NewData.ipynb\`](https://github.com/PhasesResearchLab/MHDB/blob/main/notebooks/NewData.ipynb) for further instructions on how to access the database.\n`;
message += `Here\'s a summary of all files and entries processed:\n`;
message += fs.readFileSync('MHDB.log', 'utf8');
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/local/
/mhdb/aux/
*.pyc
**/__pycache__
runner*
Binary file modified assets/MHDB.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 9 additions & 3 deletions mhdb/core/mongo.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
from mhdb.core import parseTDB
from mhdb.core import parsing
from pycalphad import Database, calculate
from pymatgen.core import Composition
import datetime, re
from pprint import pprint

def queryTDB(collection, elements):
regex_pattern = '^(' + '|'.join(elements) + ')(-(' + '|'.join(elements) + '))*$'
data_collection = collection.find({'material.system': {'$regex': regex_pattern, '$options': 'i'}}, {'tdb': 1, '_id': 0})
data_collection = [entry['tdb'] for entry in list(data_collection)]
return data_collection

def updateEntry(entry:dict, client_string:str, db:str, col:str):
import dns.resolver
dns.resolver.default_resolver=dns.resolver.Resolver(configure=False)
Expand Down Expand Up @@ -55,7 +61,7 @@ def TDBEntryGenerator(data:dict, client_string:str, db:str, col:str):
'phaseModel': phaseModel
}

dbf = Database(parseTDB.one2tdb(data))
dbf = Database(parsing.one2tdb(data))

try:
SER = round(calculate(dbf, elements + ['VA'], parentDatabaseID.split(':')[0], P=101325, T=298.15).GM.values[0][0][0][0], 4)
Expand Down Expand Up @@ -151,7 +157,7 @@ def DFTEntryGenerator(data:dict, client_string:str, db:str, col:str):
}

pprint(tdb)
dbf = Database(parseTDB.one2tdb(tdb))
dbf = Database(parsing.one2tdb(tdb))

try:
SER = round(calculate(dbf, elements + ['VA'], phase_name, P=101325, T=298.15).GM.values[0][0][0][0], 4)
Expand Down
81 changes: 0 additions & 81 deletions mhdb/core/optimade.py

This file was deleted.

5 changes: 5 additions & 0 deletions mhdb/core/parseTDB.py → mhdb/core/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
from pprint import pprint
import re, json, os, datetime

def many2tdb(elements, data_collection):
data = many2one(elements, data_collection)
data = one2tdb(data)
return data

def tdb2one(file_path:str):
fd = open(file_path if '.tdb' in file_path.lower() else file_path + '.tdb', 'r')

Expand Down
43 changes: 20 additions & 23 deletions notebooks/NewData.ipynb

Large diffs are not rendered by default.

32 changes: 13 additions & 19 deletions notebooks/TdH2.ipynb

Large diffs are not rendered by default.

0 comments on commit 5fe04e3

Please sign in to comment.