narupa.lammps.mock module

Module providing a mock LAMMPS object so that the Narupa LAMMPS flow can be tested without LAMMPS installed.

class narupa.lammps.mock.MockLammps(n_atoms_in_dummy: int = None)

Bases: object

A fake LAMMPS object intended just for unit testing the LAMMPS code without having to have LAMMPS installed on a server

extract_atom(types: str, _number_type)

Generate mock element list for testing :param types: string that indicates the info that should be passed :param _number_type: unused parameter to indicate integer float. etc :return: dummy_element_list

extract_global(types: str, _number_type)

Generate mock element list for testing

replicates lammp_class.extract_global(“ntypes”, 0) :param types: LAMMPS global variable that is needed :param _number_type: unused :return: Element list.

gather_atoms(array_type: str, _dummy_variable, _array_shape)

Generates fake ctypes to mimic lammps internal pointers

Parameters:
  • array_type – determines the type of data that should be replicated
  • _dummy_variable – Unused here, only relevant to lammps
  • _array_shape – Unused here, only relevant to lammps
Returns:

matrix data_array that contains all the mock data

get_natoms()

Generate mock element list for testing

scatter_atoms(_array_type, _dummy_variable, _array_shape, _MockLammps__data_array)

Mimics lammp_class.scatter_atoms, in the mock case it does nothing Note: This can’t be static as it is designed to replicate the internal LAMMPS class