Skip to content

Commit

Permalink
update to v0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhu2017 committed May 23, 2022
1 parent 9bbf570 commit 218588b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 25 deletions.
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
author = 'Qiang Zhu, Howard Yanxon, David Zagaceta'

# The short X.Y version
version = '0.2.0'
version = '0.2.1'
# The full version, including alpha/beta/rc tags
release = 'Feb 2022'
release = 'May 2022'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.0`` at `GitHub <https://github.com/qzhu2017/pyxtal_ff>`_.
The current version is ``0.2.1`` at `GitHub <https://github.com/qzhu2017/pyxtal_ff>`_.

Expect updates upon request by `Qiang Zhu\'s group <https://qzhu2017.github.io>`_ at University of Nevada Las Vegas.

Expand Down
43 changes: 22 additions & 21 deletions pyxtal_ff/models/neuralnetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,31 +616,32 @@ def calculate_properties(self, descriptor, bforce=True, bstress=False):
scale = (1 - 0) / (_drange[:, 1] - _drange[:, 0])

e = np.where(np.array(descriptor['elements'])==element)[0]
ee0 = np.where(descriptor['seq'][:,0]==e[0])[0][0]
ee1 = np.where(descriptor['seq'][:,0]==e[-1])[0][-1]
if len(e) > 0:
ee0 = np.where(descriptor['seq'][:,0]==e[0])[0][0]
ee1 = np.where(descriptor['seq'][:,0]==e[-1])[0][-1]

i_size = list(descriptor['elements']).count(element) #number of atoms in type i
m_size = ee1-ee0+1# number of pairs
i_size = list(descriptor['elements']).count(element) #number of atoms in type i
m_size = ee1-ee0+1# number of pairs

d['x'][element] = torch.zeros([i_size, no_of_descriptors])
d['dxdr'][element] = torch.zeros([m_size, no_of_descriptors, 3], dtype=torch.float64) ####
d['rdxdr'][element] = torch.zeros([i_size, no_of_descriptors, 6])
d['x'][element] = torch.zeros([i_size, no_of_descriptors])
d['dxdr'][element] = torch.zeros([m_size, no_of_descriptors, 3], dtype=torch.float64) ####
d['rdxdr'][element] = torch.zeros([i_size, no_of_descriptors, 6])

if e.size > 0:
des = 0 + np.einsum('j,ij->ij', scale, (descriptor['x'][e[0]:e[-1]+1] - np.expand_dims(_drange[:, 0], 0)))
desp = np.einsum('j,ijk->ijk', scale, descriptor['dxdr'][ee0:ee1+1])
dess = np.einsum('j,ijk->ijk', scale, descriptor['rdxdr'][e[0]:e[-1]+1])

d['x'][element] += torch.from_numpy(des)
d['seq'][element] = deepcopy(descriptor['seq'][ee0:ee1+1])
if e.size > 0:
des = 0 + np.einsum('j,ij->ij', scale, (descriptor['x'][e[0]:e[-1]+1] - np.expand_dims(_drange[:, 0], 0)))
desp = np.einsum('j,ijk->ijk', scale, descriptor['dxdr'][ee0:ee1+1])
dess = np.einsum('j,ijk->ijk', scale, descriptor['rdxdr'][e[0]:e[-1]+1])
d['x'][element] += torch.from_numpy(des)
d['seq'][element] = deepcopy(descriptor['seq'][ee0:ee1+1])

if self.unit == 'eV':
d['dxdr'][element] += torch.from_numpy(desp)
d['rdxdr'][element] += torch.from_numpy(dess)
else:
d['dxdr'][element] += torch.from_numpy(0.529177 * desp)
d['rdxdr'][element] += torch.from_numpy(0.529177**3*desp)
d['seq'][element][:, 0] -= min(d['seq'][element][:, 0]) #adjust the initial position
if self.unit == 'eV':
d['dxdr'][element] += torch.from_numpy(desp)
d['rdxdr'][element] += torch.from_numpy(dess)
else:
d['dxdr'][element] += torch.from_numpy(0.529177 * desp)
d['rdxdr'][element] += torch.from_numpy(0.529177**3*desp)
d['seq'][element][:, 0] -= min(d['seq'][element][:, 0]) #adjust the initial position

x = d['x']
if bforce:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
'scipy>=1.6.1',
'matplotlib>=2.0.0',
'ase>=3.20.1',
'torch>=1.1.0',
'torch>=1.10.2',
'phonopy==2.3.2', #tmp fix
'spglib>=1.12.1',
'monty>=3.0.2',
Expand Down

0 comments on commit 218588b

Please sign in to comment.