Skip to content

Commit 8d50f6f

Browse files
committed
Add basis info for lammps data
1 parent 95f91ca commit 8d50f6f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

vaspy/atomco.py

Lines changed: 11 additions & 3 deletions
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)