ectoolkits.utils.utils module#

this script put misc function here.

ectoolkits.utils.utils.create_path(path, bk=False)[source]#
create ‘path’ directory. If ‘path’ already exists, then check ‘bk’:

if ‘bk’ is True, backup original directory and create new directory naming ‘path’; if ‘bk’ is False, do nothing.

Parameters:
  • path ('str' or 'os.path') – The direcotry you are making.

  • bk (bool, optional) – If . Defaults to False.

ectoolkits.utils.utils.file_content(file, num)[source]#
ectoolkits.utils.utils.get_cum_mean(array)[source]#
ectoolkits.utils.utils.get_rdf(pos, r, nbin, frames, elements)[source]#
ectoolkits.utils.utils.get_rdf_list(pos, r, nbin, frames, elements)[source]#

pos: a list of atoms object r: the radial length nbin: the bin number in the radial range frames: how much pos number will you consider elements: the atom pair

ectoolkits.utils.utils.insert_water(atoms, z1, z2, water_num, model='random', space_x=0.3, space_y=0.3, space_z=0.3)[source]#
ectoolkits.utils.utils.mic_1d(array: ndarray[Any, dtype[float64]], cell: float, reference: Union[str, float] = 'first') ndarray[Any, dtype[float64]][source]#

Apply the minimum image convention (MIC) to a 1D array.

This function translates positions in a one-dimensional periodic system to the unit cell centered around a certain reference point. By default, the reference point is the first element of the array.

Parameters:
  • array (numpy.ndarray) – A 1D array of float values representing positions.

  • cell (float) – The length of the periodic cell.

  • reference ({'first', float}, optional) – The reference point for adjustments. Use the first element of array if ‘first’, or a custom numeric value. Defaults to ‘first’.

Returns:

The adjusted array of positions within the principal cell centered around the reference point.

Return type:

numpy.ndarray

ectoolkits.utils.utils.random() x in the interval [0, 1).#
ectoolkits.utils.utils.set_pbc(pos, cell)[source]#

set pbc for a list of Atoms object