hillclimber 0.1.6__cp313-cp313-macosx_15_0_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (468) hide show
  1. hillclimber/__init__.py +41 -0
  2. hillclimber/actions.py +53 -0
  3. hillclimber/analysis.py +590 -0
  4. hillclimber/biases.py +293 -0
  5. hillclimber/calc.py +22 -0
  6. hillclimber/cvs.py +1070 -0
  7. hillclimber/interfaces.py +133 -0
  8. hillclimber/metadynamics.py +416 -0
  9. hillclimber/nodes.py +6 -0
  10. hillclimber/opes.py +359 -0
  11. hillclimber/pycv.py +362 -0
  12. hillclimber/selectors.py +230 -0
  13. hillclimber/virtual_atoms.py +341 -0
  14. hillclimber-0.1.6.dist-info/METADATA +325 -0
  15. hillclimber-0.1.6.dist-info/RECORD +468 -0
  16. hillclimber-0.1.6.dist-info/WHEEL +6 -0
  17. hillclimber-0.1.6.dist-info/entry_points.txt +8 -0
  18. hillclimber-0.1.6.dist-info/licenses/LICENSE +165 -0
  19. plumed/__init__.py +104 -0
  20. plumed/_lib/bin/plumed +0 -0
  21. plumed/_lib/bin/plumed-config +9 -0
  22. plumed/_lib/bin/plumed-patch +9 -0
  23. plumed/_lib/include/plumed/adjmat/AdjacencyMatrixBase.h +659 -0
  24. plumed/_lib/include/plumed/adjmat/ContactMatrix.h +59 -0
  25. plumed/_lib/include/plumed/asmjit/arch.h +228 -0
  26. plumed/_lib/include/plumed/asmjit/arm.h +43 -0
  27. plumed/_lib/include/plumed/asmjit/asmjit.h +69 -0
  28. plumed/_lib/include/plumed/asmjit/asmjit_apibegin.h +143 -0
  29. plumed/_lib/include/plumed/asmjit/asmjit_apiend.h +93 -0
  30. plumed/_lib/include/plumed/asmjit/asmjit_build.h +971 -0
  31. plumed/_lib/include/plumed/asmjit/assembler.h +183 -0
  32. plumed/_lib/include/plumed/asmjit/base.h +56 -0
  33. plumed/_lib/include/plumed/asmjit/codebuilder.h +944 -0
  34. plumed/_lib/include/plumed/asmjit/codecompiler.h +767 -0
  35. plumed/_lib/include/plumed/asmjit/codeemitter.h +528 -0
  36. plumed/_lib/include/plumed/asmjit/codeholder.h +777 -0
  37. plumed/_lib/include/plumed/asmjit/constpool.h +286 -0
  38. plumed/_lib/include/plumed/asmjit/cpuinfo.h +402 -0
  39. plumed/_lib/include/plumed/asmjit/func.h +1327 -0
  40. plumed/_lib/include/plumed/asmjit/globals.h +370 -0
  41. plumed/_lib/include/plumed/asmjit/inst.h +137 -0
  42. plumed/_lib/include/plumed/asmjit/logging.h +317 -0
  43. plumed/_lib/include/plumed/asmjit/misc_p.h +103 -0
  44. plumed/_lib/include/plumed/asmjit/moved_string.h +318 -0
  45. plumed/_lib/include/plumed/asmjit/operand.h +1599 -0
  46. plumed/_lib/include/plumed/asmjit/osutils.h +207 -0
  47. plumed/_lib/include/plumed/asmjit/regalloc_p.h +597 -0
  48. plumed/_lib/include/plumed/asmjit/runtime.h +227 -0
  49. plumed/_lib/include/plumed/asmjit/simdtypes.h +1104 -0
  50. plumed/_lib/include/plumed/asmjit/utils.h +1387 -0
  51. plumed/_lib/include/plumed/asmjit/vmem.h +183 -0
  52. plumed/_lib/include/plumed/asmjit/x86.h +45 -0
  53. plumed/_lib/include/plumed/asmjit/x86assembler.h +125 -0
  54. plumed/_lib/include/plumed/asmjit/x86builder.h +117 -0
  55. plumed/_lib/include/plumed/asmjit/x86compiler.h +322 -0
  56. plumed/_lib/include/plumed/asmjit/x86emitter.h +5149 -0
  57. plumed/_lib/include/plumed/asmjit/x86globals.h +535 -0
  58. plumed/_lib/include/plumed/asmjit/x86inst.h +2547 -0
  59. plumed/_lib/include/plumed/asmjit/x86instimpl_p.h +74 -0
  60. plumed/_lib/include/plumed/asmjit/x86internal_p.h +108 -0
  61. plumed/_lib/include/plumed/asmjit/x86logging_p.h +92 -0
  62. plumed/_lib/include/plumed/asmjit/x86misc.h +417 -0
  63. plumed/_lib/include/plumed/asmjit/x86operand.h +1133 -0
  64. plumed/_lib/include/plumed/asmjit/x86regalloc_p.h +734 -0
  65. plumed/_lib/include/plumed/asmjit/zone.h +1157 -0
  66. plumed/_lib/include/plumed/bias/Bias.h +82 -0
  67. plumed/_lib/include/plumed/bias/ReweightBase.h +58 -0
  68. plumed/_lib/include/plumed/blas/blas.h +253 -0
  69. plumed/_lib/include/plumed/blas/def_external.h +61 -0
  70. plumed/_lib/include/plumed/blas/def_internal.h +97 -0
  71. plumed/_lib/include/plumed/blas/real.h +49 -0
  72. plumed/_lib/include/plumed/cltools/CLTool.h +32 -0
  73. plumed/_lib/include/plumed/clusters/ClusteringBase.h +70 -0
  74. plumed/_lib/include/plumed/colvar/Colvar.h +32 -0
  75. plumed/_lib/include/plumed/colvar/ColvarInput.h +68 -0
  76. plumed/_lib/include/plumed/colvar/ColvarShortcut.h +81 -0
  77. plumed/_lib/include/plumed/colvar/CoordinationBase.h +52 -0
  78. plumed/_lib/include/plumed/colvar/MultiColvarTemplate.h +333 -0
  79. plumed/_lib/include/plumed/colvar/PathMSDBase.h +101 -0
  80. plumed/_lib/include/plumed/colvar/RMSDVector.h +78 -0
  81. plumed/_lib/include/plumed/config/Config.h +118 -0
  82. plumed/_lib/include/plumed/config/version.h +9 -0
  83. plumed/_lib/include/plumed/contour/ContourFindingObject.h +87 -0
  84. plumed/_lib/include/plumed/contour/DistanceFromContourBase.h +82 -0
  85. plumed/_lib/include/plumed/contour/FindContour.h +67 -0
  86. plumed/_lib/include/plumed/core/Action.h +540 -0
  87. plumed/_lib/include/plumed/core/ActionAnyorder.h +48 -0
  88. plumed/_lib/include/plumed/core/ActionAtomistic.h +343 -0
  89. plumed/_lib/include/plumed/core/ActionForInterface.h +99 -0
  90. plumed/_lib/include/plumed/core/ActionPilot.h +57 -0
  91. plumed/_lib/include/plumed/core/ActionRegister.h +124 -0
  92. plumed/_lib/include/plumed/core/ActionSet.h +163 -0
  93. plumed/_lib/include/plumed/core/ActionSetup.h +48 -0
  94. plumed/_lib/include/plumed/core/ActionShortcut.h +73 -0
  95. plumed/_lib/include/plumed/core/ActionToGetData.h +59 -0
  96. plumed/_lib/include/plumed/core/ActionToPutData.h +101 -0
  97. plumed/_lib/include/plumed/core/ActionWithArguments.h +140 -0
  98. plumed/_lib/include/plumed/core/ActionWithMatrix.h +87 -0
  99. plumed/_lib/include/plumed/core/ActionWithValue.h +258 -0
  100. plumed/_lib/include/plumed/core/ActionWithVector.h +94 -0
  101. plumed/_lib/include/plumed/core/ActionWithVirtualAtom.h +123 -0
  102. plumed/_lib/include/plumed/core/CLTool.h +177 -0
  103. plumed/_lib/include/plumed/core/CLToolMain.h +102 -0
  104. plumed/_lib/include/plumed/core/CLToolRegister.h +108 -0
  105. plumed/_lib/include/plumed/core/Colvar.h +115 -0
  106. plumed/_lib/include/plumed/core/DataPassingObject.h +94 -0
  107. plumed/_lib/include/plumed/core/DataPassingTools.h +54 -0
  108. plumed/_lib/include/plumed/core/DomainDecomposition.h +120 -0
  109. plumed/_lib/include/plumed/core/ExchangePatterns.h +47 -0
  110. plumed/_lib/include/plumed/core/FlexibleBin.h +63 -0
  111. plumed/_lib/include/plumed/core/GREX.h +61 -0
  112. plumed/_lib/include/plumed/core/GenericMolInfo.h +89 -0
  113. plumed/_lib/include/plumed/core/Group.h +41 -0
  114. plumed/_lib/include/plumed/core/ModuleMap.h +30 -0
  115. plumed/_lib/include/plumed/core/ParallelTaskManager.h +1023 -0
  116. plumed/_lib/include/plumed/core/PbcAction.h +61 -0
  117. plumed/_lib/include/plumed/core/PlumedMain.h +632 -0
  118. plumed/_lib/include/plumed/core/PlumedMainInitializer.h +118 -0
  119. plumed/_lib/include/plumed/core/RegisterBase.h +340 -0
  120. plumed/_lib/include/plumed/core/TargetDist.h +48 -0
  121. plumed/_lib/include/plumed/core/Value.h +547 -0
  122. plumed/_lib/include/plumed/core/WithCmd.h +93 -0
  123. plumed/_lib/include/plumed/dimred/SMACOF.h +55 -0
  124. plumed/_lib/include/plumed/drr/DRR.h +383 -0
  125. plumed/_lib/include/plumed/drr/colvar_UIestimator.h +777 -0
  126. plumed/_lib/include/plumed/fisst/legendre_rule_fast.h +44 -0
  127. plumed/_lib/include/plumed/function/Custom.h +54 -0
  128. plumed/_lib/include/plumed/function/Function.h +85 -0
  129. plumed/_lib/include/plumed/function/FunctionOfMatrix.h +368 -0
  130. plumed/_lib/include/plumed/function/FunctionOfScalar.h +135 -0
  131. plumed/_lib/include/plumed/function/FunctionOfVector.h +296 -0
  132. plumed/_lib/include/plumed/function/FunctionSetup.h +180 -0
  133. plumed/_lib/include/plumed/function/FunctionShortcut.h +130 -0
  134. plumed/_lib/include/plumed/function/FunctionWithSingleArgument.h +165 -0
  135. plumed/_lib/include/plumed/gridtools/ActionWithGrid.h +43 -0
  136. plumed/_lib/include/plumed/gridtools/EvaluateGridFunction.h +99 -0
  137. plumed/_lib/include/plumed/gridtools/FunctionOfGrid.h +295 -0
  138. plumed/_lib/include/plumed/gridtools/GridCoordinatesObject.h +179 -0
  139. plumed/_lib/include/plumed/gridtools/GridSearch.h +135 -0
  140. plumed/_lib/include/plumed/gridtools/Interpolator.h +45 -0
  141. plumed/_lib/include/plumed/gridtools/KDE.h +455 -0
  142. plumed/_lib/include/plumed/gridtools/RDF.h +40 -0
  143. plumed/_lib/include/plumed/gridtools/SumOfKernels.h +219 -0
  144. plumed/_lib/include/plumed/isdb/MetainferenceBase.h +398 -0
  145. plumed/_lib/include/plumed/lapack/def_external.h +207 -0
  146. plumed/_lib/include/plumed/lapack/def_internal.h +388 -0
  147. plumed/_lib/include/plumed/lapack/lapack.h +899 -0
  148. plumed/_lib/include/plumed/lapack/lapack_limits.h +79 -0
  149. plumed/_lib/include/plumed/lapack/real.h +50 -0
  150. plumed/_lib/include/plumed/lepton/CompiledExpression.h +164 -0
  151. plumed/_lib/include/plumed/lepton/CustomFunction.h +143 -0
  152. plumed/_lib/include/plumed/lepton/Exception.h +93 -0
  153. plumed/_lib/include/plumed/lepton/ExpressionProgram.h +137 -0
  154. plumed/_lib/include/plumed/lepton/ExpressionTreeNode.h +145 -0
  155. plumed/_lib/include/plumed/lepton/Lepton.h +85 -0
  156. plumed/_lib/include/plumed/lepton/MSVC_erfc.h +123 -0
  157. plumed/_lib/include/plumed/lepton/Operation.h +1302 -0
  158. plumed/_lib/include/plumed/lepton/ParsedExpression.h +165 -0
  159. plumed/_lib/include/plumed/lepton/Parser.h +111 -0
  160. plumed/_lib/include/plumed/lepton/windowsIncludes.h +73 -0
  161. plumed/_lib/include/plumed/mapping/Path.h +44 -0
  162. plumed/_lib/include/plumed/mapping/PathProjectionCalculator.h +57 -0
  163. plumed/_lib/include/plumed/matrixtools/MatrixOperationBase.h +54 -0
  164. plumed/_lib/include/plumed/matrixtools/MatrixTimesMatrix.h +309 -0
  165. plumed/_lib/include/plumed/matrixtools/MatrixTimesVectorBase.h +365 -0
  166. plumed/_lib/include/plumed/matrixtools/OuterProduct.h +238 -0
  167. plumed/_lib/include/plumed/maze/Core.h +65 -0
  168. plumed/_lib/include/plumed/maze/Loss.h +86 -0
  169. plumed/_lib/include/plumed/maze/Member.h +66 -0
  170. plumed/_lib/include/plumed/maze/Memetic.h +799 -0
  171. plumed/_lib/include/plumed/maze/Optimizer.h +357 -0
  172. plumed/_lib/include/plumed/maze/Random_MT.h +156 -0
  173. plumed/_lib/include/plumed/maze/Tools.h +183 -0
  174. plumed/_lib/include/plumed/metatomic/vesin.h +188 -0
  175. plumed/_lib/include/plumed/molfile/Gromacs.h +2013 -0
  176. plumed/_lib/include/plumed/molfile/endianswap.h +217 -0
  177. plumed/_lib/include/plumed/molfile/fastio.h +683 -0
  178. plumed/_lib/include/plumed/molfile/largefiles.h +78 -0
  179. plumed/_lib/include/plumed/molfile/libmolfile_plugin.h +77 -0
  180. plumed/_lib/include/plumed/molfile/molfile_plugin.h +1034 -0
  181. plumed/_lib/include/plumed/molfile/periodic_table.h +248 -0
  182. plumed/_lib/include/plumed/molfile/readpdb.h +447 -0
  183. plumed/_lib/include/plumed/molfile/vmdplugin.h +236 -0
  184. plumed/_lib/include/plumed/multicolvar/MultiColvarShortcuts.h +45 -0
  185. plumed/_lib/include/plumed/opes/ExpansionCVs.h +79 -0
  186. plumed/_lib/include/plumed/sasa/Sasa.h +32 -0
  187. plumed/_lib/include/plumed/secondarystructure/SecondaryStructureBase.h +372 -0
  188. plumed/_lib/include/plumed/setup/ActionSetup.h +25 -0
  189. plumed/_lib/include/plumed/small_vector/small_vector.h +6114 -0
  190. plumed/_lib/include/plumed/symfunc/CoordinationNumbers.h +41 -0
  191. plumed/_lib/include/plumed/tools/Angle.h +52 -0
  192. plumed/_lib/include/plumed/tools/AtomDistribution.h +138 -0
  193. plumed/_lib/include/plumed/tools/AtomNumber.h +152 -0
  194. plumed/_lib/include/plumed/tools/BiasRepresentation.h +106 -0
  195. plumed/_lib/include/plumed/tools/BitmaskEnum.h +167 -0
  196. plumed/_lib/include/plumed/tools/Brent1DRootSearch.h +159 -0
  197. plumed/_lib/include/plumed/tools/CheckInRange.h +44 -0
  198. plumed/_lib/include/plumed/tools/Citations.h +74 -0
  199. plumed/_lib/include/plumed/tools/ColvarOutput.h +118 -0
  200. plumed/_lib/include/plumed/tools/Communicator.h +316 -0
  201. plumed/_lib/include/plumed/tools/ConjugateGradient.h +80 -0
  202. plumed/_lib/include/plumed/tools/DLLoader.h +79 -0
  203. plumed/_lib/include/plumed/tools/ERMSD.h +73 -0
  204. plumed/_lib/include/plumed/tools/Exception.h +406 -0
  205. plumed/_lib/include/plumed/tools/File.h +28 -0
  206. plumed/_lib/include/plumed/tools/FileBase.h +153 -0
  207. plumed/_lib/include/plumed/tools/FileTools.h +37 -0
  208. plumed/_lib/include/plumed/tools/ForwardDecl.h +54 -0
  209. plumed/_lib/include/plumed/tools/Grid.h +638 -0
  210. plumed/_lib/include/plumed/tools/HistogramBead.h +136 -0
  211. plumed/_lib/include/plumed/tools/IFile.h +117 -0
  212. plumed/_lib/include/plumed/tools/KernelFunctions.h +113 -0
  213. plumed/_lib/include/plumed/tools/Keywords.h +380 -0
  214. plumed/_lib/include/plumed/tools/LatticeReduction.h +66 -0
  215. plumed/_lib/include/plumed/tools/LeptonCall.h +64 -0
  216. plumed/_lib/include/plumed/tools/LinkCells.h +126 -0
  217. plumed/_lib/include/plumed/tools/Log.h +41 -0
  218. plumed/_lib/include/plumed/tools/LoopUnroller.h +163 -0
  219. plumed/_lib/include/plumed/tools/Matrix.h +721 -0
  220. plumed/_lib/include/plumed/tools/MatrixSquareBracketsAccess.h +138 -0
  221. plumed/_lib/include/plumed/tools/MergeVectorTools.h +153 -0
  222. plumed/_lib/include/plumed/tools/Minimise1DBrent.h +244 -0
  223. plumed/_lib/include/plumed/tools/MinimiseBase.h +120 -0
  224. plumed/_lib/include/plumed/tools/MolDataClass.h +51 -0
  225. plumed/_lib/include/plumed/tools/NeighborList.h +112 -0
  226. plumed/_lib/include/plumed/tools/OFile.h +286 -0
  227. plumed/_lib/include/plumed/tools/OpenACC.h +180 -0
  228. plumed/_lib/include/plumed/tools/OpenMP.h +75 -0
  229. plumed/_lib/include/plumed/tools/PDB.h +154 -0
  230. plumed/_lib/include/plumed/tools/Pbc.h +139 -0
  231. plumed/_lib/include/plumed/tools/PlumedHandle.h +105 -0
  232. plumed/_lib/include/plumed/tools/RMSD.h +493 -0
  233. plumed/_lib/include/plumed/tools/Random.h +80 -0
  234. plumed/_lib/include/plumed/tools/RootFindingBase.h +79 -0
  235. plumed/_lib/include/plumed/tools/Stopwatch.h +475 -0
  236. plumed/_lib/include/plumed/tools/Subprocess.h +142 -0
  237. plumed/_lib/include/plumed/tools/SwitchingFunction.h +208 -0
  238. plumed/_lib/include/plumed/tools/Tensor.h +724 -0
  239. plumed/_lib/include/plumed/tools/TokenizedLine.h +123 -0
  240. plumed/_lib/include/plumed/tools/Tools.h +638 -0
  241. plumed/_lib/include/plumed/tools/Torsion.h +55 -0
  242. plumed/_lib/include/plumed/tools/TrajectoryParser.h +118 -0
  243. plumed/_lib/include/plumed/tools/Tree.h +61 -0
  244. plumed/_lib/include/plumed/tools/TypesafePtr.h +463 -0
  245. plumed/_lib/include/plumed/tools/Units.h +167 -0
  246. plumed/_lib/include/plumed/tools/Vector.h +433 -0
  247. plumed/_lib/include/plumed/tools/View.h +296 -0
  248. plumed/_lib/include/plumed/tools/View2D.h +100 -0
  249. plumed/_lib/include/plumed/tools/h36.h +39 -0
  250. plumed/_lib/include/plumed/vatom/ActionWithVirtualAtom.h +32 -0
  251. plumed/_lib/include/plumed/ves/BasisFunctions.h +380 -0
  252. plumed/_lib/include/plumed/ves/CoeffsBase.h +310 -0
  253. plumed/_lib/include/plumed/ves/CoeffsMatrix.h +220 -0
  254. plumed/_lib/include/plumed/ves/CoeffsVector.h +251 -0
  255. plumed/_lib/include/plumed/ves/FermiSwitchingFunction.h +74 -0
  256. plumed/_lib/include/plumed/ves/GridIntegrationWeights.h +50 -0
  257. plumed/_lib/include/plumed/ves/GridLinearInterpolation.h +81 -0
  258. plumed/_lib/include/plumed/ves/GridProjWeights.h +61 -0
  259. plumed/_lib/include/plumed/ves/LinearBasisSetExpansion.h +303 -0
  260. plumed/_lib/include/plumed/ves/Optimizer.h +444 -0
  261. plumed/_lib/include/plumed/ves/TargetDistModifer.h +53 -0
  262. plumed/_lib/include/plumed/ves/TargetDistribution.h +266 -0
  263. plumed/_lib/include/plumed/ves/VesBias.h +545 -0
  264. plumed/_lib/include/plumed/ves/VesTools.h +142 -0
  265. plumed/_lib/include/plumed/ves/WaveletGrid.h +75 -0
  266. plumed/_lib/include/plumed/volumes/ActionVolume.h +268 -0
  267. plumed/_lib/include/plumed/volumes/VolumeShortcut.h +147 -0
  268. plumed/_lib/include/plumed/wrapper/Plumed.h +5025 -0
  269. plumed/_lib/include/plumed/xdrfile/xdrfile.h +663 -0
  270. plumed/_lib/include/plumed/xdrfile/xdrfile_trr.h +89 -0
  271. plumed/_lib/include/plumed/xdrfile/xdrfile_xtc.h +90 -0
  272. plumed/_lib/lib/PythonCVInterface.dylib +0 -0
  273. plumed/_lib/lib/libplumed.dylib +0 -0
  274. plumed/_lib/lib/libplumedKernel.dylib +0 -0
  275. plumed/_lib/lib/libplumedWrapper.a +0 -0
  276. plumed/_lib/lib/pkgconfig/plumed.pc +13 -0
  277. plumed/_lib/lib/pkgconfig/plumedInternals.pc +13 -0
  278. plumed/_lib/lib/pkgconfig/plumedWrapper.pc +13 -0
  279. plumed/_lib/lib/plumed/fortran/plumed.f90 +879 -0
  280. plumed/_lib/lib/plumed/fortran/plumed_f08.f90 +2625 -0
  281. plumed/_lib/lib/plumed/modulefile +69 -0
  282. plumed/_lib/lib/plumed/patches/gromacs-2022.5.config +43 -0
  283. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/CMakeLists.txt +543 -0
  284. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/CMakeLists.txt.preplumed +540 -0
  285. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/expanded.cpp +1628 -0
  286. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/expanded.cpp.preplumed +1590 -0
  287. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/expanded.h +103 -0
  288. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/expanded.h.preplumed +99 -0
  289. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/sim_util.cpp +2527 -0
  290. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/sim_util.cpp.preplumed +2513 -0
  291. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/legacymdrunoptions.cpp +208 -0
  292. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/legacymdrunoptions.cpp.preplumed +175 -0
  293. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/legacymdrunoptions.h +408 -0
  294. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/legacymdrunoptions.h.preplumed +394 -0
  295. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/md.cpp +2348 -0
  296. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/md.cpp.preplumed +2091 -0
  297. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/minimize.cpp +3573 -0
  298. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/minimize.cpp.preplumed +3495 -0
  299. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/replicaexchange.cpp +1506 -0
  300. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/replicaexchange.cpp.preplumed +1402 -0
  301. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/replicaexchange.h +114 -0
  302. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/replicaexchange.h.preplumed +106 -0
  303. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/rerun.cpp +997 -0
  304. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/rerun.cpp.preplumed +906 -0
  305. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/runner.cpp +2780 -0
  306. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/runner.cpp.preplumed +2738 -0
  307. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp +224 -0
  308. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp.preplumed +222 -0
  309. plumed/_lib/lib/plumed/patches/gromacs-2023.5.config +43 -0
  310. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/CMakeLists.txt +549 -0
  311. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/CMakeLists.txt.preplumed +546 -0
  312. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/expanded.cpp +1632 -0
  313. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/expanded.cpp.preplumed +1594 -0
  314. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/expanded.h +104 -0
  315. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/expanded.h.preplumed +100 -0
  316. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/sim_util.cpp +2624 -0
  317. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/sim_util.cpp.preplumed +2610 -0
  318. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/legacymdrunoptions.cpp +208 -0
  319. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/legacymdrunoptions.cpp.preplumed +175 -0
  320. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/legacymdrunoptions.h +409 -0
  321. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/legacymdrunoptions.h.preplumed +395 -0
  322. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/md.cpp +2419 -0
  323. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/md.cpp.preplumed +2164 -0
  324. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/minimize.cpp +3546 -0
  325. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/minimize.cpp.preplumed +3468 -0
  326. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/replicaexchange.cpp +1513 -0
  327. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/replicaexchange.cpp.preplumed +1409 -0
  328. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/replicaexchange.h +114 -0
  329. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/replicaexchange.h.preplumed +106 -0
  330. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/rerun.cpp +991 -0
  331. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/rerun.cpp.preplumed +900 -0
  332. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/runner.cpp +2895 -0
  333. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/runner.cpp.preplumed +2849 -0
  334. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp +224 -0
  335. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp.preplumed +222 -0
  336. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/taskassignment/decidegpuusage.cpp +886 -0
  337. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/taskassignment/decidegpuusage.cpp.preplumed +880 -0
  338. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/taskassignment/include/gromacs/taskassignment/decidegpuusage.h +347 -0
  339. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/taskassignment/include/gromacs/taskassignment/decidegpuusage.h.preplumed +345 -0
  340. plumed/_lib/lib/plumed/patches/gromacs-2024.3.config +43 -0
  341. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/CMakeLists.txt +575 -0
  342. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/CMakeLists.txt.preplumed +572 -0
  343. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/expanded.cpp +1632 -0
  344. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/expanded.cpp.preplumed +1594 -0
  345. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/expanded.h +104 -0
  346. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/expanded.h.preplumed +100 -0
  347. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/sim_util.cpp +2564 -0
  348. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/sim_util.cpp.preplumed +2550 -0
  349. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/legacymdrunoptions.cpp +208 -0
  350. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/legacymdrunoptions.cpp.preplumed +175 -0
  351. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/legacymdrunoptions.h +410 -0
  352. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/legacymdrunoptions.h.preplumed +396 -0
  353. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/md.cpp +2435 -0
  354. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/md.cpp.preplumed +2187 -0
  355. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/minimize.cpp +3592 -0
  356. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/minimize.cpp.preplumed +3514 -0
  357. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/replicaexchange.cpp +1513 -0
  358. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/replicaexchange.cpp.preplumed +1409 -0
  359. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/replicaexchange.h +114 -0
  360. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/replicaexchange.h.preplumed +106 -0
  361. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/rerun.cpp +958 -0
  362. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/rerun.cpp.preplumed +929 -0
  363. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/runner.cpp +2987 -0
  364. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/runner.cpp.preplumed +2941 -0
  365. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp +224 -0
  366. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp.preplumed +222 -0
  367. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/taskassignment/decidegpuusage.cpp +904 -0
  368. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/taskassignment/decidegpuusage.cpp.preplumed +898 -0
  369. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/taskassignment/include/gromacs/taskassignment/decidegpuusage.h +353 -0
  370. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/taskassignment/include/gromacs/taskassignment/decidegpuusage.h.preplumed +351 -0
  371. plumed/_lib/lib/plumed/patches/gromacs-2025.0.config +39 -0
  372. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/cmake/gmxManagePlumed.cmake +82 -0
  373. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/cmake/gmxManagePlumed.cmake.preplumed +82 -0
  374. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedMDModule.cpp +162 -0
  375. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedMDModule.cpp.preplumed +154 -0
  376. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedOptions.cpp +107 -0
  377. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedOptions.cpp.preplumed +99 -0
  378. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedOptions.h +120 -0
  379. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedOptions.h.preplumed +111 -0
  380. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedforceprovider.cpp +215 -0
  381. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedforceprovider.cpp.preplumed +197 -0
  382. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedforceprovider.h +87 -0
  383. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedforceprovider.h.preplumed +86 -0
  384. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/mdrun/runner.cpp +2971 -0
  385. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/mdrun/runner.cpp.preplumed +2970 -0
  386. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/mdrunutility/mdmodulesnotifiers.h +430 -0
  387. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/mdrunutility/mdmodulesnotifiers.h.preplumed +429 -0
  388. plumed/_lib/lib/plumed/patches/namd-2.12.config +30 -0
  389. plumed/_lib/lib/plumed/patches/namd-2.12.diff +267 -0
  390. plumed/_lib/lib/plumed/patches/namd-2.13.config +30 -0
  391. plumed/_lib/lib/plumed/patches/namd-2.13.diff +267 -0
  392. plumed/_lib/lib/plumed/patches/namd-2.14.config +30 -0
  393. plumed/_lib/lib/plumed/patches/namd-2.14.diff +268 -0
  394. plumed/_lib/lib/plumed/patches/patch.sh +500 -0
  395. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.config +25 -0
  396. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/forces.f90 +368 -0
  397. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/forces.f90.preplumed +366 -0
  398. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/plugin_forces.f90 +71 -0
  399. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/plugin_forces.f90.preplumed +24 -0
  400. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/plugin_initialization.f90 +62 -0
  401. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/plugin_initialization.f90.preplumed +21 -0
  402. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/pwscf.f90 +189 -0
  403. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/pwscf.f90.preplumed +185 -0
  404. plumed/_lib/lib/plumed/patches/qespresso-6.2.config +26 -0
  405. plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/forces.f90 +422 -0
  406. plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/forces.f90.preplumed +420 -0
  407. plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/plugin_ext_forces.f90 +70 -0
  408. plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/plugin_ext_forces.f90.preplumed +23 -0
  409. plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/plugin_initialization.f90 +62 -0
  410. plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/plugin_initialization.f90.preplumed +21 -0
  411. plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/run_pwscf.f90 +233 -0
  412. plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/run_pwscf.f90.preplumed +230 -0
  413. plumed/_lib/lib/plumed/patches/qespresso-7.0.config +28 -0
  414. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/Modules/Makefile +175 -0
  415. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/Modules/Makefile.preplumed +171 -0
  416. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/forces.f90 +486 -0
  417. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/forces.f90.preplumed +484 -0
  418. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/plugin_ext_forces.f90 +74 -0
  419. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/plugin_ext_forces.f90.preplumed +23 -0
  420. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/plugin_initialization.f90 +64 -0
  421. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/plugin_initialization.f90.preplumed +21 -0
  422. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/run_pwscf.f90 +532 -0
  423. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/run_pwscf.f90.preplumed +518 -0
  424. plumed/_lib/lib/plumed/patches/qespresso-7.2.config +28 -0
  425. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/Modules/Makefile +249 -0
  426. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/Modules/Makefile.preplumed +244 -0
  427. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/forces.f90 +532 -0
  428. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/forces.f90.preplumed +535 -0
  429. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/plugin_ext_forces.f90 +74 -0
  430. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/plugin_ext_forces.f90.preplumed +23 -0
  431. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/plugin_initialization.f90 +64 -0
  432. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/plugin_initialization.f90.preplumed +21 -0
  433. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/run_pwscf.f90 +569 -0
  434. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/run_pwscf.f90.preplumed +560 -0
  435. plumed/_lib/lib/plumed/plumed-config +9 -0
  436. plumed/_lib/lib/plumed/plumed-mklib +9 -0
  437. plumed/_lib/lib/plumed/plumed-newcv +9 -0
  438. plumed/_lib/lib/plumed/plumed-partial_tempering +9 -0
  439. plumed/_lib/lib/plumed/plumed-patch +9 -0
  440. plumed/_lib/lib/plumed/plumed-runtime +0 -0
  441. plumed/_lib/lib/plumed/plumed-selector +9 -0
  442. plumed/_lib/lib/plumed/plumed-vim2html +9 -0
  443. plumed/_lib/lib/plumed/scripts/config.sh +126 -0
  444. plumed/_lib/lib/plumed/scripts/mklib.sh +175 -0
  445. plumed/_lib/lib/plumed/scripts/newcv.sh +26 -0
  446. plumed/_lib/lib/plumed/scripts/partial_tempering.sh +319 -0
  447. plumed/_lib/lib/plumed/scripts/patch.sh +4 -0
  448. plumed/_lib/lib/plumed/scripts/selector.sh +234 -0
  449. plumed/_lib/lib/plumed/scripts/vim2html.sh +190 -0
  450. plumed/_lib/lib/plumed/src/colvar/Template.cpp +116 -0
  451. plumed/_lib/lib/plumed/src/config/compile_options.sh +3 -0
  452. plumed/_lib/lib/plumed/src/config/config.txt +181 -0
  453. plumed/_lib/lib/plumed/src/lib/Plumed.cmake +6 -0
  454. plumed/_lib/lib/plumed/src/lib/Plumed.cmake.runtime +5 -0
  455. plumed/_lib/lib/plumed/src/lib/Plumed.cmake.shared +5 -0
  456. plumed/_lib/lib/plumed/src/lib/Plumed.cmake.static +3 -0
  457. plumed/_lib/lib/plumed/src/lib/Plumed.inc +6 -0
  458. plumed/_lib/lib/plumed/src/lib/Plumed.inc.runtime +5 -0
  459. plumed/_lib/lib/plumed/src/lib/Plumed.inc.shared +5 -0
  460. plumed/_lib/lib/plumed/src/lib/Plumed.inc.static +3 -0
  461. plumed/_lib/lib/plumed/vim/scripts.vim +6 -0
  462. plumed/_plumed_core.cpython-311-darwin.so +0 -0
  463. plumed/_plumed_core.cpython-312-darwin.so +0 -0
  464. plumed/_plumed_core.cpython-313-darwin.so +0 -0
  465. plumedCommunications.cpython-311-darwin.so +0 -0
  466. plumedCommunications.cpython-312-darwin.so +0 -0
  467. plumedCommunications.cpython-313-darwin.so +0 -0
  468. plumedCommunications.pyi +431 -0
