From 20328f75bda5b66f8b077352b0ea664d1599047b Mon Sep 17 00:00:00 2001
From: Noora Azadvari <e.azadvari98@gmail.com>
Date: Tue, 30 Apr 2024 16:12:46 -0400
Subject: [PATCH 01/10] adding common issues, #1, related to issue #6396

---
 rosetta_basics/scoring/qm-energy-calculations.md | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/rosetta_basics/scoring/qm-energy-calculations.md b/rosetta_basics/scoring/qm-energy-calculations.md
index 1ef1b2c05..ebea763f3 100644
--- a/rosetta_basics/scoring/qm-energy-calculations.md
+++ b/rosetta_basics/scoring/qm-energy-calculations.md
@@ -97,3 +97,9 @@ TODO
 ### NWChem
 
 TODO
+
+# Common issues
+
+||Problem | Reason| Solution |
+|--|----|-----|----|
+|1|Errors about charge and multiplicity with FMO | open termini | The -ignore_zero_occupancy false flag is often needed. |

From f1d397a9c2c50885a73066234b18f546ba9c12c5 Mon Sep 17 00:00:00 2001
From: Noora Azadvari <e.azadvari98@gmail.com>
Date: Tue, 30 Apr 2024 17:21:48 -0400
Subject: [PATCH 02/10] Installation and setup update

---
 rosetta_basics/scoring/qm-energy-calculations.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rosetta_basics/scoring/qm-energy-calculations.md b/rosetta_basics/scoring/qm-energy-calculations.md
index ebea763f3..468cbc653 100644
--- a/rosetta_basics/scoring/qm-energy-calculations.md
+++ b/rosetta_basics/scoring/qm-energy-calculations.md
@@ -33,11 +33,11 @@ All Rosetta QM calculations are performed through calls to third-party quantum c
 
 ### The General Atomic and Molecular Electronic Structure System (GAMESS)
 
