Added QM input file name as command-line parameter for grompp
authorDmitry Morozov <aracsmd@gmail.com>
Thu, 3 Jun 2021 14:33:14 +0000 (14:33 +0000)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 3 Jun 2021 14:33:14 +0000 (14:33 +0000)
Part of #3172

api/legacy/include/gromacs/fileio/filetypes.h
src/gromacs/fileio/filetypes.cpp
src/gromacs/gmxpreprocess/grompp.cpp
src/gromacs/options/filenameoption.cpp
src/gromacs/options/optionfiletype.h
src/gromacs/utility/mdmodulesnotifiers.h

index aefcdab357318aaeac438dc0197724bce7590c58..3a47da023470ed3743b5b1e7581dd89e9e4b22a0 100644 (file)
@@ -3,7 +3,8 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2019,2020 by the GROMACS development team.
+ * Copyright (c) 2021, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -85,6 +86,7 @@ enum GromacsFileType
     efXPM,
     efRND,
     efCSV,
+    efQMI,
     efNR
 };
 
index b3e9be6d201dba4c8f7e8e3e8eb8b9c68abfb72d..0821908cd806abd71db07052ece4a5e8c83ce504 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
  * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -144,7 +144,8 @@ static const t_deffile deffile[efNR] = {
     { eftASC, ".cub", "pot", nullptr, "Gaussian cube file" },
     { eftASC, ".xpm", "root", nullptr, "X PixMap compatible matrix file" },
     { eftASC, "", "rundir", nullptr, "Run directory" },
-    { eftASC, ".csv", "bench", nullptr, "CSV data file" }
+    { eftASC, ".csv", "bench", nullptr, "CSV data file" },
+    { eftASC, ".inp", "topol-qmmm", nullptr, "Input file for QM program" }
 };
 
 const char* ftp2ext(int ftp)
index d33220a6f68ae93ad370141f7051cc94afcf0c83..394143e8e68a1b5bfbe22972117da07782947e97 100644 (file)
@@ -1858,7 +1858,9 @@ int gmx_grompp(int argc, char* argv[])
                        { efEDR, "-e", nullptr, ffOPTRD },
                        /* This group is needed by the VMD viewer as the start configuration for IMD sessions: */
                        { efGRO, "-imd", "imdgroup", ffOPTWR },
-                       { efTRN, "-ref", "rotref", ffOPTRW | ffALLOW_MISSING } };
+                       { efTRN, "-ref", "rotref", ffOPTRW | ffALLOW_MISSING },
+                       /* This group is needed by the QMMM MDModule: */
+                       { efQMI, "-qmi", nullptr, ffOPTRD } };
 #define NFILE asize(fnm)
 
     /* Command line options */
@@ -1930,9 +1932,15 @@ int gmx_grompp(int argc, char* argv[])
     // to eventual notifications during pre-processing their data
     mdModules.subscribeToPreProcessingNotifications();
 
-    // And notify MdModules of existing logger
+    // Notify MDModules of existing logger
     mdModules.notifiers().preProcessingNotifier_.notify(logger);
 
+    // Notify QMMM MDModule of external QM input file command-line option
+    {
+        gmx::QMInputFileName qmInputFileName = { ftp2bSet(efQMI, NFILE, fnm), ftp2fn(efQMI, NFILE, fnm) };
+        mdModules.notifiers().preProcessingNotifier_.notify(qmInputFileName);
+    }
+
     if (bVerbose)
     {
         GMX_LOG(logger.info)
index 0c755aeced7e888ef0692ebd46a3a7ec816ac96c..b7c291d23ab23b1a63fbbe36396ef522d842ac33 100644 (file)
@@ -81,9 +81,9 @@ struct FileTypeMapping
 };
 
 //! Mappings from OptionFileType to file types in filetypes.h.
-constexpr EnumerationArray<OptionFileType, int> sc_fileTypeMapping = { efTPS, efTPR, efTRX,
-                                                                       efEDR, efPDB, efNDX,
-                                                                       efXVG, efDAT, efCSV };
+constexpr EnumerationArray<OptionFileType, int> sc_fileTypeMapping = { efTPS, efTPR, efTRX, efEDR,
+                                                                       efPDB, efNDX, efXVG, efDAT,
+                                                                       efCSV, efQMI };
 
 /********************************************************************
  * FileTypeHandler
index 70b672d857a7a5c37eeb6f3b1117597c2ea76197..619091cd39729dc5e9be7b851d2952d50edbbccc 100644 (file)
@@ -62,6 +62,7 @@ enum class OptionFileType : int
     Plot,
     GenericData,
     Csv,
+    QMInput,
     Count
 };
 
index 9800efe324890ea7919585e8be61250b3c3c1054..101cb09d0ffbb71ffa94204aa3bfa725337138b9 100644 (file)
@@ -138,6 +138,17 @@ struct MdRunInputFilename
     std::string mdRunFilename_;
 };
 
+/*! \libinternal \brief Notification for QM program input filename
+ *  provided by user as command-line argument for grompp
+ */
+struct QMInputFileName
+{
+    //! Flag if QM Input File has been provided by user
+    bool hasQMInputFileName_ = false;
+    //! The name of the QM Input file (.inp)
+    std::string qmInputFileName_;
+};
+
 /*! \libinternal
  * \brief Group of notifers to organize that MDModules
  * can receive callbacks they subscribe to.
@@ -242,13 +253,15 @@ struct MDModulesNotifiers
      * IndexGroupsAndNames provides modules with atom indices and their names
      * KeyValueTreeObjectBuilder enables writing of module internal data to
      *                           .tpr files.
+     * QMInputFileName Allows QMMM module to know if user provided external QM input file
      */
     BuildMDModulesNotifier<const CoordinatesAndBoxPreprocessed,
                            const MDLogger&,
                            EnergyCalculationFrequencyErrors*,
                            gmx_mtop_t*,
                            const IndexGroupsAndNames&,
-                           KeyValueTreeObjectBuilder>::type preProcessingNotifier_;
+                           KeyValueTreeObjectBuilder,
+                           QMInputFileName>::type preProcessingNotifier_;
 
     /*! \brief Handles subscribing and calling checkpointing callback functions.
      *