FermiSurfer on Web
==================

We can use FermiSurfer on Web at the following URL:
https://fermisurfer.osdn.jp/js/index.php

Control FermiSurfer on Web
--------------------------

Although we are planning to port all functions of :ref:`the app version of Fermisurfer <ops>`,
part of them have not been supported yet.

How to input file
-----------------

Fermi surfaces are displayed by choosing a local FRMSF file (BXSF is not supported yet)
through the file-explore at left top of the window.
Several time-lag may be expected.

Open online file
----------------

We can open an input file placed online by just clicking the link by a URL with an argument:

https://fermisurfer.osdn.jp/js/index.php?frmsf=https://fermisurfer.osdn.jp/js/Pb.js

We add the URL where the input file locates after ``https://fermisurfer.osdn.jp/js/index.php?frmsf=``.
This function can be used in research-introduction pages.

The input file ``Pb.js`` is as follows:

.. code-block:: javascript

   frmsf="16 16 16 1 2 -0.67303315756516724 0.67303315756516724 ... ";

This is a javascript source in which
a single-lined string generated by replacing new-line letters in :ref:`FRMSF-formatted file <input>` with spaces
is inputted into a variable ``frmsf``.
BXSF format has not been supported.

We can convert a FRMSF-formatted file into the above format as

.. code-block:: bash

   sed -e '1i frmsf="' -e '$a ";' ANY.frmsf | perl -pe 's/\n/ /g' | sed -E -e 's/ +/ /g' -e 's/" /"/g' -e 's/ "/"/g' > ANY.js

The following bash script file also do this conversion

https://fermisurfer.osdn.jp/js/frmsf2js.sh

Usage: 

.. code-block:: bash

   $ bash frmsf2js.sh ANY.frmsf

where ANY is an arbitrary string.
Then a file ``ANY.js`` which should be uploaded onto an Web server is generated.
