Dear Users,
So I am trying to develop machine learned interatomic potentials, and have installed lammps and using it on python as a module.
Am facing issue in the following code snippets.
I have my lmp executable file installed at this location.
import shutil
lmp_exe = ‘/home/johncahn/.local/bin/lmp’
if lmp_exe is not None and shutil.which(lmp_exe):
print(“LAMMPS executable found at:”, lmp_exe)
else:
print(“Error: LAMMPS executable path is invalid or not found.”)
it as a shared module am able to import in into python.
LAMMPS executable found at: /home/johncahn/.local/bin/lmp
And when i run the bispectrum coefficients snippet am running into this error.
code:
element_profile = {‘Cu’: {‘r’: 0.5, ‘w’: 1.0}}
per_atom_describer = BispectrumCoefficients(rcutfac=2.6, twojmax=6,
element_profile=element_profile,
quadratic=False,
pot_fit=False,
include_stress=False)
Cu_aimd_structures = [d[‘structure’] for d in Cu_aimd_data]
per_atom_features = per_atom_describer.transform(Cu_aimd_structures)
print(“Total # of atoms in Mo AIMD NPT: 108 * 120 = {}\n”.format(sum([len(struct) for struct in Cu_aimd_structures])),
" # of features generated: {} (one feature per atom)\n".format(per_atom_features.shape[0]),
" # of dimensions: {} (for twojmax = 6)".format(per_atom_features.shape[1]))
per_atom_features
error:
TypeError Traceback (most recent call last)
Cell In[26], line 2
1 element_profile = {‘Cu’: {‘r’: 0.5, ‘w’: 1.0}}
----> 2 per_atom_describer = BispectrumCoefficients(rcutfac=2.6, twojmax=6,
3 element_profile=element_profile,
4 quadratic=False,
5 pot_fit=False,
6 include_stress=False)
8 Cu_aimd_structures = [d[‘structure’] for d in Cu_aimd_data]
9 per_atom_features = per_atom_describer.transform(Cu_aimd_structures)
File ~/.local/lib/python3.8/site-packages/maml/describers/_site.py:79, in BispectrumCoefficients.init(self, rcutfac, twojmax, element_profile, quadratic, pot_fit, include_stress, feature_batch, **kwargs)
60 “”"
61 Args:
62 rcutfac (float): The rcutfac used in computing the cutoff between
(…)
75 **kwargs: keyword args to specify memory, verbose, and n_jobs.
76 “”"
77 from maml.apps.pes import SpectralNeighborAnalysis
—> 79 self.calculator = SpectralNeighborAnalysis(
80 rcutfac=rcutfac, twojmax=twojmax, element_profile=element_profile, quadratic=quadratic
81 )
82 self.rcutfac = rcutfac
83 self.twojmax = twojmax
File ~/.local/lib/python3.8/site-packages/maml/apps/pes/_lammps.py:291, in SpectralNeighborAnalysis.init(self, rcutfac, twojmax, element_profile, quadratic, **kwargs)
289 self.element_profile = element_profile
290 self.quadratic = quadratic
→ 291 super().init(**kwargs)
File ~/.local/lib/python3.8/site-packages/maml/apps/pes/_lammps.py:82, in LMPStaticCalculator.init(self, **kwargs)
80 if lmp_exe is None:
81 lmp_exe = get_default_lmp_exe()
—> 82 if not which(lmp_exe):
83 raise ValueError(f"lammps executable {lmp_exe} not found")
84 self.LMP_EXE = lmp_exe
File /usr/lib/python3.8/shutil.py:1379, in which(cmd, mode, path)
1367 “”“Given a command, mode, and a PATH string, return the path which
1368 conforms to the given mode on the PATH, or None if there is no such
1369 file.
(…)
1374
1375 “””
1376 # If we’re given a path with a directory part, look it up directly rather
1377 # than referring to PATH directories. This includes checking relative to the
1378 # current directory, e.g. ./script
→ 1379 if os.path.dirname(cmd):
1380 if _access_check(cmd, mode):
1381 return cmd
File /usr/lib/python3.8/posixpath.py:152, in dirname(p)
150 def dirname(p):
151 “”“Returns the directory component of a pathname”“”
→ 152 p = os.fspath(p)
153 sep = _get_sep(p)
154 i = p.rfind(sep) + 1
TypeError: expected str, bytes or os.PathLike object, not NoneType
Thanks in advance. Cheers.