From 95ae2140163a9f56a1cf6f78fc407ae2a6bcb1ac Mon Sep 17 00:00:00 2001 From: qzhu Date: Mon, 19 Dec 2022 14:01:46 -0800 Subject: [PATCH] fix some tiny issue on PR model with stress --- docs/conf.py | 6 +++--- docs/index.rst | 2 +- pyxtal_ff/calculator/__init__.py | 1 + pyxtal_ff/models/polynomialregression.py | 9 +++++++-- pyxtal_ff/version.py | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index e56d4b8..d0466ff 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -19,13 +19,13 @@ # -- Project information ----------------------------------------------------- project = 'PyXtal_FF' -copyright = '2019-2021, Qiang Zhu, Howard Yanxon, David Zagaceta' +copyright = '2019-, Qiang Zhu, Howard Yanxon, David Zagaceta' author = 'Qiang Zhu, Howard Yanxon, David Zagaceta' # The short X.Y version -version = '0.2.1' +version = '0.2.2' # The full version, including alpha/beta/rc tags -release = 'May 2022' +release = 'Dec 2022' # -- General configuration --------------------------------------------------- diff --git a/docs/index.rst b/docs/index.rst index c5a6cf3..d6495c5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -2,7 +2,7 @@ PyXtal_FF ====================================== The aim of PyXtalFF project is to provide an automated computational infrastructure to train the interatomic potentials for inorganic periodic systems from high-end quantum mechanical calculations. -The current version is ``0.2.1`` at `GitHub `_. +The current version is ``0.2.2`` at `GitHub `_. Expect updates upon request by `Qiang Zhu\'s group `_ at University of Nevada Las Vegas. diff --git a/pyxtal_ff/calculator/__init__.py b/pyxtal_ff/calculator/__init__.py index a6122b4..aeba9a9 100644 --- a/pyxtal_ff/calculator/__init__.py +++ b/pyxtal_ff/calculator/__init__.py @@ -56,6 +56,7 @@ def calculate(self, atoms=None, # pyxtal_ff and lammps uses: xx, yy, zz, xy, xz, yz # ase uses: xx, yy, zz, yz, xz, xy + # vasp uses: xx, yy, zz, xy, yz, zx # from eV/A^3 to GPa self.results['stress_zbl'] = base_stress/units.GPa self.results['energy_zbl'] = base_energy diff --git a/pyxtal_ff/models/polynomialregression.py b/pyxtal_ff/models/polynomialregression.py index 88311d5..21b7765 100644 --- a/pyxtal_ff/models/polynomialregression.py +++ b/pyxtal_ff/models/polynomialregression.py @@ -141,7 +141,7 @@ def evaluate(self, data, figname): _force.append(Force[m]) if self.stress_coefficient and (db[str(i)]['group'] in self.stress_group): - true_stress = np.array(db[str(i)]['stress'])#.flat[[0,3,5,3,1,4,5,4,2]] + true_stress = np.ravel(db[str(i)]['stress'])#.flat[[0,3,5,3,1,4,5,4,2]] Stress = np.ravel(Stress) for m in range(len(true_stress)): stress.append(true_stress[m]) @@ -707,6 +707,11 @@ def parse_features(self, data): for i in range(self.no_of_structures): data = db[str(i)] + #for key in data.keys(): + # if key in ['x', 'dxdr', 'rdxdr', 'seq', 'force']: + # print(key, data[key].shape) + # else: + # print(key, data[key]) #energy = np.array([data['energy']/len(data['elements'])]) energy = np.array([data['energy']]) w_energy = np.array([1.]) @@ -716,7 +721,7 @@ def parse_features(self, data): w_force = np.array([self.force_coefficient]*len(force)) if self.stress_coefficient and (data['group'] in self.stress_group): # energy + forces + stress - stress = np.array(data['stress'])#.flat[[0,3,5,3,1,4,5,4,2]] + stress = np.array(data['stress']).ravel()#.flat[[0,3,5,3,1,4,5,4,2]] w_stress = np.array([self.stress_coefficient]*len(stress)) self.stress_components += 6 diff --git a/pyxtal_ff/version.py b/pyxtal_ff/version.py index fc79d63..020ed73 100644 --- a/pyxtal_ff/version.py +++ b/pyxtal_ff/version.py @@ -1 +1 @@ -__version__ = '0.2.1' +__version__ = '0.2.2'