





from .imports import is_tqdm_available


if is_tqdm_available():
    from tqdm.auto import tqdm as _tqdm

from ..state import PartialState






def 				__lowerCamelCase		(						lowerCAmelCase__ = True     ,  *lowerCAmelCase__     ,  **lowerCAmelCase__     ):
       if not is_tqdm_available():
              raise ImportError('Accelerate\'s `tqdm` module requires `tqdm` to be installed. Please run `pip install tqdm`.'     )
       lowerCAmelCase__					     = False
       if main_process_only:
              lowerCAmelCase__					     = PartialState().local_process_index == 0
       return _tqdm(*lowerCAmelCase__     ,  **lowerCAmelCase__     ,  disable=lowerCAmelCase__     )

from math import log

from scipy.constants import Boltzmann, physical_constants

lowerCAmelCase__     						=			300  # TEMPERATURE (unit = K)






def 				__lowerCamelCase		(						lowerCAmelCase__     ,  lowerCAmelCase__     ,  lowerCAmelCase__     ,  ):

       if donor_conc <= 0:
              raise ValueError('Donor concentration should be positive'     )
       elif acceptor_conc <= 0:
              raise ValueError('Acceptor concentration should be positive'     )
       elif intrinsic_conc <= 0:
              raise ValueError('Intrinsic concentration should be positive'     )
       elif donor_conc <= intrinsic_conc:
              raise ValueError(
                  'Donor concentration should be greater than intrinsic concentration'     )
       elif acceptor_conc <= intrinsic_conc:
              raise ValueError(
                  'Acceptor concentration should be greater than intrinsic concentration'     )
       else:
              return (
                  Boltzmann
                  * T
                  * log((donor_conc * acceptor_conc) / intrinsic_conc**2     )
                  / physical_constants["electron volt"][0]
              )


if __name__ == "__main__":
    import doctest

    doctest.testmod()