@@ -0,0 +1,724 @@
1
+ /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2
+ Copyright (c) 2011-2023 The plumed team
3
+ (see the PEOPLE file at the root of the distribution for a list of names)
4
+
5
+ See http://www.plumed.org for more information.
6
+
7
+ This file is part of plumed, version 2.
8
+
9
+ plumed is free software: you can redistribute it and/or modify
10
+ it under the terms of the GNU Lesser General Public License as published by
11
+ the Free Software Foundation, either version 3 of the License, or
12
+ (at your option) any later version.
13
+
14
+ plumed 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
17
+ GNU Lesser General Public License for more details.
18
+
19
+ You should have received a copy of the GNU Lesser General Public License
20
+ along with plumed. If not, see <http://www.gnu.org/licenses/>.
21
+ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
22
+ #ifndef __PLUMED_tools_Tensor_h
23
+ #define __PLUMED_tools_Tensor_h
24
+
25
+ #include "MatrixSquareBracketsAccess.h"
26
+ #include "Vector.h"
27
+ #include "LoopUnroller.h"
28
+ #include "Exception.h"
29
+
30
+ #include <array>
31
+ #include <type_traits>
32
+
33
+ namespace PLMD {
34
+
35
+ //should I add something for calling ssyevr?
36
+ /// Small class to contain local utilities.
37
+ /// Should not be used outside of the TensorGeneric class.
38
+ struct TensorGenericAux {
39
+ // local redefinition, just to avoid including lapack.h here
40
+ static void local_xsyevr(const char *jobz, const char *range, const char *uplo, int *n,
41
+ double *a, int *lda, double *vl, double *vu, int *
42
+ il, int *iu, double *abstol, int *m, double *w,
43
+ double *z__, int *ldz, int *isuppz, double *work,
44
+ int *lwork, int *iwork, int *liwork, int *info);
45
+ static void local_xsyevr(const char *jobz, const char *range, const char *uplo, int *n,
46
+ float *a, int *lda, float *vl, float *vu, int *
47
+ il, int *iu, float *abstol, int *m, float *w,
48
+ float *z__, int *ldz, int *isuppz, float *work,
49
+ int *lwork, int *iwork, int *liwork, int *info);
50
+ };
51
+
52
+ /**
53
+ \ingroup TOOLBOX
54
+ Class implementing fixed size matrices of doubles
55
+
56
+ \tparam n The number rows
57
+ \tparam m The number columns
58
+
59
+ This class implements a matrix of doubles with size fixed at
60
+ compile time. It is useful for small fixed size objects (e.g.
61
+ 3x3 tensors) as it does not waste space to store the vector size.
62
+ Moreover, as the compiler knows the size, it can be completely
63
+ opimized inline.
64
+ Most of the loops are explicitly unrolled using PLMD::LoopUnroller class
65
+ Matrix elements are initialized to zero by default. Notice that
66
+ this means that constructor is a bit slow. This point might change
67
+ in future if we find performance issues.
68
+ It takes advantage of MatrixSquareBracketsAccess to provide both
69
+ () and [] syntax for access.
70
+ Several functions are declared as friends even if not necessary so as to
71
+ properly appear in Doxygen documentation.
72
+
73
+ Aliases are defined to simplify common declarations (Tensor, Tensor2d, Tensor3d, Tensor4d).
74
+ Also notice that some operations are only available for 3x3 tensors.
75
+
76
+ Example of usage
77
+ \verbatim
78
+
79
+ #include "Tensor.h"
80
+
81
+ using namespace PLMD;
82
+
83
+ int main(){
84
+ Tensor a;
85
+ TensorGeneric<3,2> b;
86
+ TensorGeneric<3,2> c=matmul(a,b);
87
+ return 0;
88
+ }
89
+
90
+ \endverbatim
91
+ */
92
+ template<typename T, unsigned n, unsigned m> class TensorTyped;
93
+
94
+ template<typename T, unsigned n, unsigned m>
95
+ std::ostream & operator<<(std::ostream &os, const TensorTyped<T,n,m>& t);
96
+
97
+ /// Compute the Frobenius norm 2.
98
+ template<typename T, unsigned n, unsigned m>
99
+ T frobeniusNorm(const TensorTyped<T,m,n>&t);
100
+
101
+ /// Diagonalize tensor.
102
+ /// Syntax is the same as Matrix::diagMat.
103
+ /// In addition, it is possible to call if with m smaller than n. In this case,
104
+ /// only the first (smaller) m eigenvalues and eigenvectors are retrieved.
105
+ /// If case lapack fails (info!=0) it throws an exception.
106
+ /// Notice that tensor is assumed to be symmetric!!!
107
+
108
+ template<typename T, unsigned n,unsigned m>
109
+ void diagMatSym(const TensorTyped<T,n,n>&,VectorTyped<T,m>&evals,TensorTyped<T,m,n>&evec);
110
+ /// Compute lowest eigenvalue and eigenvector, using a branchless iterative implementation.
111
+ /// This function is amenable for running on openACC.
112
+ /// The accuracy could be controlled increasing the number of iterations. The default value (24)
113
+ /// seems sufficient for most applications.
114
+ /// In principle, it could be extended to compute m eigenvalues by:
115
+ /// - computing the lowest
116
+ /// - compute the proper projector and reduce the matrix to <n-1,n-1>
117
+ /// - proceed iteratively
118
+ /// The interface should then be likely the same as diagMatSym
119
+ template<typename T, unsigned n>
120
+ T lowestEigenpairSym(const TensorTyped<T,n, n>& K, VectorTyped<T,n>& eigenvector, unsigned niter=24);
121
+
122
+ template<typename T, unsigned n, unsigned m>
123
+ class TensorTyped:
124
+ public MatrixSquareBracketsAccess<TensorTyped<T,n,m>,T> {
125
+ std::array<T,n*m> d;
126
+ /// Auxiliary private function for constructor
127
+ constexpr void auxiliaryConstructor();
128
+ /// Auxiliary private function for constructor
129
+ template<typename... Args>
130
+ constexpr void auxiliaryConstructor(T first,Args... arg);
131
+ template <int n_, int m_>
132
+ using is3x3 = std::enable_if_t<(n_==3 && m_==3)>;
133
+ public:
134
+ //upload the tensor to the current acc device
135
+ void toACCDevice()const {
136
+ #pragma acc enter data copyin(this[0:1], d, d[0:n*m-1])
137
+ }
138
+ void removeFromACCDevice() const {
139
+ // just delete
140
+ #pragma acc exit data delete( d[0:n*m-1], d, this[0:1])
141
+ }
142
+ /// Constructor accepting n*m T parameters.
143
+ /// Can be used as Tensor<2,2>(1.0,2.0,3.0,4.0)
144
+ /// In case a wrong number of parameters is given, a static assertion will fail.
145
+ template<typename... Args>
146
+ constexpr TensorTyped(T first,Args... arg);
147
+ /// initialize the tensor to zero
148
+ constexpr TensorTyped();
149
+ /// initialize a tensor as an external product of two Vector
150
+ constexpr TensorTyped(const VectorTyped<T,n>&v1,const VectorTyped<T,m>&v2);
151
+ /// set it to zero
152
+ constexpr void zero();
153
+ /// get the underline pointer to data
154
+ constexpr T* data();
155
+ /// get the underline pointer to data
156
+ constexpr const T* data() const;
157
+ /// access element
158
+ constexpr T & operator() (unsigned i,unsigned j);
159
+ /// access element
160
+ constexpr const T & operator() (unsigned i,unsigned j)const;
161
+ /// increment
162
+ constexpr TensorTyped& operator +=(const TensorTyped& b);
163
+ /// decrement
164
+ constexpr TensorTyped& operator -=(const TensorTyped& b);
165
+ /// multiply
166
+ constexpr TensorTyped& operator *=(T);
167
+ /// divide
168
+ constexpr TensorTyped& operator /=(T);
169
+ /// return +t
170
+ constexpr TensorTyped operator +()const;
171
+ /// return -t
172
+ constexpr TensorTyped operator -()const;
173
+ /// set j-th column
174
+ constexpr TensorTyped& setCol(unsigned j,const VectorTyped<T,n> & c);
175
+ /// set i-th row
176
+ constexpr TensorTyped& setRow(unsigned i,const VectorTyped<T,m> & r);
177
+ /// get j-th column
178
+ constexpr VectorTyped<T,n> getCol(unsigned j)const;
179
+ /// get i-th row
180
+ constexpr VectorTyped<T,m> getRow(unsigned i)const;
181
+ /// returns the determinant
182
+ template<int m_=m, int n_=n,typename = is3x3<m_,n_>>
183
+ constexpr T determinant()const;
184
+ /// return an identity tensor
185
+ static constexpr TensorTyped<T,n,n> identity();
186
+ /// return the matrix inverse
187
+ template<int m_=m, int n_=n,typename = is3x3<m_,n_>>
188
+ constexpr TensorTyped inverse()const;
189
+ /// return the transpose matrix
190
+ constexpr TensorTyped<T,m,n> transpose()const;
191
+ /// << operator.
192
+ /// Allows printing tensor `t` with `std::cout<<t;`
193
+ friend std::ostream & operator<< <>(std::ostream &os, const TensorTyped&);
194
+ };
195
+
196
+ template<typename T, unsigned n, unsigned m>
197
+ constexpr void TensorTyped<T,n,m>::auxiliaryConstructor()
198
+ {}
199
+
200
+ template<typename T, unsigned n, unsigned m>
201
+ template<typename... Args>
202
+ constexpr void TensorTyped<T,n,m>::auxiliaryConstructor(T first,Args... arg) {
203
+ d[n*m-(sizeof...(Args))-1]=first;
204
+ auxiliaryConstructor(arg...);
205
+ }
206
+
207
+ template<typename T, unsigned n, unsigned m>
208
+ template<typename... Args>
209
+ constexpr TensorTyped<T,n,m>::TensorTyped(T first,Args... arg) {
210
+ static_assert((sizeof...(Args))+1==n*m,"you are trying to initialize a Tensor with the wrong number of arguments");
211
+ auxiliaryConstructor(first,arg...);
212
+ }
213
+
214
+ template<typename T, unsigned n, unsigned m>
215
+ constexpr T* TensorTyped<T,n,m>::data() {
216
+ return d.data();
217
+ }
218
+ template<typename T, unsigned n, unsigned m>
219
+ constexpr const T* TensorTyped<T,n,m>::data() const {
220
+ return d.data();
221
+ }
222
+
223
+ template<typename T, unsigned n, unsigned m>
224
+ constexpr TensorTyped<T,n,m>::TensorTyped() {
225
+ LoopUnroller<n*m>::_zero(d.data());
226
+ }
227
+
228
+ /* between RVO and compile time this should be faster, but slows down openACC, a lot
229
+ template <typename T, unsigned i, unsigned j, unsigned m>
230
+ void external_rec(T*const out,const T*const v1, const T*const v2){
231
+ if constexpr (j>0) {
232
+ external_rec<i,j-1,m>(out,v1,v2);
233
+ } else if constexpr (i>0) {
234
+ external_rec<i-1,m-1,m>(out,v1,v2);
235
+ }
236
+ out[i*m+j]=v1[i]*v2[j];
237
+ }
238
+ template<typename T, unsigned n, unsigned m>
239
+ std::array<T,n*m> externaProd(const VectorGeneric<T,n>&v1,const VectorGeneric<T,m>&v2){
240
+ std::array<T,n*m> toRet;
241
+ external_rec<n-1,m-1,m>(toRet.data(),v1.data(),v2.data());
242
+ return toRet;
243
+ }
244
+ template<typename T, unsigned n, unsigned m>
245
+ TensorGeneric<T,n,m>::TensorGeneric(const VectorGeneric<T,n>&v1,const VectorGeneric<T,m>&v2)
246
+ :d(externaProd(v1,v2)) {}
247
+ */
248
+
249
+ template<typename T, unsigned n, unsigned m>
250
+ constexpr TensorTyped<T,n,m>::TensorTyped(const VectorTyped<T,n>&v1,const VectorTyped<T,m>&v2) {
251
+ for(unsigned i=0; i<n; i++) {
252
+ for(unsigned j=0; j<m; j++) {
253
+ d[i*m+j]=v1[i]*v2[j];
254
+ }
255
+ }
256
+ }
257
+
258
+ template<typename T, unsigned n, unsigned m>
259
+ constexpr void TensorTyped<T,n,m>::zero() {
260
+ LoopUnroller<n*m>::_zero(d.data());
261
+ }
262
+
263
+ template<typename T, unsigned n, unsigned m>
264
+ constexpr T & TensorTyped<T,n,m>::operator() (unsigned i,unsigned j) {
265
+ #ifdef _GLIBCXX_DEBUG
266
+ // index i is implicitly checked by the std::array class
267
+ plumed_assert(j<m);
268
+ #endif
269
+ return d[m*i+j];
270
+ }
271
+
272
+ template<typename T, unsigned n, unsigned m>
273
+ constexpr const T & TensorTyped<T,n,m>::operator() (unsigned i,unsigned j)const {
274
+ #ifdef _GLIBCXX_DEBUG
275
+ // index i is implicitly checked by the std::array class
276
+ plumed_assert(j<m);
277
+ #endif
278
+ return d[m*i+j];
279
+ }
280
+
281
+ template<typename T, unsigned n, unsigned m>
282
+ constexpr TensorTyped<T,n,m>& TensorTyped<T,n,m>::operator +=(const TensorTyped<T,n,m>& b) {
283
+ LoopUnroller<n*m>::_add(d.data(),b.d.data());
284
+ return *this;
285
+ }
286
+
287
+ template<typename T, unsigned n, unsigned m>
288
+ constexpr TensorTyped<T,n,m>& TensorTyped<T,n,m>::operator -=(const TensorTyped<T,n,m>& b) {
289
+ LoopUnroller<n*m>::_sub(d.data(),b.d.data());
290
+ return *this;
291
+ }
292
+
293
+ template<typename T, unsigned n, unsigned m>
294
+ constexpr TensorTyped<T,n,m>& TensorTyped<T,n,m>::operator *=(T s) {
295
+ LoopUnroller<n*m>::_mul(d.data(),s);
296
+ return *this;
297
+ }
298
+
299
+ template<typename T, unsigned n, unsigned m>
300
+ constexpr TensorTyped<T,n,m>& TensorTyped<T,n,m>::operator /=(T s) {
301
+ LoopUnroller<n*m>::_mul(d.data(),1.0/s);
302
+ return *this;
303
+ }
304
+
305
+ template<typename T, unsigned n, unsigned m>
306
+ constexpr TensorTyped<T,n,m> TensorTyped<T,n,m>::operator+()const {
307
+ return *this;
308
+ }
309
+
310
+ template<typename T, unsigned n, unsigned m>
311
+ constexpr TensorTyped<T,n,m> TensorTyped<T,n,m>::operator-()const {
312
+ TensorTyped<T,n,m> r;
313
+ LoopUnroller<n*m>::_neg(r.d.data(),d.data());
314
+ return r;
315
+ }
316
+
317
+ template<typename T, unsigned n, unsigned m>
318
+ constexpr TensorTyped<T,n,m>& TensorTyped<T,n,m>::setCol(unsigned j,const VectorTyped<T,n> & c) {
319
+ for(unsigned i=0; i<n; ++i) {
320
+ (*this)(i,j)=c(i);
321
+ }
322
+ return *this;
323
+ }
324
+
325
+ template<typename T, unsigned n, unsigned m>
326
+ constexpr TensorTyped<T,n,m>& TensorTyped<T,n,m>::setRow(unsigned i,const VectorTyped<T,m> & r) {
327
+ for(unsigned j=0; j<m; ++j) {
328
+ (*this)(i,j)=r(j);
329
+ }
330
+ return *this;
331
+ }
332
+
333
+ template<typename T, unsigned n, unsigned m>
334
+ constexpr VectorTyped<T,n> TensorTyped<T,n,m>::getCol(unsigned j)const {
335
+ VectorTyped<T,n> v;
336
+ for(unsigned i=0; i<n; ++i) {
337
+ v(i)=(*this)(i,j);
338
+ }
339
+ return v;
340
+ }
341
+
342
+ template<typename T, unsigned n, unsigned m>
343
+ constexpr VectorTyped<T,m> TensorTyped<T,n,m>::getRow(unsigned i)const {
344
+ VectorTyped<T,m> v;
345
+ for(unsigned j=0; j<m; ++j) {
346
+ v(j)=(*this)(i,j);
347
+ }
348
+ return v;
349
+ }
350
+
351
+ template<typename T, unsigned n, unsigned m>
352
+ constexpr TensorTyped<T,n,m> operator+(const TensorTyped<T,n,m>&t1,const TensorTyped<T,n,m>&t2) {
353
+ TensorTyped<T,n,m> t(t1);
354
+ t+=t2;
355
+ return t;
356
+ }
357
+
358
+ template<typename T, unsigned n, unsigned m>
359
+ constexpr TensorTyped<T,n,m> operator-(const TensorTyped<T,n,m>&t1,const TensorTyped<T,n,m>&t2) {
360
+ TensorTyped<T,n,m> t(t1);
361
+ t-=t2;
362
+ return t;
363
+ }
364
+
365
+ template<typename T, typename J, unsigned n, unsigned m>
366
+ constexpr TensorTyped<T,n,m> operator*(const TensorTyped<T,n,m>&t1,J s) {
367
+ TensorTyped<T,n,m> t(t1);
368
+ t*=s;
369
+ return t;
370
+ }
371
+
372
+ template<typename T, typename J, unsigned n, unsigned m>
373
+ constexpr TensorTyped<T,n,m> operator*(J s,const TensorTyped<T,n,m>&t1) {
374
+ return t1*s;
375
+ }
376
+
377
+ template<typename T, typename J, unsigned n, unsigned m>
378
+ constexpr TensorTyped<T,n,m> operator/(const TensorTyped<T,n,m>&t1,J s) {
379
+ return t1*(T(1.0)/s);
380
+ }
381
+
382
+ template<typename T, unsigned n, unsigned m>
383
+ template<int m_, int n_,typename>
384
+ constexpr inline T TensorTyped<T,n,m>::determinant()const {
385
+ return
386
+ d[0]*d[4]*d[8]
387
+ + d[1]*d[5]*d[6]
388
+ + d[2]*d[3]*d[7]
389
+ - d[0]*d[5]*d[7]
390
+ - d[1]*d[3]*d[8]
391
+ - d[2]*d[4]*d[6];
392
+ }
393
+
394
+ //consider to make this a constexpr function
395
+ template<typename T, unsigned n, unsigned m>
396
+ constexpr inline TensorTyped<T,n,n> TensorTyped<T,n,m>::identity() {
397
+ TensorTyped<T,n,n> t;
398
+ for(unsigned i=0; i<n; i++) {
399
+ t(i,i)=1.0;
400
+ }
401
+ return t;
402
+ }
403
+
404
+ template<typename T, unsigned n, unsigned m>
405
+ constexpr TensorTyped<T,m,n> TensorTyped<T,n,m>::transpose()const {
406
+ TensorTyped<T,m,n> t;
407
+ for(unsigned i=0; i<m; i++)
408
+ for(unsigned j=0; j<n; j++) {
409
+ t(i,j)=(*this)(j,i);
410
+ }
411
+ return t;
412
+ }
413
+
414
+ template<typename T, unsigned n, unsigned m>
415
+ template<int m_, int n_,typename>
416
+ constexpr inline TensorTyped<T,n,m> TensorTyped<T,n,m>::inverse()const {
417
+ TensorTyped t;
418
+ T invdet=1.0/determinant();
419
+ for(unsigned i=0; i<3; i++)
420
+ for(unsigned j=0; j<3; j++)
421
+ t(j,i)=invdet*( (*this)((i+1)%3,(j+1)%3)*(*this)((i+2)%3,(j+2)%3)
422
+ -(*this)((i+1)%3,(j+2)%3)*(*this)((i+2)%3,(j+1)%3));
423
+ return t;
424
+ }
425
+
426
+ /// matrix-matrix multiplication
427
+ template<typename T, unsigned n, unsigned m, unsigned l>
428
+ constexpr TensorTyped<T,n,l> matmul(const TensorTyped<T,n,m>&a,const TensorTyped<T,m,l>&b) {
429
+ TensorTyped<T,n,l> t;
430
+ for(unsigned i=0; i<n; i++)
431
+ for(unsigned j=0; j<l; j++)
432
+ for(unsigned k=0; k<m; k++) {
433
+ t(i,j)+=a(i,k)*b(k,j);
434
+ }
435
+ return t;
436
+ }
437
+
438
+ /// matrix-vector multiplicationi, the first argument determines the type of the result
439
+ template<typename T,typename TT, unsigned n, unsigned m>
440
+ constexpr VectorTyped<T,n> matmul(const TensorTyped<T,n,m>&a,const VectorTyped<TT,m>&b) {
441
+ VectorTyped<T,n> t;
442
+ for(unsigned i=0; i<n; i++)
443
+ for(unsigned j=0; j<m; j++) {
444
+ t(i)+=a(i,j)*b(j);
445
+ }
446
+ return t;
447
+ }
448
+
449
+ /// vector-matrix multiplication, the first argument determines the type of the result
450
+ template<typename T,typename TT, unsigned n, unsigned m>
451
+ constexpr VectorTyped<T,n> matmul(const VectorTyped<T,m>&a,const TensorTyped<TT,m,n>&b) {
452
+ VectorTyped<T,n> t;
453
+ for(unsigned i=0; i<n; i++)
454
+ for(unsigned j=0; j<m; j++) {
455
+ t(i)+=a(j)*b(j,i);
456
+ }
457
+ return t;
458
+ }
459
+
460
+ /// vector-vector multiplication (maps to dotProduct)
461
+ template<typename T, unsigned n_>
462
+ constexpr T matmul(const VectorTyped<T,n_>&a,const VectorTyped<T,n_>&b) {
463
+ return dotProduct(a,b);
464
+ }
465
+
466
+ /// matrix-matrix-matrix multiplication
467
+ template<typename T, unsigned n, unsigned m, unsigned l, unsigned i>
468
+ constexpr TensorTyped<T,n,i> matmul(const TensorTyped<T,n,m>&a,const TensorTyped<T,m,l>&b,const TensorTyped<T,l,i>&c) {
469
+ return matmul(matmul(a,b),c);
470
+ }
471
+
472
+ /// matrix-matrix-vector multiplication
473
+ template<typename T, unsigned n, unsigned m, unsigned l>
474
+ constexpr VectorTyped<T,n> matmul(const TensorTyped<T,n,m>&a,const TensorTyped<T,m,l>&b,const VectorTyped<T,l>&c) {
475
+ return matmul(matmul(a,b),c);
476
+ }
477
+
478
+ /// vector-matrix-matrix multiplication
479
+ template<typename T, unsigned n, unsigned m, unsigned l>
480
+ constexpr VectorTyped<T,l> matmul(const VectorTyped<T,n>&a,const TensorTyped<T,n,m>&b,const TensorTyped<T,m,l>&c) {
481
+ return matmul(matmul(a,b),c);
482
+ }
483
+
484
+ /// vector-matrix-vector multiplication
485
+ template<typename T, unsigned n, unsigned m>
486
+ constexpr T matmul(const VectorTyped<T,n>&a,const TensorTyped<T,n,m>&b,const VectorTyped<T,m>&c) {
487
+ return matmul(matmul(a,b),c);
488
+ }
489
+
490
+ template <typename T>
491
+ inline
492
+ constexpr T determinant(const TensorTyped<T,3,3>&t) {
493
+ return t.determinant();
494
+ }
495
+
496
+ template <typename T>
497
+ inline
498
+ constexpr TensorTyped<T,3,3> inverse(const TensorTyped<T,3,3>&t) {
499
+ return t.inverse();
500
+ }
501
+
502
+ /// returns the transpose of a tensor (same as TensorGeneric::transpose())
503
+ template<typename T, unsigned n, unsigned m>
504
+ constexpr TensorTyped<T,n,m> transpose(const TensorTyped<T,m,n>&t) {
505
+ return t.transpose();
506
+ }
507
+
508
+ /// returns the transpose of a tensor (same as TensorGeneric(const VectorGeneric&,const VectorGeneric&))
509
+ template<typename T, unsigned n, unsigned m>
510
+ constexpr TensorTyped<T,n,m> extProduct(const VectorTyped<T,n>&v1,const VectorTyped<T,m>&v2) {
511
+ return TensorTyped<T,n,m>(v1,v2);
512
+ }
513
+
514
+ template <typename T>
515
+ inline
516
+ constexpr TensorTyped<T,3,3> dcrossDv1(const VectorTyped<T,3>&v1,const VectorTyped<T,3>&v2) {
517
+ (void) v1; // this is to avoid warnings. still the syntax of this function is a bit dummy...
518
+ return TensorTyped<T,3,3>(
519
+ T(0.0), v2[2], -v2[1],
520
+ -v2[2], T(0.0), v2[0],
521
+ v2[1], -v2[0], T(0.0));
522
+ }
523
+
524
+ template <typename T>
525
+ inline
526
+ constexpr TensorTyped<T,3,3> dcrossDv2(const VectorTyped<T,3>&v1,const VectorTyped<T,3>&v2) {
527
+ (void) v2; // this is to avoid warnings. still the syntax of this function is a bit dummy...
528
+ return TensorTyped<T,3,3>(
529
+ T(0.0),-v1[2], v1[1],
530
+ v1[2], T(0.0),-v1[0],
531
+ -v1[1],v1[0], T(0.0));
532
+ }
533
+
534
+ template<typename T, unsigned n,unsigned m>
535
+ T frobeniusNorm(const TensorTyped<T,m,n>&t) {
536
+ return std::sqrt(LoopUnroller<m*n>::_dot(t.data(),t.data()));
537
+ }
538
+
539
+ template<typename T, unsigned n, unsigned m>
540
+ std::ostream & operator<<(std::ostream &os, const TensorTyped<T,n,m>& t) {
541
+ for(unsigned i=0; i<n; i++)
542
+ for(unsigned j=0; j<m; j++) {
543
+ if(i!=(n-1) || j!=(m-1)) {
544
+ os<<t(i,j)<<" ";
545
+ } else {
546
+ os<<t(i,j);
547
+ }
548
+ }
549
+ return os;
550
+ }
551
+
552
+ template <unsigned n,unsigned m>
553
+ using TensorGeneric=TensorTyped<double,n,m>;
554
+
555
+ /// \ingroup TOOLBOX
556
+ typedef TensorGeneric<1,1> Tensor1d;
557
+ /// \ingroup TOOLBOX
558
+ typedef TensorGeneric<2,2> Tensor2d;
559
+ /// \ingroup TOOLBOX
560
+ typedef TensorGeneric<3,3> Tensor3d;
561
+ /// \ingroup TOOLBOX
562
+ typedef TensorGeneric<4,4> Tensor4d;
563
+ /// \ingroup TOOLBOX
564
+ typedef TensorGeneric<5,5> Tensor5d;
565
+ /// \ingroup TOOLBOX
566
+ typedef Tensor3d Tensor;
567
+
568
+ /// \ingroup TOOLBOX
569
+ typedef TensorTyped<float,1,1> Tensor1f;
570
+ /// \ingroup TOOLBOX
571
+ typedef TensorTyped<float,2,2> Tensor2f;
572
+ /// \ingroup TOOLBOX
573
+ typedef TensorTyped<float,3,3> Tensor3f;
574
+ /// \ingroup TOOLBOX
575
+ typedef TensorTyped<float,4,4> Tensor4f;
576
+ /// \ingroup TOOLBOX
577
+ typedef TensorTyped<float,5,5> Tensor5f;
578
+
579
+ /// \ingroup TOOLBOX
580
+ /// Alias for three by three Tensor of any type:
581
+ template <typename T>
582
+ using TensorT=TensorTyped<T,3,3>;
583
+
584
+ template <typename T>
585
+ inline
586
+ TensorTyped<T,3,3> VcrossTensor(const VectorTyped<T,3>&v1,const TensorTyped<T,3,3>&v2) {
587
+ TensorTyped<T,3,3> t;
588
+ for(unsigned i=0; i<3; i++) {
589
+ t.setRow(i,matmul(dcrossDv2(v1,v1),v2.getRow(i)));
590
+ }
591
+ return t;
592
+ }
593
+
594
+ template <typename T>
595
+ inline
596
+ TensorTyped<T,3,3> VcrossTensor(const TensorTyped<T,3,3>&v2,const VectorTyped<T,3>&v1) {
597
+ TensorTyped<T,3,3> t;
598
+ for(unsigned i=0; i<3; i++) {
599
+ t.setRow(i,-matmul(dcrossDv2(v1,v1),v2.getRow(i)));
600
+ }
601
+ return t;
602
+ }
603
+
604
+ template <typename T>
605
+ inline
606
+ TensorTyped<T,3,3> deriNorm(const VectorTyped<T,3>&v1,const TensorTyped<T,3,3>&v2) {
607
+ // delta(v) = delta(v1/v1.norm) = 1/v1.norm*(delta(v1) - (v.delta(v1))cross v;
608
+ T over_norm = 1./v1.modulo();
609
+ return over_norm*(v2 - over_norm*over_norm*(extProduct(matmul(v2,v1),v1)));
610
+ }
611
+
612
+ /// Diagonalize tensor.
613
+ /// Syntax is the same as Matrix::diagMat.
614
+ /// In addition, it is possible to call if with m_ smaller than n_. In this case,
615
+ /// only the first (smaller) m_ eigenvalues and eigenvectors are retrieved.
616
+ /// If case lapack fails (info!=0) it throws an exception.
617
+ /// Notice that tensor is assumed to be symmetric!!!
618
+ template<typename precision, unsigned n, unsigned m>
619
+ void diagMatSym(const TensorTyped<precision,n,n>&mat,VectorTyped<precision,m>&evals,TensorTyped<precision,m,n>&evec) {
620
+ // some guess number to make sure work is large enough.
621
+ // for correctness it should be >=20. However, it is recommended to be the block size.
622
+ // I put some likely exaggerated number
623
+ constexpr int bs=100;
624
+ // temporary data, on stack so as to avoid allocations
625
+ std::array<int,10*n> iwork;
626
+ std::array<precision,(6+bs)*n> work;
627
+ std::array<int,2*m> isup;
628
+ // documentation says that "matrix is destroyed" !!!
629
+ auto mat_copy=mat;
630
+ // documentation says this is size n (even if m<n)
631
+ std::array<precision,n> evals_tmp;
632
+ int nn=n; // dimension of matrix
633
+ precision vl=0.0, vu=1.0; // ranges - not used
634
+ int one=1,mm=m; // minimum and maximum index
635
+ precision abstol=0.0; // tolerance
636
+ int mout=0; // number of eigenvalues found (same as mm)
637
+ int info=0; // result
638
+ int liwork=iwork.size();
639
+ int lwork=work.size();
640
+ TensorGenericAux::local_xsyevr("V", (n==m?"A":"I"), "U", &nn, mat_copy.data(), &nn, &vl, &vu, &one, &mm,
641
+ &abstol, &mout, evals_tmp.data(), evec.data(), &nn,
642
+ isup.data(), work.data(), &lwork, iwork.data(), &liwork, &info);
643
+ if(info!=0)
644
+ plumed_error()<<"Error diagonalizing matrix\n"
645
+ <<"Matrix:\n"<<mat<<"\n"
646
+ <<"Info: "<<info<<"\n";
647
+ plumed_assert(mout==m);
648
+ for(unsigned i=0; i<m; i++) {
649
+ evals[i]=evals_tmp[i];
650
+ }
651
+ // This changes eigenvectors so that the first non-null element
652
+ // of each of them is positive
653
+ // We can do it because the phase is arbitrary, and helps making
654
+ // the result reproducible
655
+ for(unsigned i=0; i<m; ++i) {
656
+ unsigned j=0;
657
+ for(j=0; j<n; j++)
658
+ if(evec(i,j)*evec(i,j)>1e-14) {
659
+ break;
660
+ }
661
+ if(j<n)
662
+ if(evec(i,j)<0.0)
663
+ for(j=0; j<n; j++) {
664
+ evec(i,j)*=-1;
665
+ }
666
+ }
667
+ }
668
+
669
+ template<typename T, unsigned n>
670
+ T lowestEigenpairSym(const TensorTyped<T,n,n>& K, VectorTyped<T,n>& eigenvector, const unsigned niter) {
671
+ // Estimate upper bound for largest eigenvalue using Gershgorin disks
672
+ T upper_bound = std::numeric_limits<T>::lowest();
673
+ for (unsigned i = 0; i < n; ++i) {
674
+ auto row = K.getRow(i);
675
+ T center = row[i];
676
+ row[i] = 0.0; // zero out the diagonal entry
677
+
678
+ // Compute sum of absolute values of the off-diagonal elements
679
+ T row_sum = 0.0;
680
+ for (unsigned j = 0; j < n; ++j) {
681
+ row_sum += std::fabs(row[j]);
682
+ }
683
+
684
+ upper_bound = std::fmax(upper_bound, center + row_sum);
685
+ }
686
+
687
+ // Build shifted matrix A = -K + lambda_shift * I
688
+ TensorTyped<T,n,n> A = -K;
689
+ for (unsigned i = 0; i < n; ++i) {
690
+ A[i][i] += upper_bound;
691
+ }
692
+
693
+ // Repeated squaring + normalization to project onto dominant eigenspace
694
+ for (unsigned k = 0; k < niter; ++k) {
695
+ A = matmul(A, A);
696
+ auto frob = frobeniusNorm(A);
697
+ A /= (frob > 0.0 ? frob : 1.0);
698
+ }
699
+
700
+ // Extract dominant eigenvector from projector A
701
+ VectorTyped<T,n> v;
702
+ T best_norm2 = 0.0;
703
+ for (unsigned j = 0; j < n; ++j) {
704
+ auto row = A.getRow(j);
705
+ T norm2 = modulo2(row);
706
+ T use = static_cast<T>(norm2 > best_norm2);
707
+ best_norm2 = use * norm2 + (1.0 - use) * best_norm2;
708
+ v = use * row + (1.0 - use) * v;
709
+ }
710
+
711
+ v /= modulo(v);
712
+
713
+ eigenvector = v;
714
+
715
+ return matmul(eigenvector, K, eigenvector);
716
+ }
717
+
718
+
719
+ static_assert(sizeof(Tensor)==9*sizeof(double), "code cannot work if this is not satisfied");
720
+ static_assert(sizeof(TensorT<float>)==9*sizeof(float), "code cannot work if this is not satisfied");
721
+
722
+ } //PLMD
723
+
724
+ #endif