<commit_before># standard library imports
import sys
import os
from random import choice, random, randrange, uniform
import shutil
from uuid import uuid4

# related third party imports
import numpy as np
import yaml

# local application/library specific imports
from htsohm import config
from htsohm.db import session, Material

def random_number_density(number_density_limits, lattice_constants):
    """Returns some random number of atoms per unit cell, within the defined density limits.
    There are two inputs :
        - number_density limits        a list of the form [minimum, maximum]
        - lattice_constants            a dictionary of crystal lattice parameters of the form
                                           {"a" : <float>,
                                            "b" : <float>,
                                            "c" : <float>}
    And one output:
        - number_of_atoms              some random number of atoms per unit cell, according to
                                       predefined limits.
    """
    max_number_density = number_density_limits[1]
    a = lattice_constants["a"]
    b = lattice_constants["b"]
    c = lattice_constants["c"]
    max_number_of_atoms = int(max_number_density * a * b * c)
    number_of_atoms = randrange(2, max_number_of_atoms, 1)
    return number_of_atoms

def write_seed_definition_files(run_id, number_of_atomtypes):
    """Write .def and .cif files for a randomly-generated porous material.

    Each material is defined by it's structural information (stored in a .cif-file) and force field
    definition files:
    - <material_name>.cif            contains structural information including crystal lattice
                                     parameters and atom-site positions (and corresponding chemical
                                     species).
    - force_field.def                this file can be used to overwrite previously-defined
                                     interactions. by default there are no exceptions.
    - force_field_mixing_rules.def   this file contains sigma and epsilon values to define Lennard-
                                     Jones type interactions.
    - pseudo_atoms.def               this file contains pseudo-atom definitions, including partial
                                     charge, atomic mass, atomic radii, and more.
    """

    lattice_limits          = config["lattice_constant_limits"]
    number_density_limits   = config["number_density_limits"]
    epsilon_limits          = config["epsilon_limits"]
    sigma_limits            = config["sigma_limits"]
    max_charge              = config["charge_limit"]<commit_msg>fixed bounding lower number density limit<commit_after># standard library imports
import sys
import os
from random import choice, random, randrange, uniform
import shutil
from uuid import uuid4

# related third party imports
import numpy as np
import yaml

# local application/library specific imports
from htsohm import config
from htsohm.db import session, Material

def random_number_density(number_density_limits, lattice_constants):
    """Returns some random number of atoms per unit cell, within the defined density limits.
    There are two inputs :
        - number_density limits        a list of the form [minimum, maximum]
        - lattice_constants            a dictionary of crystal lattice parameters of the form
                                           {"a" : <float>,
                                            "b" : <float>,
                                            "c" : <float>}
    And one output:
        - number_of_atoms              some random number of atoms per unit cell, according to
                                       predefined limits.
    """
    min_ND = number_density_limits[0]
    max_ND = number_density_limits[1]
    v = lattice_constants["a"] * lattice_constants["b"] * lattice_constants["c"]
    min_atoms = int(min_ND * v)
    max_atoms = int(max_ND * v)
    if min_atoms < 2:
        min_atoms = 2
    atoms = randrange(min_atoms, max_atoms, 1)
    return atoms

def write_seed_definition_files(run_id, number_of_atomtypes):
    """Write .def and .cif files for a randomly-generated porous material.

    Each material is defined by it's structural information (stored in a .cif-file) and force field
    definition files:
    - <material_name>.cif            contains structural information including crystal lattice
                                     parameters and atom-site positions (and corresponding chemical
                                     species).
    - force_field.def                this file can be used to overwrite previously-defined
                                     interactions. by default there are no exceptions.
    - force_field_mixing_rules.def   this file contains sigma and epsilon values to define Lennard-
                                     Jones type interactions.
    - pseudo_atoms.def               this file contains pseudo-atom definitions, including partial
                                     charge, atomic mass, atomic radii, and more.
    """

    lattice_limits          = config["lattice_constant_limits"]
    number_density_limits   = config["number_density_limits"]
    epsilon_limits          = config["epsilon_limits"]
    sigma_limits            = config["sigma_limits"]
    max_charge              = config["charge_limit"]
{'fraction_non_alphanumeric': 0.05773501110288675, 'fraction_numerical': 0.001850481125092524, 'mean_word_length': 2.0212409167132477, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6477477', 'n_tokens_mistral': 1287, 'n_tokens_neox': 1256, 'n_words': 460}