From a8acd7063c9fc4283ce378403a2741bc98623731 Mon Sep 17 00:00:00 2001 From: knc6 Date: Sun, 31 Mar 2024 11:25:39 -0400 Subject: [PATCH] Update lammps. --- jarvis/io/lammps/inputs.py | 8 ++++---- jarvis/io/lammps/outputs.py | 8 ++++++-- jarvis/tasks/lammps/lammps.py | 14 +++++++++----- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/jarvis/io/lammps/inputs.py b/jarvis/io/lammps/inputs.py index 3e778087..c29ed9a9 100644 --- a/jarvis/io/lammps/inputs.py +++ b/jarvis/io/lammps/inputs.py @@ -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 ) @@ -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.""" @@ -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] diff --git a/jarvis/io/lammps/outputs.py b/jarvis/io/lammps/outputs.py index da4a4a86..32c72e1a 100644 --- a/jarvis/io/lammps/outputs.py +++ b/jarvis/io/lammps/outputs.py @@ -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 @@ -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): @@ -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) diff --git a/jarvis/tasks/lammps/lammps.py b/jarvis/tasks/lammps/lammps.py index bcf6c122..16c9cb90 100644 --- a/jarvis/tasks/lammps/lammps.py +++ b/jarvis/tasks/lammps/lammps.py @@ -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()