From 2e2f19770c52cd25805a57a1698573fe69569ecf Mon Sep 17 00:00:00 2001
From: MICHAEL ROBERT DELYSER
 <mrd5285@aci-lgn-004.acib.production.int.aci.ics.psu.edu>
Date: Wed, 2 May 2018 11:14:30 -0400
Subject: [PATCH] Removed .html files. Removed compute.h mods. Cast pressure
 for functions

---
 src/USER-BOCS/README            |  3 --
 src/USER-BOCS/bocs/methanol.lmp |  6 +---
 src/USER-BOCS/doc/fix_bocs.txt  | 28 +++++-----------
 src/USER-BOCS/fix_bocs.cpp      | 58 ++++++++++++++++++---------------
 4 files changed, 41 insertions(+), 54 deletions(-)

diff --git a/src/USER-BOCS/README b/src/USER-BOCS/README
index 996375ccf7..001cb94d55 100644
--- a/src/USER-BOCS/README
+++ b/src/USER-BOCS/README
@@ -16,9 +16,6 @@ Dunn, NJH; Lebold, KM; DeLyser, MR; Rudzinski, JF; Noid, WG.
 "BOCS: Bottom-Up Open-Source Coarse-Graining Software."
 J. Phys. Chem. B. 122, 13, 3363-3377 (2018).
 
-The MOD_COMPUTE_H file is identical to the original compute.h except for 
-the two lines (three with comments) needed for USER-BOCS to work.
-
 Along with the source code files, the following files have been included 
   (in the /bocs/ directory):
 methanol.lmp
diff --git a/src/USER-BOCS/bocs/methanol.lmp b/src/USER-BOCS/bocs/methanol.lmp
index 13a71aa67e..cb0a9420f0 100644
--- a/src/USER-BOCS/bocs/methanol.lmp
+++ b/src/USER-BOCS/bocs/methanol.lmp
@@ -42,12 +42,8 @@ variable UVDW equal evdwl*4.184
 #       ID group-ID style_name thermostat T_init T_end T_couple barostat P_start P_end  P_couple pmatch_basis avg_vol     N_sites N_coeffs coeff1      coeff2
 fix 	1  all      bocs       temp       300.0  300.0 100.0    cgiso    0.986   0.986  1000.0   analytic     66476.015   968     2        245030.10   8962.20 
 
-# Compute the modified pressure
-compute 	bocsPress all pressureBocs thermo_temp
 # Report the modified pressure
-thermo_modify 	press bocsPress
-# Use the modified pressure for fix bocs instead of thermo_press
-fix_modify 	1 press bocsPress
+thermo_modify 	press 1_press
 
 
 
diff --git a/src/USER-BOCS/doc/fix_bocs.txt b/src/USER-BOCS/doc/fix_bocs.txt
index e6b9013921..8824893d65 100644
--- a/src/USER-BOCS/doc/fix_bocs.txt
+++ b/src/USER-BOCS/doc/fix_bocs.txt
@@ -27,9 +27,7 @@ fix 1 all bocs temp 300.0 300.0 100.0 cgiso 0.986 0.986 1000.0 analytic 66476.01
  
 fix 1 all bocs temp 300.0 300.0 100.0 cgiso 0.986 0.986 1000.0 cubic_spline input_Fv.dat :pre
 
-compute bocsPress all pressureBocs thermo_temp
-thermo_modify press bocsPress
-fix_modify 1 press bocsPress :pre
+thermo_modify press 1_press :pre
 
 
 [Description:]
@@ -78,23 +76,13 @@ As this is computing a (modified) pressure, group-ID should be {all}.
 The pressure correction has only been tested for use with an isotropic 
 pressure coupling in 3 dimensions.   
 
-There are three additional commands that must be supplied along with fix 
-bocs. They are given in the examples section. The name {bocsPress} can be 
-changed for any name of your choosing, provided it remains consistent across 
-all three commands. Additionally, the ID {1} in the {fix_modify} command must 
-match up with the {ID} specified in the original {fix bocs} command. Everything else 
-in those three commands must be unchanged. The first two commands can be 
-specified before the {fix bocs} command, but the {fix_modify} command must be 
-given after the original {fix bocs} command.
-
-The {compute} command tells LAMMPS to compute the pressure using the modified 
-barostat.
-
-The {thermo_modify} command tells LAMMPS to report the pressure from the modified 
-barostat instead of the default pressure, i.e. thermo_press.
-
-The {fix_modify} command tells LAMMPS to use the pressure from the modified 
-barostat for the fix, instead of using the default presure, i.e. thermo_press. 
+By default, LAMMPS will still report the normal value for the pressure
+if the pressure is printed via a {thermo} command, or if the pressures
+are written to a file every so often. In order to have LAMMPS report the
+modified pressure, you must include the {thermo_modify} command given in 
+the examples. For the last argument in the command, you should put 
+XXXX_press, where XXXX is the ID given to the fix bocs command (in the
+example, the ID of the fix bocs command is 1 ).
 
 [Related:]
 