-[[GAMESS|https://www.msg.chem.iastate.edu/index.html]] is a versatile quantum chemistry package written in FORTRAN, and developed by the [[Gordon group at Iowa State University|https://www.msg.chem.iastate.edu/group/members.html]].  Users may agree to the licence agreement and obtain the software from [[the GAMESS download page|https://www.msg.chem.iastate.edu/gamess/download.html]].
+[GAMESS](https://www.msg.chem.iastate.edu/index.html) is a versatile quantum chemistry package written in FORTRAN, and developed by the [Gordon group at Iowa State University](https://www.msg.chem.iastate.edu/group/members.html).  Users may agree to the licence agreement and obtain the software from [the GAMESS download page](https://www.msg.chem.iastate.edu/gamess/download.html).
 
 #### Installation and setup
 
-To use GAMESS with Rosetta... TODO
+Here we give an example of installing `GAMESS version September 30, 2023 R2 for 64 bit x86_64 under Linux using GNU compilers`. After submitting the request to download, it takes around ???? to receive an email with the link. 
 
 #### Compiling GAMESS
 

From 65c6a37f0cdb40fdc181236260e436c1f400b647 Mon Sep 17 00:00:00 2001
From: Noora Azadvari <e.azadvari98@gmail.com>
Date: Tue, 30 Apr 2024 18:07:51 -0400
Subject: [PATCH 03/10] Using GAMESS with Rosetta update

---
 .../scoring/qm-energy-calculations.md         | 26 ++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/rosetta_basics/scoring/qm-energy-calculations.md b/rosetta_basics/scoring/qm-energy-calculations.md
index 468cbc653..0053fe84c 100644
--- a/rosetta_basics/scoring/qm-energy-calculations.md
+++ b/rosetta_basics/scoring/qm-energy-calculations.md
@@ -9,6 +9,8 @@ Page created 16 November 2021 by Vikram K. Mulligan, Flatiron Institute (vmullig
 
 Traditionally, Rosetta has used a quasi-Newtonian force field for energy calculations.  This has allowed Rosetta protocols to score a large macromolecular structure rapidly (typically in milliseconds) and repeatedly, permitting large-scale sampling of conformation and/or sequence space.  The downside, however, has been that force fields are of finite accuracy.  In late 2021, we added support for carrying out quantum mechanical energy and geometry optimization calculations in the context of a Rosetta protocol, by calling out to a third-party quantum chemistry software package.  This page summarizes how to set up and use this functionality.
 
+The protocols in RosettaQM use **Single point energy calculation** , **Geometry optimization** or a combination of them. 
+
 ## Important considerations
 
 ### Molecular system size, level of theory, and computation time
@@ -43,6 +45,28 @@ Here we give an example of installing `GAMESS version September 30, 2023 R2 for
 
 #### Using GAMESS with Rosetta
 
+You need to set `gamess_executable_version` and `gamess_path` tags in xml file. `gamess_path` 
+is the directory that contains gamess executable. In this directory you will find a file with format `gamess.$$.x` where `$$` is the executable version. 
+
+An example of using these tags in code (note that this is not a real case, and you need to use other tags to set the basis set and other configurations.)
+```
+<ROSETTASCRIPTS>
+    <SCOREFXNS>
+        <ScoreFunction name="gamess_energy" weights="empty" >
+            <Reweight scoretype="gamess_qm_energy" weight="1.0" />
+            <Set 
+                gamess_path="<path-to-gamess-directory>"
+                gamess_executable_version="<version>"
+            />
+        </ScoreFunction>
+    </SCOREFXNS>
+    <PROTOCOLS>
+        <Add metrics="gamess_energy" />
+    </PROTOCOLS>
+</ROSETTASCRIPTS>
+```
+
+
 ##### Point energy calculations with GAMESS within a Rosetta protocol
 
 A single point energy (SPE) calculation with GAMESS can be run through Rosetta directly from the command line. Depending on the user preference, the user can either use an XML script or run directly from the command-line interface. Here are two tutorials to demonstrate how this can be done:
@@ -98,7 +122,7 @@ TODO
 
 TODO
 
-# Common issues
+## Common issues
 
 ||Problem | Reason| Solution |
 |--|----|-----|----|

From 53d4ab801cfcc429569bdd07cfce2ba55615a3ae Mon Sep 17 00:00:00 2001
From: Noora Azadvari <e.azadvari98@gmail.com>
Date: Wed, 1 May 2024 12:38:20 -0400
Subject: [PATCH 04/10] Installation, setup, and compiling gamess

---
 .../scoring/qm-energy-calculations.md         | 35 ++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/rosetta_basics/scoring/qm-energy-calculations.md b/rosetta_basics/scoring/qm-energy-calculations.md
index 0053fe84c..0f5ee34ce 100644
--- a/rosetta_basics/scoring/qm-energy-calculations.md
+++ b/rosetta_basics/scoring/qm-energy-calculations.md
@@ -5,6 +5,13 @@ Page created 16 November 2021 by Vikram K. Mulligan, Flatiron Institute (vmullig
 
 [[_TOC_]]
 
+## Citation
+GAMESS needs to be cited while using RosettaQM:
+```
+[https://doi.org/10.1063/5.0005188](https://doi.org/10.1063/5.0005188)
+1 Barca, G. M. J. et al. The Journal of Chemical Physics 152, 154102 (2020)
+```
+
 ## Summary
 
 Traditionally, Rosetta has used a quasi-Newtonian force field for energy calculations.  This has allowed Rosetta protocols to score a large macromolecular structure rapidly (typically in milliseconds) and repeatedly, permitting large-scale sampling of conformation and/or sequence space.  The downside, however, has been that force fields are of finite accuracy.  In late 2021, we added support for carrying out quantum mechanical energy and geometry optimization calculations in the context of a Rosetta protocol, by calling out to a third-party quantum chemistry software package.  This page summarizes how to set up and use this functionality.
@@ -39,10 +46,36 @@ All Rosetta QM calculations are performed through calls to third-party quantum c
 
 #### Installation and setup
 
-Here we give an example of installing `GAMESS version September 30, 2023 R2 for 64 bit x86_64 under Linux using GNU compilers`. After submitting the request to download, it takes around ???? to receive an email with the link. 
+Here we give an example of installing *GAMESS version September 30, 2023 R2 for 64 bit x86_64 under Linux using GNU compilers*. After submitting the request to download, it takes around a day or less to receive an email with the link. After downloading the *.tar.gz file, transfer it 
+to the desired node if needed. Unzip the file with following command:
+
+`tar -xzvf <file-name>`
+
+It will create a directory named `gamess` with files and subfolders inside it. Change the directory to this folder with `cd gamess`. The instructions for installation are provided in `README.md` file. 
+
+Run executable `config` file with `./config`. It will ask you questions about your system. You need to open a new terminal window, to search the answers for those questions. Here are the questions:
+
+| Question | Recommended answer |
+| ------- | -------------------- |
+|What is the type of your machine?|type `uname -a` in the new window. Here we use Linux, so the answer is `linux64`. All possible options are provided as a list on the left column. |
+|Where is the GAMESS software located on your system?| Press enter for default |
+|GAMESS build directory?|This can be the same as where gamess is located. So we provide the same path again.|
+|Please provide a version number for the GAMESS executable.|Press enter for default|
+|Are you building for a specific HPC system?|Press enter for none (unless you use a specific one)|
+|Please enter your choice of FORTRAN:|gfortran|
+|Please enter only the first decimal place, such as 8.2 or 11.2:|type `gfortran -v` in the new window. the last line shows version as `gcc version xx.x.x `, enter the version with first decimal place as an answer.|
+|Enter your math library choice from one of the options below:|These libraries might be installed through modules, so it would be advised to search for them through `module spider <library-name>` and choose the best available one. The path to root can also be found through `module show <library-name>`|
+|communication library|We recommend using `sockets`.|
+|Optional: Build LibXC interface?|If your gcc version was higher that 5.5, then answer `yes`.|
+|Do you want to use LIBCCHEM 2.0?|`no`|
+|other questions|Based on your liking and system. None of them are required though.|
+
+YAY! Now you have all configurations set, and it can be found in `gamess/install.info`. Some options can still be edited, as mentioned above. 
 
 #### Compiling GAMESS
 
+Use `make` or `make -j(number_of_processors)`. You can find the number of processors in your linux system by typing `nproc` in command line. 
+
 #### Using GAMESS with Rosetta
 
 You need to set `gamess_executable_version` and `gamess_path` tags in xml file. `gamess_path` 

From ce8e51cf4eff5c00eee8fd64f7e8e284893ab4aa Mon Sep 17 00:00:00 2001
From: Noora Azadvari <e.azadvari98@gmail.com>
Date: Wed, 1 May 2024 13:25:58 -0400
Subject: [PATCH 05/10] citation typo

---
 rosetta_basics/scoring/qm-energy-calculations.md | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/rosetta_basics/scoring/qm-energy-calculations.md b/rosetta_basics/scoring/qm-energy-calculations.md
index 0f5ee34ce..c88c48ed1 100644
--- a/rosetta_basics/scoring/qm-energy-calculations.md
+++ b/rosetta_basics/scoring/qm-energy-calculations.md
@@ -7,10 +7,9 @@ Page created 16 November 2021 by Vikram K. Mulligan, Flatiron Institute (vmullig
 
 ## Citation
 GAMESS needs to be cited while using RosettaQM:
-```
-[https://doi.org/10.1063/5.0005188](https://doi.org/10.1063/5.0005188)
-1 Barca, G. M. J. et al. The Journal of Chemical Physics 152, 154102 (2020)
-```
+
+[Barca, G. M. J. et al. The Journal of Chemical Physics 152, 154102 (2020)](https://doi.org/10.1063/5.0005188)
+
 
 ## Summary
 

From e261c624507ab742e3bf2c320f6b2f650b3136ed Mon Sep 17 00:00:00 2001
From: Noora Azadvari <e.azadvari98@gmail.com>
Date: Wed, 1 May 2024 13:31:10 -0400
Subject: [PATCH 06/10] 2000 atom limit

---
 rosetta_basics/scoring/qm-energy-calculations.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rosetta_basics/scoring/qm-energy-calculations.md b/rosetta_basics/scoring/qm-energy-calculations.md
index c88c48ed1..9068bac1d 100644
--- a/rosetta_basics/scoring/qm-energy-calculations.md
+++ b/rosetta_basics/scoring/qm-energy-calculations.md
@@ -21,7 +21,7 @@ The protocols in RosettaQM use **Single point energy calculation** , **Geometry
 
 ### Molecular system size, level of theory, and computation time
 
-TODO
+GAMESS can only process 2000 atoms at time. Therefore, for systems with larger than 2000 atoms, the molecule needs to be fragmented through FMO. This limit can be increased, but it is not recommended. 
 
 ### Computer memory
 

From 283903c3221481cd9556049ab831e5c095caee6c Mon Sep 17 00:00:00 2001
From: Noora Azadvari <e.azadvari98@gmail.com>
Date: Thu, 2 May 2024 11:39:44 -0400
Subject: [PATCH 07/10] Creating page for GamessQMEnergyMetric

---
 .../simple_metric_pages/GamessQMEnergyMetric.md            | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 scripting_documentation/RosettaScripts/SimpleMetrics/simple_metric_pages/GamessQMEnergyMetric.md

diff --git a/scripting_documentation/RosettaScripts/SimpleMetrics/simple_metric_pages/GamessQMEnergyMetric.md b/scripting_documentation/RosettaScripts/SimpleMetrics/simple_metric_pages/GamessQMEnergyMetric.md
new file mode 100644
index 000000000..b29a9bc92
--- /dev/null
+++ b/scripting_documentation/RosettaScripts/SimpleMetrics/simple_metric_pages/GamessQMEnergyMetric.md
@@ -0,0 +1,7 @@
+# GamessQMEnergyMetric
+*Back to [[SimpleMetrics|SimpleMetrics]] page.*
+
+## Summary
+This simple metric caches in the pose a QM energy externally computed with GAMESS, plus additional values from the calculation.
+
+[[include:simple_metrix_GamessQMEnergyMetric]]
\ No newline at end of file

From 652a77fa665f12b2d7987dd6b87b9d925764595f Mon Sep 17 00:00:00 2001
From: Noora Azadvari <e.azadvari98@gmail.com>
Date: Thu, 2 May 2024 11:54:22 -0400
Subject: [PATCH 08/10] Creating files

---
 .../Movers/movers_pages/GamessQMGeometryOptimizationMover.md     | 1 +
 .../Movers/movers_pages/GamessQMRunScanPoseMover.md              | 1 +
 2 files changed, 2 insertions(+)
 create mode 100644 scripting_documentation/RosettaScripts/Movers/movers_pages/GamessQMGeometryOptimizationMover.md
 create mode 100644 scripting_documentation/RosettaScripts/Movers/movers_pages/GamessQMRunScanPoseMover.md

diff --git a/scripting_documentation/RosettaScripts/Movers/movers_pages/GamessQMGeometryOptimizationMover.md b/scripting_documentation/RosettaScripts/Movers/movers_pages/GamessQMGeometryOptimizationMover.md
new file mode 100644
index 000000000..145cdda55
--- /dev/null
+++ b/scripting_documentation/RosettaScripts/Movers/movers_pages/GamessQMGeometryOptimizationMover.md
@@ -0,0 +1 @@
+[[include:mover_GamessQMGeometryOptimizationMover]]
\ No newline at end of file
diff --git a/scripting_documentation/RosettaScripts/Movers/movers_pages/GamessQMRunScanPoseMover.md b/scripting_documentation/RosettaScripts/Movers/movers_pages/GamessQMRunScanPoseMover.md
new file mode 100644
index 000000000..17ec78fda
--- /dev/null
+++ b/scripting_documentation/RosettaScripts/Movers/movers_pages/GamessQMRunScanPoseMover.md
@@ -0,0 +1 @@
+[[include:mover_GamessQMRunScanPoseMover]]
\ No newline at end of file

From 76bfed1ab3051060d5d908f792ab5adb92d1bf92 Mon Sep 17 00:00:00 2001
From: "Vikram K. Mulligan" <vmulligan@flatironinstitute.org>
Date: Tue, 14 May 2024 20:38:59 -0400
Subject: [PATCH 09/10] Issue related to histidine tautomerization.

---
 rosetta_basics/scoring/qm-energy-calculations.md | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/rosetta_basics/scoring/qm-energy-calculations.md b/rosetta_basics/scoring/qm-energy-calculations.md
index 9068bac1d..13cf59dd3 100644
--- a/rosetta_basics/scoring/qm-energy-calculations.md
+++ b/rosetta_basics/scoring/qm-energy-calculations.md
@@ -2,11 +2,12 @@
 
 Back to [[Rosetta basics|Rosetta-Basics]].
 Page created 16 November 2021 by Vikram K. Mulligan, Flatiron Institute (vmulligan@flatironinstitute.org).
+Fleshed out 1 May 2024 by Noora Azadvari, University of Oregon (eazadvar@uoregon.edu).
 
 [[_TOC_]]
 
 ## Citation
-GAMESS needs to be cited while using RosettaQM:
+GAMESS needs to be cited when using RosettaQM:
 
 [Barca, G. M. J. et al. The Journal of Chemical Physics 152, 154102 (2020)](https://doi.org/10.1063/5.0005188)
 
@@ -159,3 +160,4 @@ TODO
 ||Problem | Reason| Solution |
 |--|----|-----|----|
 |1|Errors about charge and multiplicity with FMO | open termini | The -ignore_zero_occupancy false flag is often needed. |
+|2|Errors with the `-auto_setup_metals` flag (see the page on tge [[-auto_setup_metals flag|Metals]]) or the [[SetupMetalsMover]], especially with histidine.|Incorrect tautomerization of histidines that coordinate metals can result in the proton being removed from neutral histidine, yielding an improbable negatively-charged histidine and an incorrect electronic configuration of the system.|Use the [[MutateResidueMover]] to manually mutate histidine residues to either "HIS" (protonated on the epsilon nitrogen) or "HIS_D" (protonated on the delta nitrogen) tautomer, to ensure that the proton is on the nitrogen that is _not_ coordinating the metal.  Do this _prior_ to using the [[SetupMetalsMover]]|

From b58c5a7b56882e826af928ed6066ce090fe801bc Mon Sep 17 00:00:00 2001
From: "Vikram K. Mulligan" <vmulligan@flatironinstitute.org>
Date: Tue, 14 May 2024 20:44:00 -0400
Subject: [PATCH 10/10] Small tweak.

---
 rosetta_basics/scoring/qm-energy-calculations.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rosetta_basics/scoring/qm-energy-calculations.md b/rosetta_basics/scoring/qm-energy-calculations.md
index 13cf59dd3..e85f84184 100644
--- a/rosetta_basics/scoring/qm-energy-calculations.md
+++ b/rosetta_basics/scoring/qm-energy-calculations.md
@@ -160,4 +160,4 @@ TODO
 ||Problem | Reason| Solution |
 |--|----|-----|----|
 |1|Errors about charge and multiplicity with FMO | open termini | The -ignore_zero_occupancy false flag is often needed. |
-|2|Errors with the `-auto_setup_metals` flag (see the page on tge [[-auto_setup_metals flag|Metals]]) or the [[SetupMetalsMover]], especially with histidine.|Incorrect tautomerization of histidines that coordinate metals can result in the proton being removed from neutral histidine, yielding an improbable negatively-charged histidine and an incorrect electronic configuration of the system.|Use the [[MutateResidueMover]] to manually mutate histidine residues to either "HIS" (protonated on the epsilon nitrogen) or "HIS_D" (protonated on the delta nitrogen) tautomer, to ensure that the proton is on the nitrogen that is _not_ coordinating the metal.  Do this _prior_ to using the [[SetupMetalsMover]]|
+|2|Errors with the `-auto_setup_metals` flag (see the [[Metals]] page) or the [[SetupMetalsMover]], especially with histidine.|Incorrect tautomerization of histidines that coordinate metals can result in the proton being removed from neutral histidine, yielding an improbable negatively-charged histidine and an incorrect electronic configuration of the system.|Use the [[MutateResidueMover]] to manually mutate histidine residues to either "HIS" (protonated on the epsilon nitrogen) or "HIS_D" (protonated on the delta nitrogen) tautomer, to ensure that the proton is on the nitrogen that is _not_ coordinating the metal.  Do this _prior_ to using the [[SetupMetalsMover]]|