[ase-users] Error message: when LAMMPS imported from ase.calculators.lammpsrun

Dong gi Kang kdg4206 at gmail.com
Wed Dec 16 13:04:43 CET 2020


Hello ase users,

I have been using lammps and today I installed/compiled lammps-python which can run all the “{lammps}/examples” script without any error.

After that, I defined the environment variable: “export ASE_LAMMPSRUN_COMMAND=/path/to/lmp_binary”



However, example script gives an error message (when I use from ase.calculators.lammpslib import LAMMPSlib doesn’t give any error)

Could you please give any advice to resolve the error?



Thanking you for your time and advice in advance.

Kind regards,



Dong-gi Kang



```

``` example script ```

from ase import Atoms, Atom

from ase.calculators.lammpsrun import LAMMPS



a = [6.5, 6.5, 7.7]

d = 2.3608

NaCl = Atoms([Atom('Na', [0, 0, 0]),

              Atom('Cl', [0, 0, d])],

             cell=a, pbc=True)



calc = LAMMPS()

NaCl.calc = calc



print(NaCl.get_stress())

```



```

```Error message ```

---------------------------------------------------------------------------

FileNotFoundError                         Traceback (most recent call last)

<ipython-input-8-3b3fca2d2283> in <module>

     11 NaCl.calc = calc

     12

---> 13 print(NaCl.get_stress())



~/.local/lib/python3.7/site-packages/ase/atoms.py in get_stress(self, voigt, apply_constraint, include_ideal_gas)

    824             raise RuntimeError('Atoms object has no calculator.')

    825

--> 826         stress = self._calc.get_stress(self)

    827         shape = stress.shape

    828



~/.local/lib/python3.7/site-packages/ase/calculators/calculator.py in get_stress(self, atoms)

    700

    701     def get_stress(self, atoms=None):

--> 702         return self.get_property('stress', atoms)

    703

    704     def get_stresses(self, atoms=None):



~/.local/lib/python3.7/site-packages/ase/calculators/calculator.py in get_property(self, name, atoms, allow_calculation)

    736             if not allow_calculation:

    737                 return None

--> 738             self.calculate(atoms, [name], system_changes)

    739

    740         if name == 'magmom' and 'magmom' not in self.results:



~/.local/lib/python3.7/site-packages/ase/calculators/lammpsrun.py in calculate(self, atoms, properties, system_changes)

    319             system_changes = all_changes

    320         Calculator.calculate(self, atoms, properties, system_changes)

--> 321         self.run()

    322

    323     def _lmp_alive(self):



~/.local/lib/python3.7/site-packages/ase/calculators/lammpsrun.py in run(self, set_atoms)

    436                 shlex.split(command, posix=(os.name == "posix")),

    437                 stdin=PIPE,

--> 438                 stdout=PIPE,

    439             )

    440         lmp_handle = self._lmp_handle



/opt/miniconda3/lib/python3.7/subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)

    773                                 c2pread, c2pwrite,

    774                                 errread, errwrite,

--> 775                                 restore_signals, start_new_session)

    776         except:

    777             # Cleanup if the child failed starting.



/opt/miniconda3/lib/python3.7/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)

   1520                         if errno_num == errno.ENOENT:

   1521                             err_msg += ': ' + repr(err_filename)

-> 1522                     raise child_exception_type(errno_num, err_msg, err_filename)

   1523                 raise child_exception_type(err_msg)

   1524



FileNotFoundError: [Errno 2] No such file or directory: 'lammps': 'lammps'

```


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20201216/994f4ccd/attachment-0001.htm>


More information about the ase-users mailing list