Skip to content

Commit ecb6f47

Browse files
authored
Merge pull request #10 from PytLab/fix-lammps-format-bug
Add basis info in LAMMPS data conversion
2 parents 95f91ca + ed364b2 commit ecb6f47

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ VASPy
1717
:target: https://www.python.org/downloads/release/python-351/
1818
:alt: platform
1919

20-
.. image:: https://img.shields.io/badge/pypi-v0.8.11-blue.svg
20+
.. image:: https://img.shields.io/badge/pypi-v0.8.12-blue.svg
2121
:target: https://pypi.python.org/pypi/vaspy/
2222
:alt: versions
2323

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
:target: https://www.python.org/downloads/release/python-351/
3131
:alt: platform
3232
33-
.. image:: https://img.shields.io/badge/pypi-v0.8.11-blue.svg
33+
.. image:: https://img.shields.io/badge/pypi-v0.8.12-blue.svg
3434
:target: https://pypi.python.org/pypi/vaspy/
3535
:alt: versions
3636

vaspy/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
PY2 = True
99

1010

11-
__version__ = '0.8.11'
11+
__version__ = '0.8.12'
1212
__all__ = ['atomco', 'electro', 'iter', 'matstudio', 'plotter', 'incar']
1313

1414

vaspy/atomco.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,24 @@ def get_cif_content(self):
229229

230230
return content
231231

232-
def get_reaxff_content(self):
232+
def get_lmp_content(self):
233233
"""
234-
Get ReaxFF data file content
234+
Get lammps data file content
235235
"""
236236
content = '# Created by VASPy\n\n'
237237

238238
# Info
239239
content += '{} atoms\n{} atom types\n\n'.format(len(self.data),
240240
len(self.atom_types))
241-
content += '0 25.000 xlo xhi\n0 25.000 ylo yhi\n0 25.000 zlo zhi\n\n'
241+
242+
# Basis info
243+
x, y, z = self.bases
244+
xhi, yhi, zhi = [np.linalg.norm(i) for i in self.bases]
245+
content += '0 {:.9f} xlo xhi\n0 {:.9f} ylo yhi\n0 {:.9f} zlo zhi\n'.format(xhi, yhi, zhi)
246+
xy = np.dot(x, y)/np.linalg.norm(x)
247+
xz = np.dot(x, z)/np.linalg.norm(x)
248+
yz = np.dot(y, z)/np.linalg.norm(y)
249+
content += '{} {} {} xy xz yz\n\n'.format(xy, xz, yz)
242250

243251
# Masses
244252
content += 'Masses\n\n'

0 commit comments

Comments
 (0)