Clang-11 fixes for applied forces
[alexxy/gromacs.git] / src / gromacs / applied_forces / densityfitting / densityfittingparameters.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 2019,2020,2021, by the GROMACS development team, led by
5  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6  * and including many others, as listed in the AUTHORS file in the
7  * top-level source directory and at http://www.gromacs.org.
8  *
9  * GROMACS is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * GROMACS is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with GROMACS; if not, see
21  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23  *
24  * If you want to redistribute modifications to GROMACS, please
25  * consider that scientific software is very special. Version
26  * control is crucial - bugs must be traceable. We will be happy to
27  * consider code for inclusion in the official distribution, but
28  * derived work must not be called official GROMACS. Details are found
29  * in the README & COPYING files - if they are missing, get the
30  * official version at http://www.gromacs.org.
31  *
32  * To help us fund GROMACS development, we humbly ask that you cite
33  * the research papers on the package. Check out http://www.gromacs.org.
34  */
35 /*! \internal \file
36  * \brief
37  * Declares parameters needed to evaluate forces and energies for density fitting
38  *
39  * \author Christian Blau <blau@kth.se>
40  * \ingroup module_applied_forces
41  */
42 #ifndef GMX_APPLIED_FORCES_DENSITYFITTINGPARAMETERS_H
43 #define GMX_APPLIED_FORCES_DENSITYFITTINGPARAMETERS_H
44
45 #include <string>
46 #include <vector>
47
48 #include "gromacs/math/densityfit.h"
49 #include "gromacs/utility/basedefinitions.h"
50
51 #include "densityfittingamplitudelookup.h"
52
53 namespace gmx
54 {
55
56 /*! \internal
57  * \brief Holding all directly user-provided parameters for density fitting.
58  *
59  * Also used for setting all default parameters.
60  */
61 struct DensityFittingParameters
62 {
63     //! Indicate if density fitting is active
64     bool active_ = false;
65     //! Indices of the atoms that shall be fit to the density
66     std::vector<index> indices_;
67     //! Determines how to measure similarity between simulated and reference density
68     DensitySimilarityMeasureMethod similarityMeasureMethod_ = DensitySimilarityMeasureMethod::innerProduct;
69     //! Determines with what weight atoms are spread
70     DensityFittingAmplitudeMethod amplitudeLookupMethod_ = DensityFittingAmplitudeMethod::Unity;
71     //! The force constant to be used for the density fitting
72     real forceConstant_ = 1e9;
73     //! The spreading width used for the gauss transform of atoms onto the density grid
74     real gaussianTransformSpreadingWidth_ = 0.2;
75     //! The spreading range for spreading atoms onto the grid in multiples of the spreading width
76     real gaussianTransformSpreadingRangeInMultiplesOfWidth_ = 4.0;
77     //! Apply density fitting forces only every n-steps
78     std::int64_t calculationIntervalInSteps_ = 1;
79     //! Normalize reference and simulated densities
80     bool normalizeDensities_ = true;
81     //! Perform adaptive force scaling during the simulation
82     bool adaptiveForceScaling_ = false;
83     //! The time constant for the adaptive force scaling in ps
84     real adaptiveForceScalingTimeConstant_ = 4;
85     //! Translation of the structure, so that the coordinates that are fitted are x+translation
86     std::string translationString_;
87     //! Linear transformation of the structure, so that the coordinates that are fitted are Matrix * x
88     std::string transformationMatrixString_;
89 };
90
91 /*!\brief Check if two structs holding density fitting parameters are equal.
92  *
93  * \param[in] lhs left hand side to be compared
94  * \param[in] rhs right hand side to be compared
95  * \returns true if all elements in DensityFittingParameters are equal, else false
96  */
97 bool operator==(const DensityFittingParameters& lhs, const DensityFittingParameters& rhs);
98
99 /*!\brief Check if two structs holding density fitting parameters are not equal.
100  *
101  * \param[in] lhs left hand side to be compared
102  * \param[in] rhs right hand side to be compared
103  * \returns true if lhs is not equal rhs
104  */
105 bool operator!=(const DensityFittingParameters& lhs, const DensityFittingParameters& rhs);
106
107 } // namespace gmx
108
109 #endif // GMX_APPLIED_FORCES_DENSITYFITTINGPARAMETERS_H