Skip to content

Commit

Permalink
Update lammps.
Browse files Browse the repository at this point in the history
  • Loading branch information
knc6 committed Mar 31, 2024
1 parent 610ac3c commit a8acd70
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
8 changes: 4 additions & 4 deletions jarvis/io/lammps/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ def atoms_to_lammps(self, atoms, origin=(0, 0, 0)):
xhi = a + xlo
m = atoms.lattice._lat
xy = np.dot(m[1], m[0] / a)
yhi = np.sqrt(b ** 2 - xy ** 2) + ylo
yhi = np.sqrt(b**2 - xy**2) + ylo
xz = np.dot(m[2], m[0] / a)
yz = (np.dot(m[1], m[2]) - xy * xz) / (yhi - ylo)
zhi = np.sqrt(c ** 2 - xz ** 2 - yz ** 2) + zlo
zhi = np.sqrt(c**2 - xz**2 - yz**2) + zlo
rot_matrix = np.linalg.solve(
[[xhi - xlo, 0, 0], [xy, yhi - ylo, 0], [xz, yz, zhi - zlo]], m
)
Expand Down Expand Up @@ -94,7 +94,7 @@ def read_data(
filename="lammps.data",
element_order=[],
potential_file="pot.mod",
verbose=True,
verbose=False,
has_charges=True,
):
"""Read Lammps data file."""
Expand Down Expand Up @@ -179,7 +179,7 @@ def read_data(
y[j] = float((lines[i + j + 2]).split()[it + 2])
z[j] = float((lines[i + j + 2]).split()[it + 3])
coords.append([x[j], y[j], z[j]])
print(coords[-1])
# print(coords[-1])
f.close()
# print ("info",(typ),'coo',(coords),'latt',lat)
typ_sp = [str(i, "utf-8") for i in typ]
Expand Down
8 changes: 6 additions & 2 deletions jarvis/io/lammps/outputs.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Function to analze LAMMPS output."""

import numpy as np
import glob
import os
from jarvis.analysis.elastic.tensor import ElasticTensor
from jarvis.io.lammps.inputs import LammpsData
from jarvis.io.phonopy.outputs import bandstructure_plot, total_dos
from jarvis.core.atoms import Atoms


Expand Down Expand Up @@ -251,6 +251,8 @@ def parse_material_calculation_folder(
with optimization, vacancy, phonon, surface etc.
"""
from jarvis.io.phonopy.outputs import bandstructure_plot, total_dos

cwd = os.getcwd()
jid_file = os.path.join(path, "JARVISFF-ID")
if os.path.exists(jid_file):
Expand Down Expand Up @@ -375,7 +377,9 @@ def parse_material_calculation_folder(
return info


def parse_full_ff_folder(path="Mishin-Ni-Al-2009.eam.alloy_nist",):
def parse_full_ff_folder(
path="Mishin-Ni-Al-2009.eam.alloy_nist",
):
"""Parse complete FF calculation folder."""
cwd = os.getcwd()
os.chdir(path)
Expand Down
14 changes: 9 additions & 5 deletions jarvis/tasks/lammps/lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,15 @@ def phonons(
self, atoms=None, lammps_cmd="", enforce_c_size=15.0, parameters={}
):
"""Make Phonon calculation setup."""
from phonopy import Phonopy
from phonopy.file_IO import (
# parse_FORCE_CONSTANTS,
write_FORCE_CONSTANTS,
)
try:
from phonopy import Phonopy
from phonopy.file_IO import (
# parse_FORCE_CONSTANTS,
write_FORCE_CONSTANTS,
)
except Exception as exp:
print('Phonopy check',exp)
pass

bulk = atoms.phonopy_converter()

Expand Down

0 comments on commit a8acd70

Please sign in to comment.