Example #1
0
def names_of_parameters(potential_name):
    """Lists the names of the parameters of a potential, bond order factor, charge relaxation mode or coulomb summation mode.

    For a potential, a simple list of names is returned. For a bond order factor, the
    parameters are categorised according to the number of targets they apply to
    (single element, pair, etc.). So, for a bond order factor, a list of lists is
    returned, where the first list contains the single element parameters, the second
    list the pair parameters etc.

    Parameters:

    potential_name: string
        the name of the potential or bond order factor
    """
    
    if(is_potential(potential_name)):
        param_codes = pf.pysic_interface.names_of_parameters_of_potential(potential_name).transpose()

        param_names = []
        n_params = number_of_parameters(potential_name)
        index = 0
        for code in param_codes:
            if index < n_params:
                param_names.append(pu.ints2str(code).strip())
                index += 1
                
        return param_names
    
    elif(is_bond_order_factor(potential_name)):

        n_targets = pf.pysic_interface.number_of_targets_of_bond_order_factor(potential_name)
        param_codes = [ [0] ]*2
        param_names = [ [] ]*2
        
        n_params = number_of_parameters(potential_name)
        
        for i in range(2):
            param_codes[i] = pf.pysic_interface.names_of_parameters_of_bond_order_factor(potential_name,i+1).transpose()
            param_names[i] = [""]*n_params[i]


        target_index = 0
        for target_codes in param_codes:
            index = 0
            for code in target_codes:
                if index < n_params[target_index]:
                    param_names[target_index][index] = pu.ints2str(code).strip()
                    index += 1
            target_index += 1
        return param_names

    elif(is_charge_relaxation(potential_name)):
        return ChargeRelaxation.relaxation_parameters[potential_name]

    elif(is_coulomb_summation(potential_name)):
        return CoulombSummation.summation_parameters[potential_name]
            
    else:
        return []
Example #2
0
def list_valid_potentials():
    """A list of names of potentials currently known by the core.

    The method retrieves from the core a list of the names of different potentials
    currently implemented. Since the fortran core is directly accessed, any
    updates made in the core source code should get noticed automatically.
    """
    n_pots = pf.pysic_interface.number_of_potentials()
    pot_codes = pf.pysic_interface.list_valid_potentials(n_pots).transpose()
    pot_names = []
    for code in pot_codes:
        pot_names.append(pu.ints2str(code))

    return pot_names
Example #3
0
def list_valid_bond_order_factors():
    """A list of names of bond order factors currently known by the core.

    The method retrieves from the core a list of the names of different bond factors
    currently implemented. Since the fortran core is directly accessed, any
    updates made in the core source code should get noticed automatically.
    """
    n_bonds = pf.pysic_interface.number_of_bond_order_factors()
    bond_codes = pf.pysic_interface.list_valid_bond_order_factors(n_bonds).transpose()
    bond_names = []
    for code in bond_codes:
        bond_names.append(pu.ints2str(code))

    return bond_names
Example #4
0
def list_valid_potentials():
    """A list of names of potentials currently known by the core.

    The method retrieves from the core a list of the names of different potentials
    currently implemented. Since the fortran core is directly accessed, any
    updates made in the core source code should get noticed automatically.
    """
    n_pots = pf.pysic_interface.number_of_potentials()
    pot_codes = pf.pysic_interface.list_valid_potentials(n_pots).transpose()
    pot_names = []
    for code in pot_codes:
        pot_names.append(pu.ints2str(code))

    return pot_names
Example #5
0
def list_valid_bond_order_factors():
    """A list of names of bond order factors currently known by the core.

    The method retrieves from the core a list of the names of different bond factors
    currently implemented. Since the fortran core is directly accessed, any
    updates made in the core source code should get noticed automatically.
    """
    n_bonds = pf.pysic_interface.number_of_bond_order_factors()
    bond_codes = pf.pysic_interface.list_valid_bond_order_factors(
        n_bonds).transpose()
    bond_names = []
    for code in bond_codes:
        bond_names.append(pu.ints2str(code))

    return bond_names
Example #6
0
def descriptions_of_parameters(potential_name):
    """Returns a list of strings containing physical names of the parameters of a potential, bond order factor, or charge relaxation mode,
    e.g., 'spring constant' or 'decay length'.
    
    For a potential, a simple list of descriptions is returned. For a bond order factor, the
    parameters are categorised according to the number of targets they apply to
    (single element, pair, etc.). So, for a bond order factor, a list of lists is
    returned, where the first list contains the single element parameters, the second
    list the pair parameters etc.
    
    Parameters:

    potential_name: string
        the name of the potential or bond order factor
    """

    if (is_potential(potential_name)):
        param_codes = pf.pysic_interface.descriptions_of_parameters_of_potential(
            potential_name).transpose()
        param_notes = []
        n_params = number_of_parameters(potential_name)
        index = 0
        for code in param_codes:
            if index < n_params:
                param_notes.append(pu.ints2str(code).strip())
                index += 1

    elif (is_bond_order_factor(potential_name)):
        n_targets = pf.pysic_interface.number_of_targets_of_bond_order_factor(
            potential_name)
        param_codes = [[0]] * n_targets
        param_names = [[]] * n_targets
        n_params = number_of_parameters(potential_name)

        for i in range(n_targets):
            param_codes[
                i] = pf.pysic_interface.descriptions_of_parameters_of_bond_order_factor(
                    potential_name, i + 1).transpose()
            param_names[i] = [""] * n_params[i]

        target_index = 0
        for target_codes in param_codes:
            index = 0
            for code in target_codes:
                if index < n_params[target_index]:
                    param_names[target_index][index] = pu.ints2str(
                        code).strip()
                    index += 1
            target_index += 1
        return param_names

    elif (is_charge_relaxation(potential_name)):
        return ChargeRelaxation.relaxation_parameter_descriptions[
            potential_name]

    elif (is_coulomb_summation(potential_name)):
        return CoulombSummation.summation_parameter_descriptions[
            potential_name]

    else:
        return []

    return param_notes