diff --git a/.slugignore b/.slugignore index 74918ce0..8b137891 100644 --- a/.slugignore +++ b/.slugignore @@ -1 +1 @@ -/apps/catlearn/models/metals_catlearn_gp.pkl + diff --git a/apps/catlearn/atomistic.py b/apps/catlearn/atomistic.py index e4110017..5581bb72 100644 --- a/apps/catlearn/atomistic.py +++ b/apps/catlearn/atomistic.py @@ -41,7 +41,7 @@ def predict_catkit_demo(images): try: initial_state = [model_ref[s] for s in ase.atoms.string2symbols( - atoms.info['key_value_pairs']['species'])] + atoms.info['key_value_pairs']['species'])] except KeyError: return {} display_ref.append( diff --git a/apps/upload/__init__.py b/apps/upload/__init__.py index c806d46d..a85b048b 100644 --- a/apps/upload/__init__.py +++ b/apps/upload/__init__.py @@ -43,7 +43,7 @@ log = logging.getLogger(__name__) log.setLevel(logging.DEBUG) -ADMIN_EMAILS = ['maxjh@stanford.edu', 'winther@stanford.edu'] +ADMIN_EMAILS = ['winther@stanford.edu', 'bajdich@stanford.edu'] FRONTEND_URL = 'https://www.catalysis-hub.org' upload = flask.Blueprint('upload', __name__) diff --git a/apps/utils/gas_phase_references.py b/apps/utils/gas_phase_references.py index a479eed8..3d423c11 100644 --- a/apps/utils/gas_phase_references.py +++ b/apps/utils/gas_phase_references.py @@ -3,6 +3,7 @@ import numpy as np from numpy import array +from ase.atoms import string2symbols def molecules2symbols(molecules, add_hydrogen=True): """ @@ -12,8 +13,8 @@ def molecules2symbols(molecules, add_hydrogen=True): symbols = sorted( list(set( - ase.atoms.string2symbols(''.join( - map(lambda _x: ''.join(ase.atoms.string2symbols(_x)), molecules) + string2symbols(''.join( + map(lambda _x: ''.join(string2symbols(_x)), molecules) )) )), key=lambda _y: ase.data.atomic_numbers[_y]) @@ -38,7 +39,7 @@ def construct_reference_system(symbols, candidates=['H2', 'H2O', 'NH3', 'CH4', ' for symbol in symbols: added_symbols.append(symbol) for candidate in candidates: - symbols = ase.atoms.string2symbols(candidate) + symbols = string2symbols(candidate) if set(added_symbols) == set(list(references.keys()) + symbols): references[symbol] = candidate @@ -69,7 +70,7 @@ def get_atomic_stoichiometry(references): species = species.split('_')[0] key_index[key] = i - composition = ase.atoms.string2symbols(species) + composition = string2symbols(species) for j, symbol in enumerate(composition): if symbol == key: stoichiometry[i, i] += 1 @@ -97,7 +98,7 @@ def get_stoichiometry_factors(adsorbates, references): stoichiometry = get_atomic_stoichiometry(references) stoichiometry_factors = {} for adsorbate in adsorbates: - for symbol in ase.atoms.string2symbols(adsorbate): + for symbol in string2symbols(adsorbate): symbol_index = list( map(lambda _x: _x[0], references)).index(symbol) diff --git a/models.py b/models.py index c7912fd2..c63f6a40 100644 --- a/models.py +++ b/models.py @@ -27,6 +27,7 @@ import ase.atoms from ase.constraints import dict2constraint from ase.calculators.singlepoint import SinglePointCalculator +from ase.calculators.calculator import Calculator import ase.db.sqlite import ase.db.core import ase.io @@ -240,7 +241,6 @@ def _toatoms(self, include_results=False): cell=self.cell, pbc=(self.pbc & np.array([1, 2, 4])).astype(bool), ) - if self.constraints: constraints = json.loads(self.constraints) if len(constraints[0]['kwargs']['indices']) > 0: @@ -251,38 +251,35 @@ def _toatoms(self, include_results=False): self.positions, cell=self.cell, pbc=(self.pbc & np.array([1, 2, 4])).astype(bool), - magmoms=self.magmoms, - charges=self.charges, + magmoms=self.initial_magmoms, + charges=self.initial_charges, tags=self.tags, masses=self.masses, momenta=self.momenta, constraint=constraints) + atoms.info = {} + atoms.info['unique_id'] = self.unique_id + atoms.info['key_value_pairs'] = self.key_value_pairs + + data = self.data + if data: + atoms.info['data'] = data if not self.calculator == "unknown": - params = self.get('calculator_parameters', {}) - atoms.calc = get_calculator(self.calculator)(**params) + params = self.calculator_parameters + atoms.calc = Calculator(self.calculator, **params) + atoms.calc.name = self.calculator else: all_properties = ['energy', 'forces', 'stress', 'dipole', 'charges', 'magmom', 'magmoms', 'free_energy'] results = {} - #print(getattr(self, 'energy')) for prop in all_properties: result = getattr(self, prop, None) if result is not None: results[prop] = result - # print(results) if results: atoms.calc = SinglePointCalculator(atoms, **results) atoms.calc.name = getattr(self, 'calculator', 'unknown') - - atoms.info = {} - atoms.info['unique_id'] = self.unique_id - atoms.info['key_value_pairs'] = self.key_value_pairs - - data = self.data - if data: - atoms.info['data'] = data - return atoms @hybrid_property diff --git a/requirements.template b/requirements.template index 9fae7e90..ca48a478 100644 --- a/requirements.template +++ b/requirements.template @@ -1,7 +1,7 @@ # DO NOT EDIT requirements.txt DIRECTLY OR ADD IT TO VERSION CONTROL # It will be overwritten in the install progress # Add new packages in requirements.template instead. -ase==3.16.0 +ase==3.16.2 backports.functools-lru-cache==1.4 catkit>=0.5.3 git+https://github.com/SUNCAT-Center/CatLearn.git@06bbfd370306ae6ecbfee50fd48b5f0a6ff5ef31#egg=catlearn @@ -53,4 +53,4 @@ SQLAlchemy==1.1.14 typing==3.6.2 tqdm==4.19.5 urwid==1.3.1 -Werkzeug==0.12.2 +Werkzeug==0.12.2 \ No newline at end of file