diff --git a/src/USER-BOCS/fix_bocs.cpp b/src/USER-BOCS/fix_bocs.cpp
index 3cc02d1ea4..94f28645d5 100644
--- a/src/USER-BOCS/fix_bocs.cpp
+++ b/src/USER-BOCS/fix_bocs.cpp
@@ -36,6 +36,8 @@
 #include "error.h"
 #include "citeme.h"
 
+#include "compute_pressure_bocs.h"
+
 using namespace LAMMPS_NS;
 using namespace FixConst;
 
@@ -225,9 +227,6 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) :
                                "Supply a file name after cubic_spline.");
         p_basis_type = 2;
         spline_length = read_F_table( arg[iarg+1], p_basis_type );
-//        build_cubic_splines(); MRD I moved this into read_F_table 
-//        and that's why I pass p_basis_type in there too. I was having 
-//        a fight getting "double ** data" stuff to work
         iarg += 2;
       }  else
       {
@@ -708,7 +707,6 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) :
   delete [] newarg;
   pcomputeflag = 1;
 
-
 /*~ MRD End of stuff copied from fix_npt.cpp~*/
 
 }
@@ -787,18 +785,40 @@ void FixBocs::init()
           error->all(FLERR,"Cannot use fix npt and fix deform on "
                      "same component of stress tensor");
       } 
+  }
+
+  // set temperature and pressure ptrs
+  int icompute = modify->find_compute(id_temp);
+  if (icompute < 0)
+    error->all(FLERR,"Temperature ID for fix bocs does not exist");
+  temperature = modify->compute[icompute];
+
+  if (temperature->tempbias) which = BIAS;
+  else which = NOBIAS;
+
+  if (pstat_flag) {
+    icompute = modify->find_compute(id_press);
+    if (icompute < 0)
+      error->all(FLERR,"Pressure ID for fix bocs does not exist");
+    pressure = modify->compute[icompute];
+  }
+
+
+  if (pstat_flag)
+  {
     if (p_match_flag) // MRD NJD
-    { 
+    {
       if (pressure)
       {
         if (p_basis_type == 0)
         {
-          pressure->send_cg_info(p_basis_type, N_p_match, p_match_coeffs, 
-                                                             N_mol, vavg);
+          ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type,
+                               N_p_match, p_match_coeffs, N_mol, vavg);
         }
         else if ( p_basis_type == 1 || p_basis_type == 2 )
         {
-          pressure->send_cg_info(p_basis_type, splines, spline_length);
+          ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type,
+                                               splines, spline_length);
         }
       }
       else
@@ -809,21 +829,6 @@ void FixBocs::init()
     }
   }
 
-  // set temperature and pressure ptrs
-  int icompute = modify->find_compute(id_temp);
-  if (icompute < 0)
-    error->all(FLERR,"Temperature ID for fix bocs does not exist");
-  temperature = modify->compute[icompute];
-
-  if (temperature->tempbias) which = BIAS;
-  else which = NOBIAS;
-
-  if (pstat_flag) {
-    icompute = modify->find_compute(id_press);
-    if (icompute < 0)
-      error->all(FLERR,"Pressure ID for fix bocs does not exist");
-    pressure = modify->compute[icompute];
-  }
 
   // set timesteps and frequencies
 
@@ -1755,12 +1760,13 @@ int FixBocs::modify_param(int narg, char **arg)
     {
       if ( p_basis_type == 0 ) 
       { 
-        pressure->send_cg_info(p_basis_type, N_p_match, p_match_coeffs, 
-                                                             N_mol, vavg);
+        ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type, N_p_match, 
+                                                   p_match_coeffs, N_mol, vavg);
       }
       else if ( p_basis_type == 1 || p_basis_type == 2  ) 
       { 
-        pressure->send_cg_info(p_basis_type, splines, spline_length ); 
+        ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type, splines, 
+                                                                spline_length ); 
       }
     }
 
-- 
GitLab