OpenFTS¶
In order to run OpenFTS as a python module, your python script will look something like
import openfts
fts = openfts.OpenFTS() # create fts object
... # edit the fts object
fts.run() # run the fts object
... # extract data from fts run
Below is the comprehensive API to interface with this fts object (generated via sphinx.autodoc)
- class openfts.OpenFTS2¶
New python interface to OpenFTS C++ backend This interface is designed to be more modular and object oriented
- compute_optimal_npw(prime_factors=[2, 3], min_smearing_length=None, cell_lengths=None)¶
Using cell size and minumum species smearing length compute optimal npw using localfts object
- Parameters:
prime_factors – list of prime integer factors for allowed npw
min_smearing_length – Minimum smearing length to resolve in box. If unspecified, defaults to use values from the diferent species in box (this option was added to support Gibbs ensemble simulations)
cell_lengths – Cell lengths in each dimension. Currently cell must be orthorhombic. defaults to current simulation cell
- get_cell_tensor()¶
query localfts object and return cell tensor (in Rg3 units)
- get_cell_volume()¶
query localfts object and return cell volume (in Rg3 units)
- get_field_float_type()¶
query localfts object and return field_float_type as string
- get_min_smearing_length()¶
query localfts object and return minimum smearing length (in Rg3 units)
- get_model_Rgref()¶
query localfts object and return Rg of reference chain (using bref and Nref)
- get_model_exchange_to_species_map()¶
query localfts object and return exchange to species field mapping as matrix
- get_model_interaction_eigenvalues()¶
query localfts object and return exchange to species field mapping as matrix
- get_model_nfields()¶
query localfts object and return number of fields used in model
- get_molecule_alpha(imol)¶
query localfts object and return alpha of specified molecule
- get_molecule_ncopies(imol)¶
query localfts object and return ncopies of specified molecule
- get_runtime_mode()¶
Get the runtime mode of the OpenFTS object.
- initialize(logfile=None)¶
Initialize the C++ OpenFTS backend but do not run. Useful to query the fts object, but dont want to run a simulation.
- Parameters:
logfile – redirect stdout to logfile
- io_get_field_error()¶
Read field_error_total from final step of a completed run
- io_get_scalar_operator(key, mode='final')¶
Read a scalar operator from final step of a completed run. Uses utils.get_scalar_operator() function
- Parameters:
key – key to read from operators.dat file (or similar). See top line of file for options.
- io_get_status()¶
Read the STATUS of a completed run
- map_to_particle(**kwargs)¶
Function that takes current FTS values and writes the corresponding particle-based input files. See Driver.ParticleMap for arguements/
- run(logfile=None)¶
Run the OpenFTS module. Imports and calls the C++ backend via pybind11.
- Parameters:
logfile – redirect stdout to logfile
- write_json(filename)¶
Write fts arguments to a json file. Useful for running directly using C++ executable.
- openfts.get_scalar_operators(fname, mode)¶
read from fname and convert all data into a dictionary This is the updated version. The old version was mostly a wrapper around get_scalar_operator()
- Parameters:
filename – fts object or name of file to read. Typically operators.dat
mode – parsing mode. Options are ‘timeseries’, ‘final’, ‘average’ or ‘smart_average’
- Returns:
a dictionary where each operator is stored under a key
- Return type:
operators
- openfts.get_scalar_operator(fname, key, mode)¶
- read from filename to get operator named ‘key’
this function is very similar to openfts.io_get_scalar_operator In fact, I could probably overload this function to either take a openfts object or a filename as the first argument
- Parameters:
filename – fts object or name of file to read. Typically operators.dat
key – key to read from operators.dat file (or similar). See top line of file for options.
mode – parsing mode. Options are ‘timeseries’, ‘final’, ‘average’
- Returns:
either a scalar or a np.array depending on mode
- Return type:
operator