From d1a2a53e7e9818bd246c22d1c2052d0ed5285615 Mon Sep 17 00:00:00 2001 From: Toon Verstraelen Date: Sun, 23 Jun 2024 12:59:45 +0200 Subject: [PATCH 1/3] Split the getting started docs --- docs/getting_started.rst | 202 ------------------------ docs/getting_started/dumping.rst | 61 +++++++ docs/getting_started/index.rst | 42 +++++ docs/getting_started/inputs.rst | 74 +++++++++ docs/getting_started/loading.rst | 54 +++++++ docs/getting_started/representation.rst | 33 ++++ docs/getting_started/script.rst | 32 ++++ docs/getting_started/units.rst | 39 +++++ docs/index.rst | 2 +- 9 files changed, 336 insertions(+), 203 deletions(-) delete mode 100644 docs/getting_started.rst create mode 100644 docs/getting_started/dumping.rst create mode 100644 docs/getting_started/index.rst create mode 100644 docs/getting_started/inputs.rst create mode 100644 docs/getting_started/loading.rst create mode 100644 docs/getting_started/representation.rst create mode 100644 docs/getting_started/script.rst create mode 100644 docs/getting_started/units.rst diff --git a/docs/getting_started.rst b/docs/getting_started.rst deleted file mode 100644 index 35a5b266..00000000 --- a/docs/getting_started.rst +++ /dev/null @@ -1,202 +0,0 @@ -.. - : IODATA is an input and output module for quantum chemistry. - : - : Copyright (C) 2011-2019 The IODATA Development Team - : - : This file is part of IODATA. - : - : IODATA is free software; you can redistribute it and/or - : modify it under the terms of the GNU General Public License - : as published by the Free Software Foundation; either version 3 - : of the License, or (at your option) any later version. - : - : IODATA is distributed in the hope that it will be useful, - : but WITHOUT ANY WARRANTY; without even the implied warranty of - : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - : GNU General Public License for more details. - : - : You should have received a copy of the GNU General Public License - : along with this program; if not, see - : - : -- - -Getting Started -=============== - -IOData can be used to read and write different quantum chemistry file formats. - - -Script usage ------------- - -The simplest way to use IOData, without writing any code, is to use the ``iodata-convert`` script. - -.. code-block:: bash - - iodata-convert input.fchk output.molden - -See the :code:`--help` option for more details on usage. - - -Code usage ----------- - -More complex use cases can be implemented in Python, using IOData as a library. -IOData stores an object containing the data read from the file. - - -Reading -^^^^^^^ - -To read a file, use something like this: - -.. literalinclude:: example_scripts/load_water.py - :language: python - :linenos: - :lines: 3- - -**Note that IOData will automatically convert units from the file format's -official specification to atomic units (which is the format used throughout -HORTON3).** - -The file format is inferred from the extension, but one can override the -detection mechanism by manually specifying the format: - -.. literalinclude:: example_scripts/load_water_foo.py - :language: python - :linenos: - :lines: 3- - -IOData also has basic support for loading databases of molecules. For example, -the following will iterate over all frames in an XYZ file: - -.. literalinclude:: example_scripts/load_trajectory.py - :language: python - :linenos: - :lines: 3- - -More details can be found in the API documentation of -:py:func:`iodata.api.load_one` and :py:func:`iodata.api.load_many`. - -Writing -^^^^^^^ - -IOData can also be used to write different file formats: - -.. literalinclude:: example_scripts/convert_fchk_molden.py - :language: python - :linenos: - :lines: 3- - -One could also convert (and manipulate) an entire trajectory. The following -example converts a geometry optimization trajectory from a Gaussian FCHK file -to an XYZ file: - -.. literalinclude:: example_scripts/convert_fchk_xyz_traj.py - :language: python - :linenos: - :lines: 3- - -If you wish to perform some manipulations before writing the trajectory, the -simplest way is to load the entire trajectory in a list of IOData objects and -dump it later: - -.. literalinclude:: example_scripts/convert_fchk_xyz_traj_mod1.py - :language: python - :linenos: - :lines: 3- - -For very large trajectories, you may want to avoid loading it as a whole in -memory. For this, one should avoid making the ``list`` object in the above -example. The following approach would be more memory efficient. - -.. literalinclude:: example_scripts/convert_fchk_xyz_traj_mod2.py - :language: python - :linenos: - :lines: 3- - -More details can be found in the API documentation of -:py:func:`iodata.api.dump_one` and :py:func:`iodata.api.dump_many`. - -Input files -^^^^^^^^^^^ - -IOData can be used to write input files for quantum-chemistry software. By -default minimal settings are used, which can be changed if needed. For example, -the following will prepare a Gaussian input for a HF/STO-3G calculation from -a PDB file: - -.. literalinclude:: example_scripts/write_gaussian_com.py - :language: python - :linenos: - :lines: 3- - -The level of theory and other settings can be modified by setting corresponding -attributes in the IOData object: - -.. literalinclude:: example_scripts/write_gaussian_com_lot.py - :language: python - :linenos: - :lines: 3- - -The run types can be any of the following: ``energy``, ``energy_force``, -``opt``, ``scan`` or ``freq``. These are translated into program-specific -keywords when the file is written. - -It is possible to define a custom input file template to allow for specialized -commands. This is done by passing a template string using the optional ``template`` keyword, -placing each IOData attribute (or additional keyword, as shown below) in curly brackets: - -.. literalinclude:: example_scripts/write_gaussian_com_template.py - :language: python - :linenos: - :lines: 3- - -The input file template may also include keywords that are not part of the IOData -object: - -.. literalinclude:: example_scripts/write_gaussian_com_custom.py - :language: python - :linenos: - :lines: 3- - -In some cases, it may be preferable to load the template from file, instead of -defining it in the script: - -.. literalinclude:: example_scripts/write_gaussian_com_file.py - :language: python - :linenos: - :lines: 3- - -More details can be found in the API documentation of -:py:func:`iodata.api.write_input`. - -Data representation -^^^^^^^^^^^^^^^^^^^ - -IOData can be used to represent data in a consistent format for writing at a future point. - -.. literalinclude:: example_scripts/data_representation.py - :language: python - :linenos: - :lines: 3- - -All supported attributes can be found in the API documentation of the :py:class:`iodata.iodata.IOData` class. - -.. _units: - -Unit conversion -^^^^^^^^^^^^^^^ - -IOData always represents all quantities in atomic units and unit conversion -constants are defined in ``iodata.utils``. Conversion *to* atomic units is done -by *multiplication* with a unit constant. This convention can be easily -remembered with the following examples: - -- When you say "this bond length is 1.5 Å", the IOData equivalent is - ``bond_length = 1.5 * angstrom``. - -- The conversion from atomic units is similar to axes labels in old papers. - For example. a bond length in angstrom is printed as "Bond length / Å". - Expressing this with IOData's conventions gives - ``print("Bond length in Angstrom:", bond_length / angstrom)`` diff --git a/docs/getting_started/dumping.rst b/docs/getting_started/dumping.rst new file mode 100644 index 00000000..123049f0 --- /dev/null +++ b/docs/getting_started/dumping.rst @@ -0,0 +1,61 @@ +.. + : IODATA is an input and output module for quantum chemistry. + : + : Copyright (C) 2011-2019 The IODATA Development Team + : + : This file is part of IODATA. + : + : IODATA is free software; you can redistribute it and/or + : modify it under the terms of the GNU General Public License + : as published by the Free Software Foundation; either version 3 + : of the License, or (at your option) any later version. + : + : IODATA is distributed in the hope that it will be useful, + : but WITHOUT ANY WARRANTY; without even the implied warranty of + : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + : GNU General Public License for more details. + : + : You should have received a copy of the GNU General Public License + : along with this program; if not, see + : + : -- + +Dumping Files +============= + +IOData can also be used to write different file formats: + +.. literalinclude:: ../example_scripts/convert_fchk_molden.py + :language: python + :linenos: + :lines: 3- + +One could also convert (and manipulate) an entire trajectory. The following +example converts a geometry optimization trajectory from a Gaussian FCHK file +to an XYZ file: + +.. literalinclude:: ../example_scripts/convert_fchk_xyz_traj.py + :language: python + :linenos: + :lines: 3- + +If you wish to perform some manipulations before writing the trajectory, the +simplest way is to load the entire trajectory in a list of IOData objects and +dump it later: + +.. literalinclude:: ../example_scripts/convert_fchk_xyz_traj_mod1.py + :language: python + :linenos: + :lines: 3- + +For very large trajectories, you may want to avoid loading it as a whole in +memory. For this, one should avoid making the ``list`` object in the above +example. The following approach would be more memory efficient. + +.. literalinclude:: ../example_scripts/convert_fchk_xyz_traj_mod2.py + :language: python + :linenos: + :lines: 3- + +More details can be found in the API documentation of +:py:func:`iodata.api.dump_one` and :py:func:`iodata.api.dump_many`. diff --git a/docs/getting_started/index.rst b/docs/getting_started/index.rst new file mode 100644 index 00000000..de82a76c --- /dev/null +++ b/docs/getting_started/index.rst @@ -0,0 +1,42 @@ +.. + : IODATA is an input and output module for quantum chemistry. + : + : Copyright (C) 2011-2019 The IODATA Development Team + : + : This file is part of IODATA. + : + : IODATA is free software; you can redistribute it and/or + : modify it under the terms of the GNU General Public License + : as published by the Free Software Foundation; either version 3 + : of the License, or (at your option) any later version. + : + : IODATA is distributed in the hope that it will be useful, + : but WITHOUT ANY WARRANTY; without even the implied warranty of + : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + : GNU General Public License for more details. + : + : You should have received a copy of the GNU General Public License + : along with this program; if not, see + : + : -- + +Getting Started +=============== + +IOData can be used to read and write different quantum chemistry file formats. + +One may use the ``iodata-convert`` script for simple conversions. +More complex use cases can be implemented in Python, +which allow you to access all loaded data as Python objects that can be modified or updated +before writing to a new file. + + +.. toctree:: + :maxdepth: 2 + + script + loading + dumping + inputs + representation + units diff --git a/docs/getting_started/inputs.rst b/docs/getting_started/inputs.rst new file mode 100644 index 00000000..7ab3e492 --- /dev/null +++ b/docs/getting_started/inputs.rst @@ -0,0 +1,74 @@ +.. + : IODATA is an input and output module for quantum chemistry. + : + : Copyright (C) 2011-2019 The IODATA Development Team + : + : This file is part of IODATA. + : + : IODATA is free software; you can redistribute it and/or + : modify it under the terms of the GNU General Public License + : as published by the Free Software Foundation; either version 3 + : of the License, or (at your option) any later version. + : + : IODATA is distributed in the hope that it will be useful, + : but WITHOUT ANY WARRANTY; without even the implied warranty of + : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + : GNU General Public License for more details. + : + : You should have received a copy of the GNU General Public License + : along with this program; if not, see + : + : -- + +Writing Input Files +=================== + +IOData can be used to write input files for quantum-chemistry software. By +default minimal settings are used, which can be changed if needed. For example, +the following will prepare a Gaussian input for a HF/STO-3G calculation from +a PDB file: + +.. literalinclude:: ../example_scripts/write_gaussian_com.py + :language: python + :linenos: + :lines: 3- + +The level of theory and other settings can be modified by setting corresponding +attributes in the IOData object: + +.. literalinclude:: ../example_scripts/write_gaussian_com_lot.py + :language: python + :linenos: + :lines: 3- + +The run types can be any of the following: ``energy``, ``energy_force``, +``opt``, ``scan`` or ``freq``. These are translated into program-specific +keywords when the file is written. + +It is possible to define a custom input file template to allow for specialized +commands. This is done by passing a template string using the optional ``template`` keyword, +placing each IOData attribute (or additional keyword, as shown below) in curly brackets: + +.. literalinclude:: ../example_scripts/write_gaussian_com_template.py + :language: python + :linenos: + :lines: 3- + +The input file template may also include keywords that are not part of the IOData +object: + +.. literalinclude:: ../example_scripts/write_gaussian_com_custom.py + :language: python + :linenos: + :lines: 3- + +In some cases, it may be preferable to load the template from file, instead of +defining it in the script: + +.. literalinclude:: ../example_scripts/write_gaussian_com_file.py + :language: python + :linenos: + :lines: 3- + +More details can be found in the API documentation of +:py:func:`iodata.api.write_input`. diff --git a/docs/getting_started/loading.rst b/docs/getting_started/loading.rst new file mode 100644 index 00000000..f92d8664 --- /dev/null +++ b/docs/getting_started/loading.rst @@ -0,0 +1,54 @@ +.. + : IODATA is an input and output module for quantum chemistry. + : + : Copyright (C) 2011-2019 The IODATA Development Team + : + : This file is part of IODATA. + : + : IODATA is free software; you can redistribute it and/or + : modify it under the terms of the GNU General Public License + : as published by the Free Software Foundation; either version 3 + : of the License, or (at your option) any later version. + : + : IODATA is distributed in the hope that it will be useful, + : but WITHOUT ANY WARRANTY; without even the implied warranty of + : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + : GNU General Public License for more details. + : + : You should have received a copy of the GNU General Public License + : along with this program; if not, see + : + : -- + +Loading Files +============= + +To read a file, use something like this: + +.. literalinclude:: ../example_scripts/load_water.py + :language: python + :linenos: + :lines: 3- + +**Note that IOData will automatically convert units from the file format's +official specification to atomic units (which is the format used throughout +HORTON3).** + +The file format is inferred from the extension, but one can override the +detection mechanism by manually specifying the format: + +.. literalinclude:: ../example_scripts/load_water_foo.py + :language: python + :linenos: + :lines: 3- + +IOData also has basic support for loading databases of molecules. For example, +the following will iterate over all frames in an XYZ file: + +.. literalinclude:: ../example_scripts/load_trajectory.py + :language: python + :linenos: + :lines: 3- + +More details can be found in the API documentation of +:py:func:`iodata.api.load_one` and :py:func:`iodata.api.load_many`. diff --git a/docs/getting_started/representation.rst b/docs/getting_started/representation.rst new file mode 100644 index 00000000..b869dbda --- /dev/null +++ b/docs/getting_started/representation.rst @@ -0,0 +1,33 @@ +.. + : IODATA is an input and output module for quantum chemistry. + : + : Copyright (C) 2011-2019 The IODATA Development Team + : + : This file is part of IODATA. + : + : IODATA is free software; you can redistribute it and/or + : modify it under the terms of the GNU General Public License + : as published by the Free Software Foundation; either version 3 + : of the License, or (at your option) any later version. + : + : IODATA is distributed in the hope that it will be useful, + : but WITHOUT ANY WARRANTY; without even the implied warranty of + : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + : GNU General Public License for more details. + : + : You should have received a copy of the GNU General Public License + : along with this program; if not, see + : + : -- + +Data representation +=================== + +IOData can be used to represent data in a consistent format for writing at a future point. + +.. literalinclude:: ../example_scripts/data_representation.py + :language: python + :linenos: + :lines: 3- + +All supported attributes can be found in the API documentation of the :py:class:`iodata.iodata.IOData` class. diff --git a/docs/getting_started/script.rst b/docs/getting_started/script.rst new file mode 100644 index 00000000..5ec88501 --- /dev/null +++ b/docs/getting_started/script.rst @@ -0,0 +1,32 @@ +.. + : IODATA is an input and output module for quantum chemistry. + : + : Copyright (C) 2011-2019 The IODATA Development Team + : + : This file is part of IODATA. + : + : IODATA is free software; you can redistribute it and/or + : modify it under the terms of the GNU General Public License + : as published by the Free Software Foundation; either version 3 + : of the License, or (at your option) any later version. + : + : IODATA is distributed in the hope that it will be useful, + : but WITHOUT ANY WARRANTY; without even the implied warranty of + : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + : GNU General Public License for more details. + : + : You should have received a copy of the GNU General Public License + : along with this program; if not, see + : + : -- + +Script usage +============ + +The simplest way to use IOData, without writing any code, is to use the ``iodata-convert`` script. + +.. code-block:: bash + + iodata-convert input.fchk output.molden + +See the :code:`--help` option for more details on usage. diff --git a/docs/getting_started/units.rst b/docs/getting_started/units.rst new file mode 100644 index 00000000..fefd8a50 --- /dev/null +++ b/docs/getting_started/units.rst @@ -0,0 +1,39 @@ +.. + : IODATA is an input and output module for quantum chemistry. + : + : Copyright (C) 2011-2019 The IODATA Development Team + : + : This file is part of IODATA. + : + : IODATA is free software; you can redistribute it and/or + : modify it under the terms of the GNU General Public License + : as published by the Free Software Foundation; either version 3 + : of the License, or (at your option) any later version. + : + : IODATA is distributed in the hope that it will be useful, + : but WITHOUT ANY WARRANTY; without even the implied warranty of + : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + : GNU General Public License for more details. + : + : You should have received a copy of the GNU General Public License + : along with this program; if not, see + : + : -- + +.. _units: + +Unit conversion +=============== + +IOData always represents all quantities in atomic units and unit conversion +constants are defined in ``iodata.utils``. Conversion *to* atomic units is done +by *multiplication* with a unit constant. This convention can be easily +remembered with the following examples: + +- When you say "this bond length is 1.5 Å", the IOData equivalent is + ``bond_length = 1.5 * angstrom``. + +- The conversion from atomic units is similar to axes labels in old papers. + For example. a bond length in angstrom is printed as "Bond length / Å". + Expressing this with IOData's conventions gives + ``print("Bond length in Angstrom:", bond_length / angstrom)`` diff --git a/docs/index.rst b/docs/index.rst index 83da508f..c2c7e787 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -71,7 +71,7 @@ User Documentation install how_to_cite - getting_started + getting_started/index formats inputs basis From e72b21eacab6b96583bc24f18fa4e33f0d1ba1d0 Mon Sep 17 00:00:00 2001 From: Toon Verstraelen Date: Sun, 23 Jun 2024 13:04:52 +0200 Subject: [PATCH 2/3] AI nitpicking --- docs/getting_started/units.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting_started/units.rst b/docs/getting_started/units.rst index fefd8a50..9ef8a81e 100644 --- a/docs/getting_started/units.rst +++ b/docs/getting_started/units.rst @@ -36,4 +36,4 @@ remembered with the following examples: - The conversion from atomic units is similar to axes labels in old papers. For example. a bond length in angstrom is printed as "Bond length / Å". Expressing this with IOData's conventions gives - ``print("Bond length in Angstrom:", bond_length / angstrom)`` + ``print("Bond length in Angstrom:", bond_length / angstrom)`` From ce383902d367de146523cf7487e58c7c4af89b2d Mon Sep 17 00:00:00 2001 From: Toon Verstraelen Date: Sun, 23 Jun 2024 13:07:02 +0200 Subject: [PATCH 3/3] More AI corrections --- docs/getting_started/index.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/getting_started/index.rst b/docs/getting_started/index.rst index de82a76c..f9072dc9 100644 --- a/docs/getting_started/index.rst +++ b/docs/getting_started/index.rst @@ -23,12 +23,12 @@ Getting Started =============== -IOData can be used to read and write different quantum chemistry file formats. +IOData can be used to read and write various quantum chemistry file formats. -One may use the ``iodata-convert`` script for simple conversions. +The ``iodata-convert`` script can be used for simple conversions. More complex use cases can be implemented in Python, -which allow you to access all loaded data as Python objects that can be modified or updated -before writing to a new file. +allowing you to access all loaded data as Python objects +that can be modified or updated before writing to a new file. .. toctree::