Table Of Contents

Previous topic

Structure and syntax of Pysic

Next topic

Pysic class

This Page

Pysic module

Pysic is an object based calculator for atomistic many-body interactions. It is controlled via several classes such as Pysic, which defines a calculator for the ASE simulation environment [1], and Potential, which defines potentials to be used by for calculating atomic interactions.

[1]ASE: Comput. Sci. Eng., Vol. 4, 56-66, 2002; https://wiki.fysik.dtu.dk/ase/

Classes of the pysic module

Functions of the pysic module

The module defines a group of functions to directly access the Fortran core for information on available potentials.

pysic.list_potentials()

Same as list_valid_potentials()

pysic.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.

pysic.is_potential(potential_name)

Same as is_valid_potential()

Parameters:

potential_name: string
the name of the potential
pysic.is_charge_relaxation(relaxation_name)

Same as is_valid_charge_relaxation()

Parameters:

relaxation_name: string
the name of the relaxation mode
pysic.is_valid_charge_relaxation(relaxation_name)

Tells if the given string is the name of a charge relaxation mode.

Parameters:

relaxation_name: string
the name of the relaxation mode
pysic.is_valid_potential(potential_name)

Tells if the given string is the name of a potential.

Parameters:

potential_name: string
the name of the potential
pysic.list_bond_order_factors()

Same as list_valid_bond_order_factors()

pysic.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.

pysic.is_bond_order_factor(bond_order_name)

Same as is_valid_bond_order_factor()

Parameters:

bond_order_name: string
the name of the bond order factor
pysic.is_valid_bond_order_factor(bond_order_name)

Tells if the given string is the name of a bond order factor.

Parameters:

bond_order_name: string
the name of the bond order factor
pysic.number_of_targets(potential_name)

Tells how many targets a potential or bond order factor acts on, i.e., is it pair or many-body.

Parameters:

potential_name: string
the name of the potential or bond order factor
pysic.number_of_parameters(potential_name, as_list=False)

Tells how many parameters a potential, bond order factor, charge relaxation mode or coulomb summation mode incorporates.

A potential has a simple list of parameters and thus the function returns by default a single number. A bond order factor can incorporate parameters for different number of targets (some for single elements, others for pairs, etc.), and so a list of numbers is returned, representing the number of single, pair etc. parameters. If the parameter ‘as_list’ is given and is True, the result is a list containing one number also for a potential.

Parameters:

potential_name: string
the name of the potential or bond order factor
as_list: logical
should the result always be a list
pysic.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
pysic.index_of_parameter(potential_name, parameter_name)

Tells the index of a parameter of a potential or bond order factor in the list of parameters the potential uses.

For a potential, the index of the specified parameter is given. For a bond order factor, a list of two integers is given. These give the number of targets (single element, pair etc.) the parameter is associated with and the list index.

Note especially that an index is returned, and these start counting from 0. So for a bond order factor, a parameter for pairs (2 targets) will return 1 as the index for number of targets.

Parameters:

potential_name: string
the name of the potential or bond order factor
parameter_name: string
the name of the parameter
pysic.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
pysic.description_of_potential(potential_name, parameter_values=None, cutoff=None, elements=None, tags=None, indices=None)

Prints a brief description of a potential.

If optional arguments are provided, they are incorporated in the description. That is, by default the method describes the general features of a potential, but it can also be used for describing a particular potential with set parameters.

Parameters:

potential_name: string
the name of the potential
pysic.finish_mpi()

Terminates the MPI framework.

If the Fortran core is compiled in MPI mode, pysic will automatically initialize MPI upon being imported. This method terminates the MPI.

pysic.get_number_of_cpus()

Gets the number of cpus from the Fortran MPI.

pysic.get_cpu_id()

Gets the cpu ID from the Fortran MPI.