Update Colvars to version 2020-09-17

Small changes

Implement global map of components (@HanatoK)
https://github.com/Colvars/colvars/pull/363

Format code examples with colored background (@giacomofiorin)
https://github.com/Colvars/colvars/pull/361

replaced jacobi() with an open-source version (@jewettaij)
https://github.com/Colvars/colvars/pull/360
This commit is contained in:
Giacomo Fiorin
2020-09-18 16:54:32 -04:00
parent 34ba8ec83c
commit 7deb773440
10 changed files with 405 additions and 276 deletions

View File

@ -15,7 +15,7 @@ else
COLVARS_DEBUG_INCFLAGS = -DCOLVARS_DEBUG COLVARS_DEBUG_INCFLAGS = -DCOLVARS_DEBUG
endif endif
COLVARS_INCFLAGS = $(COLVARS_DEBUG_INCFLAGS) $(COLVARS_PYTHON_INCFLAGS) COLVARS_INCFLAGS = -DCOLVARS_LAMMPS $(COLVARS_DEBUG_INCFLAGS) $(COLVARS_PYTHON_INCFLAGS) -I../../src
.SUFFIXES: .SUFFIXES:

View File

@ -4,79 +4,227 @@ $(COLVARS_OBJ_DIR)colvaratoms.o: colvaratoms.cpp colvarmodule.h \
colvarproxy_tcl.h colvarproxy_volmaps.h colvarparse.h colvarparams.h \ colvarproxy_tcl.h colvarproxy_volmaps.h colvarparse.h colvarparams.h \
colvaratoms.h colvardeps.h colvaratoms.h colvardeps.h
$(COLVARS_OBJ_DIR)colvarbias_abf.o: colvarbias_abf.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarbias_abf.o: colvarbias_abf.cpp colvarmodule.h \
colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \ colvars_version.h colvar.h colvarvalue.h colvartypes.h colvarparse.h \
colvarproxy_tcl.h colvarproxy_volmaps.h colvar.h colvarparse.h \ colvarparams.h colvardeps.h lepton/include/Lepton.h \
colvarparams.h colvardeps.h colvarbias_abf.h colvarbias.h colvargrid.h \ lepton/include/lepton/CompiledExpression.h \
colvar_UIestimator.h lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarbias_abf.h colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \
colvarbias.h colvargrid.h colvar_UIestimator.h
$(COLVARS_OBJ_DIR)colvarbias_alb.o: colvarbias_alb.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarbias_alb.o: colvarbias_alb.cpp colvarmodule.h \
colvars_version.h colvarbias.h colvar.h colvarvalue.h colvartypes.h \ colvars_version.h colvarbias.h colvar.h colvarvalue.h colvartypes.h \
colvarparse.h colvarparams.h colvardeps.h colvarbias_alb.h colvarparse.h colvarparams.h colvardeps.h lepton/include/Lepton.h \
lepton/include/lepton/CompiledExpression.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarbias_alb.h
$(COLVARS_OBJ_DIR)colvarbias.o: colvarbias.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarbias.o: colvarbias.cpp colvarmodule.h \
colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \ colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \
colvarproxy_tcl.h colvarproxy_volmaps.h colvarbias.h colvar.h \ colvarproxy_tcl.h colvarproxy_volmaps.h colvarbias.h colvar.h \
colvarparse.h colvarparams.h colvardeps.h colvargrid.h colvarparse.h colvarparams.h colvardeps.h lepton/include/Lepton.h \
lepton/include/lepton/CompiledExpression.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvargrid.h
$(COLVARS_OBJ_DIR)colvarbias_histogram.o: colvarbias_histogram.cpp \ $(COLVARS_OBJ_DIR)colvarbias_histogram.o: colvarbias_histogram.cpp \
colvarmodule.h colvars_version.h colvarproxy.h colvartypes.h \ colvarmodule.h colvars_version.h colvarproxy.h colvartypes.h \
colvarvalue.h colvarproxy_tcl.h colvarproxy_volmaps.h colvar.h \ colvarvalue.h colvarproxy_tcl.h colvarproxy_volmaps.h colvar.h \
colvarparse.h colvarparams.h colvardeps.h colvarbias_histogram.h \ colvarparse.h colvarparams.h colvardeps.h lepton/include/Lepton.h \
colvarbias.h colvargrid.h lepton/include/lepton/CompiledExpression.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarbias_histogram.h colvarbias.h colvargrid.h
$(COLVARS_OBJ_DIR)colvarbias_meta.o: colvarbias_meta.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarbias_meta.o: colvarbias_meta.cpp colvarmodule.h \
colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \ colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \
colvarproxy_tcl.h colvarproxy_volmaps.h colvar.h colvarparse.h \ colvarproxy_tcl.h colvarproxy_volmaps.h colvar.h colvarparse.h \
colvarparams.h colvardeps.h colvarbias_meta.h colvarbias.h colvargrid.h colvarparams.h colvardeps.h lepton/include/Lepton.h \
lepton/include/lepton/CompiledExpression.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarbias_meta.h colvarbias.h colvargrid.h
$(COLVARS_OBJ_DIR)colvarbias_restraint.o: colvarbias_restraint.cpp \ $(COLVARS_OBJ_DIR)colvarbias_restraint.o: colvarbias_restraint.cpp \
colvarmodule.h colvars_version.h colvarproxy.h colvartypes.h \ colvarmodule.h colvars_version.h colvarproxy.h colvartypes.h \
colvarvalue.h colvarproxy_tcl.h colvarproxy_volmaps.h \ colvarvalue.h colvarproxy_tcl.h colvarproxy_volmaps.h \
colvarbias_restraint.h colvarbias.h colvar.h colvarparse.h \ colvarbias_restraint.h colvarbias.h colvar.h colvarparse.h \
colvarparams.h colvardeps.h colvarparams.h colvardeps.h lepton/include/Lepton.h \
lepton/include/lepton/CompiledExpression.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h
$(COLVARS_OBJ_DIR)colvarcomp_angles.o: colvarcomp_angles.cpp \ $(COLVARS_OBJ_DIR)colvarcomp_angles.o: colvarcomp_angles.cpp \
colvarmodule.h colvars_version.h colvar.h colvarvalue.h colvartypes.h \ colvarmodule.h colvars_version.h colvar.h colvarvalue.h colvartypes.h \
colvarparse.h colvarparams.h colvardeps.h colvarcomp.h colvaratoms.h \ colvarparse.h colvarparams.h colvardeps.h lepton/include/Lepton.h \
colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ lepton/include/lepton/CompiledExpression.h \
colvar_arithmeticpath.h colvar_geometricpath.h lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarcomp.h colvaratoms.h colvarproxy.h colvarproxy_tcl.h \
colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarcomp_apath.o: colvarcomp_apath.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarcomp_apath.o: colvarcomp_apath.cpp colvarmodule.h \
colvars_version.h colvarvalue.h colvartypes.h colvarparse.h \ colvars_version.h colvarvalue.h colvartypes.h colvarparse.h \
colvarparams.h colvar.h colvardeps.h colvarcomp.h colvaratoms.h \ colvarparams.h colvar.h colvardeps.h lepton/include/Lepton.h \
colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ lepton/include/lepton/CompiledExpression.h \
colvar_arithmeticpath.h colvar_geometricpath.h lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarcomp.h colvaratoms.h colvarproxy.h colvarproxy_tcl.h \
colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarcomp_coordnums.o: colvarcomp_coordnums.cpp \ $(COLVARS_OBJ_DIR)colvarcomp_coordnums.o: colvarcomp_coordnums.cpp \
colvarmodule.h colvars_version.h colvarparse.h colvarvalue.h \ colvarmodule.h colvars_version.h colvarparse.h colvarvalue.h \
colvartypes.h colvarparams.h colvaratoms.h colvarproxy.h \ colvartypes.h colvarparams.h colvaratoms.h colvarproxy.h \
colvarproxy_tcl.h colvarproxy_volmaps.h colvardeps.h colvar.h \ colvarproxy_tcl.h colvarproxy_volmaps.h colvardeps.h colvar.h \
lepton/include/Lepton.h lepton/include/lepton/CompiledExpression.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarcomp.h colvar_arithmeticpath.h colvar_geometricpath.h colvarcomp.h colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarcomp.o: colvarcomp.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarcomp.o: colvarcomp.cpp colvarmodule.h \
colvars_version.h colvarvalue.h colvartypes.h colvar.h colvarparse.h \ colvars_version.h colvarvalue.h colvartypes.h colvar.h colvarparse.h \
colvarparams.h colvardeps.h colvarcomp.h colvaratoms.h colvarproxy.h \ colvarparams.h colvardeps.h lepton/include/Lepton.h \
colvarproxy_tcl.h colvarproxy_volmaps.h colvar_arithmeticpath.h \ lepton/include/lepton/CompiledExpression.h \
colvar_geometricpath.h lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarcomp.h colvaratoms.h colvarproxy.h colvarproxy_tcl.h \
colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarcomp_distances.o: colvarcomp_distances.cpp \ $(COLVARS_OBJ_DIR)colvarcomp_distances.o: colvarcomp_distances.cpp \
colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \ colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \
colvarparse.h colvarparams.h colvar.h colvardeps.h colvarcomp.h \ colvarparse.h colvarparams.h colvar.h colvardeps.h \
colvaratoms.h colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ lepton/include/Lepton.h lepton/include/lepton/CompiledExpression.h \
colvar_arithmeticpath.h colvar_geometricpath.h lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarcomp.h colvaratoms.h colvarproxy.h colvarproxy_tcl.h \
colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarcomp_gpath.o: colvarcomp_gpath.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarcomp_gpath.o: colvarcomp_gpath.cpp colvarmodule.h \
colvars_version.h colvarvalue.h colvartypes.h colvarparse.h \ colvars_version.h colvarvalue.h colvartypes.h colvarparse.h \
colvarparams.h colvar.h colvardeps.h colvarcomp.h colvaratoms.h \ colvarparams.h colvar.h colvardeps.h lepton/include/Lepton.h \
colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ lepton/include/lepton/CompiledExpression.h \
colvar_arithmeticpath.h colvar_geometricpath.h lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarcomp.h colvaratoms.h colvarproxy.h colvarproxy_tcl.h \
colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarcomp_protein.o: colvarcomp_protein.cpp \ $(COLVARS_OBJ_DIR)colvarcomp_protein.o: colvarcomp_protein.cpp \
colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \ colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \
colvarparse.h colvarparams.h colvar.h colvardeps.h colvarcomp.h \ colvarparse.h colvarparams.h colvar.h colvardeps.h \
colvaratoms.h colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ lepton/include/Lepton.h lepton/include/lepton/CompiledExpression.h \
colvar_arithmeticpath.h colvar_geometricpath.h lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarcomp.h colvaratoms.h colvarproxy.h colvarproxy_tcl.h \
colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarcomp_rotations.o: colvarcomp_rotations.cpp \ $(COLVARS_OBJ_DIR)colvarcomp_rotations.o: colvarcomp_rotations.cpp \
colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \ colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \
colvarparse.h colvarparams.h colvar.h colvardeps.h colvarcomp.h \ colvarparse.h colvarparams.h colvar.h colvardeps.h \
colvaratoms.h colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ lepton/include/Lepton.h lepton/include/lepton/CompiledExpression.h \
colvar_arithmeticpath.h colvar_geometricpath.h lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarcomp.h colvaratoms.h colvarproxy.h colvarproxy_tcl.h \
colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarcomp_volmaps.o: colvarcomp_volmaps.cpp \ $(COLVARS_OBJ_DIR)colvarcomp_volmaps.o: colvarcomp_volmaps.cpp \
colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \ colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \
colvarparse.h colvarparams.h colvar.h colvardeps.h colvarcomp.h \ colvarparse.h colvarparams.h colvar.h colvardeps.h \
colvaratoms.h colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ lepton/include/Lepton.h lepton/include/lepton/CompiledExpression.h \
colvar_arithmeticpath.h colvar_geometricpath.h lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarcomp.h colvaratoms.h colvarproxy.h colvarproxy_tcl.h \
colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvar.o: colvar.cpp colvarmodule.h colvars_version.h \ $(COLVARS_OBJ_DIR)colvar.o: colvar.cpp colvarmodule.h colvars_version.h \
colvarvalue.h colvartypes.h colvarparse.h colvarparams.h colvar.h \ colvarvalue.h colvartypes.h colvarparse.h colvarparams.h colvar.h \
colvardeps.h colvarcomp.h colvaratoms.h colvarproxy.h colvarproxy_tcl.h \ colvardeps.h lepton/include/Lepton.h \
lepton/include/lepton/CompiledExpression.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarcomp.h colvaratoms.h colvarproxy.h colvarproxy_tcl.h \
colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h \ colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h \
colvarscript.h colvarbias.h colvarscript_commands.h \ colvarscript.h colvarbias.h colvarscript_commands.h \
colvarscript_commands_colvar.h colvarscript_commands_bias.h colvarscript_commands_colvar.h colvarscript_commands_bias.h
@ -86,18 +234,38 @@ $(COLVARS_OBJ_DIR)colvardeps.o: colvardeps.cpp colvarmodule.h \
colvarparams.h colvarparams.h
$(COLVARS_OBJ_DIR)colvargrid.o: colvargrid.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvargrid.o: colvargrid.cpp colvarmodule.h \
colvars_version.h colvarvalue.h colvartypes.h colvarparse.h \ colvars_version.h colvarvalue.h colvartypes.h colvarparse.h \
colvarparams.h colvar.h colvardeps.h colvarcomp.h colvaratoms.h \ colvarparams.h colvar.h colvardeps.h lepton/include/Lepton.h \
colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ lepton/include/lepton/CompiledExpression.h \
colvar_arithmeticpath.h colvar_geometricpath.h colvargrid.h lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarcomp.h colvaratoms.h colvarproxy.h colvarproxy_tcl.h \
colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h \
colvargrid.h
$(COLVARS_OBJ_DIR)colvarmodule.o: colvarmodule.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarmodule.o: colvarmodule.cpp colvarmodule.h \
colvars_version.h colvarparse.h colvarvalue.h colvartypes.h \ colvars_version.h colvarparse.h colvarvalue.h colvartypes.h \
colvarparams.h colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \ colvarparams.h colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \
colvar.h colvardeps.h colvarbias.h colvarbias_abf.h colvargrid.h \ colvar.h colvardeps.h lepton/include/Lepton.h \
colvar_UIestimator.h colvarbias_alb.h colvarbias_histogram.h \ lepton/include/lepton/CompiledExpression.h \
colvarbias_meta.h colvarbias_restraint.h colvarscript.h \ lepton/include/lepton/ExpressionTreeNode.h \
colvarscript_commands.h colvarscript_commands_colvar.h \ lepton/include/lepton/windowsIncludes.h \
colvarscript_commands_bias.h colvaratoms.h colvarcomp.h \ lepton/include/lepton/CustomFunction.h \
colvar_arithmeticpath.h colvar_geometricpath.h lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarbias.h colvarbias_abf.h colvargrid.h colvar_UIestimator.h \
colvarbias_alb.h colvarbias_histogram.h colvarbias_meta.h \
colvarbias_restraint.h colvarscript.h colvarscript_commands.h \
colvarscript_commands_colvar.h colvarscript_commands_bias.h \
colvaratoms.h colvarcomp.h colvar_arithmeticpath.h \
colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarparams.o: colvarparams.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarparams.o: colvarparams.cpp colvarmodule.h \
colvars_version.h colvarvalue.h colvartypes.h colvarparams.h colvars_version.h colvarvalue.h colvartypes.h colvarparams.h
$(COLVARS_OBJ_DIR)colvarparse.o: colvarparse.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarparse.o: colvarparse.cpp colvarmodule.h \
@ -107,6 +275,15 @@ $(COLVARS_OBJ_DIR)colvarproxy.o: colvarproxy.cpp colvarmodule.h \
colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \ colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \
colvarproxy_tcl.h colvarproxy_volmaps.h colvarscript.h colvarbias.h \ colvarproxy_tcl.h colvarproxy_volmaps.h colvarscript.h colvarbias.h \
colvar.h colvarparse.h colvarparams.h colvardeps.h \ colvar.h colvarparse.h colvarparams.h colvardeps.h \
lepton/include/Lepton.h lepton/include/lepton/CompiledExpression.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarscript_commands.h colvarscript_commands_colvar.h \ colvarscript_commands.h colvarscript_commands_colvar.h \
colvarscript_commands_bias.h colvaratoms.h colvarscript_commands_bias.h colvaratoms.h
$(COLVARS_OBJ_DIR)colvarproxy_replicas.o: colvarproxy_replicas.cpp \ $(COLVARS_OBJ_DIR)colvarproxy_replicas.o: colvarproxy_replicas.cpp \
@ -122,28 +299,66 @@ $(COLVARS_OBJ_DIR)colvarscript.o: colvarscript.cpp colvarproxy.h \
colvarmodule.h colvars_version.h colvartypes.h colvarvalue.h \ colvarmodule.h colvars_version.h colvartypes.h colvarvalue.h \
colvarproxy_tcl.h colvarproxy_volmaps.h colvardeps.h colvarparse.h \ colvarproxy_tcl.h colvarproxy_volmaps.h colvardeps.h colvarparse.h \
colvarparams.h colvarscript.h colvarbias.h colvar.h \ colvarparams.h colvarscript.h colvarbias.h colvar.h \
lepton/include/Lepton.h lepton/include/lepton/CompiledExpression.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarscript_commands.h colvarscript_commands_colvar.h \ colvarscript_commands.h colvarscript_commands_colvar.h \
colvarscript_commands_bias.h colvarscript_commands_bias.h
$(COLVARS_OBJ_DIR)colvarscript_commands.o: colvarscript_commands.cpp \ $(COLVARS_OBJ_DIR)colvarscript_commands.o: colvarscript_commands.cpp \
colvarproxy.h colvarmodule.h colvars_version.h colvartypes.h \ colvarproxy.h colvarmodule.h colvars_version.h colvartypes.h \
colvarvalue.h colvarproxy_tcl.h colvarproxy_volmaps.h colvardeps.h \ colvarvalue.h colvarproxy_tcl.h colvarproxy_volmaps.h colvardeps.h \
colvarparse.h colvarparams.h colvarscript.h colvarbias.h colvar.h \ colvarparse.h colvarparams.h colvarscript.h colvarbias.h colvar.h \
lepton/include/Lepton.h lepton/include/lepton/CompiledExpression.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarscript_commands.h colvarscript_commands_colvar.h \ colvarscript_commands.h colvarscript_commands_colvar.h \
colvarscript_commands_bias.h colvarscript_commands_bias.h
$(COLVARS_OBJ_DIR)colvarscript_commands_bias.o: \ $(COLVARS_OBJ_DIR)colvarscript_commands_bias.o: \
colvarscript_commands_bias.cpp colvarproxy.h colvarmodule.h \ colvarscript_commands_bias.cpp colvarproxy.h colvarmodule.h \
colvars_version.h colvartypes.h colvarvalue.h colvarproxy_tcl.h \ colvars_version.h colvartypes.h colvarvalue.h colvarproxy_tcl.h \
colvarproxy_volmaps.h colvardeps.h colvarparse.h colvarparams.h \ colvarproxy_volmaps.h colvardeps.h colvarparse.h colvarparams.h \
colvarscript.h colvarbias.h colvar.h colvarscript_commands.h \ colvarscript.h colvarbias.h colvar.h lepton/include/Lepton.h \
colvarscript_commands_colvar.h colvarscript_commands_bias.h lepton/include/lepton/CompiledExpression.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarscript_commands.h colvarscript_commands_colvar.h \
colvarscript_commands_bias.h
$(COLVARS_OBJ_DIR)colvarscript_commands_colvar.o: \ $(COLVARS_OBJ_DIR)colvarscript_commands_colvar.o: \
colvarscript_commands_colvar.cpp colvarproxy.h colvarmodule.h \ colvarscript_commands_colvar.cpp colvarproxy.h colvarmodule.h \
colvars_version.h colvartypes.h colvarvalue.h colvarproxy_tcl.h \ colvars_version.h colvartypes.h colvarvalue.h colvarproxy_tcl.h \
colvarproxy_volmaps.h colvardeps.h colvarparse.h colvarparams.h \ colvarproxy_volmaps.h colvardeps.h colvarparse.h colvarparams.h \
colvarscript.h colvarbias.h colvar.h colvarscript_commands.h \ colvarscript.h colvarbias.h colvar.h lepton/include/Lepton.h \
colvarscript_commands_colvar.h colvarscript_commands_bias.h lepton/include/lepton/CompiledExpression.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/windowsIncludes.h \
lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/ExpressionProgram.h \
lepton/include/lepton/ExpressionTreeNode.h \
lepton/include/lepton/Operation.h lepton/include/lepton/CustomFunction.h \
lepton/include/lepton/Exception.h \
lepton/include/lepton/ParsedExpression.h lepton/include/lepton/Parser.h \
colvarscript_commands.h colvarscript_commands_colvar.h \
colvarscript_commands_bias.h
$(COLVARS_OBJ_DIR)colvartypes.o: colvartypes.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvartypes.o: colvartypes.cpp colvarmodule.h \
colvars_version.h colvartypes.h colvarparse.h colvarvalue.h \ colvars_version.h colvartypes.h colvarparse.h colvarvalue.h \
colvarparams.h colvarparams.h ../../src/math_eigen.h
$(COLVARS_OBJ_DIR)colvarvalue.o: colvarvalue.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarvalue.o: colvarvalue.cpp colvarmodule.h \
colvars_version.h colvarvalue.h colvartypes.h colvars_version.h colvarvalue.h colvartypes.h

View File

@ -18,7 +18,9 @@
#include "colvarcomp.h" #include "colvarcomp.h"
#include "colvarscript.h" #include "colvarscript.h"
#if (__cplusplus >= 201103L)
std::map<std::string, std::function<colvar::cvc* (const std::string& subcv_conf)>> colvar::global_cvc_map = std::map<std::string, std::function<colvar::cvc* (const std::string& subcv_conf)>>();
#endif
colvar::colvar() colvar::colvar()
{ {
@ -724,15 +726,15 @@ int colvar::init_output_flags(std::string const &conf)
return COLVARS_OK; return COLVARS_OK;
} }
// read the configuration and set up corresponding instances, for // read the configuration and set up corresponding instances, for
// each type of component implemented // each type of component implemented
template<typename def_class_name> int colvar::init_components_type(std::string const &conf, template<typename def_class_name> int colvar::init_components_type(std::string const &conf,
char const * /* def_desc */, char const * /* def_desc */,
char const *def_config_key) char const *def_config_key)
{ {
#if (__cplusplus >= 201103L)
global_cvc_map[def_config_key] = [](const std::string& cvc_conf){return new def_class_name(cvc_conf);};
#endif
size_t def_count = 0; size_t def_count = 0;
std::string def_conf = ""; std::string def_conf = "";
size_t pos = 0; size_t pos = 0;

View File

@ -12,6 +12,11 @@
#include <iostream> #include <iostream>
#if (__cplusplus >= 201103L)
#include <map>
#include <functional>
#endif
#include "colvarmodule.h" #include "colvarmodule.h"
#include "colvarvalue.h" #include "colvarvalue.h"
#include "colvarparse.h" #include "colvarparse.h"
@ -114,6 +119,7 @@ public:
/// List of biases that depend on this colvar /// List of biases that depend on this colvar
std::vector<colvarbias *> biases; std::vector<colvarbias *> biases;
protected: protected:
@ -605,6 +611,14 @@ public:
// components that do not handle any atoms directly // components that do not handle any atoms directly
class map_total; class map_total;
/// getter of the global cvc map
#if (__cplusplus >= 201103L)
/// A global mapping of cvc names to the cvc constructors
static const std::map<std::string, std::function<colvar::cvc* (const std::string& subcv_conf)>>& get_global_cvc_map() {
return global_cvc_map;
}
#endif
protected: protected:
/// \brief Array of \link colvar::cvc \endlink objects /// \brief Array of \link colvar::cvc \endlink objects
@ -639,6 +653,11 @@ protected:
double dev_null; double dev_null;
#endif #endif
#if (__cplusplus >= 201103L)
/// A global mapping of cvc names to the cvc constructors
static std::map<std::string, std::function<colvar::cvc* (const std::string& subcv_conf)>> global_cvc_map;
#endif
public: public:
/// \brief Sorted array of (zero-based) IDs for all atoms involved /// \brief Sorted array of (zero-based) IDs for all atoms involved

View File

@ -1493,8 +1493,6 @@ class colvar::linearCombination
: public colvar::cvc : public colvar::cvc
{ {
protected: protected:
/// Map from string to the types of colvar components
std::map<std::string, std::function<colvar::cvc* (const std::string& subcv_conf)>> string_cv_map;
/// Sub-colvar components /// Sub-colvar components
std::vector<colvar::cvc*> cv; std::vector<colvar::cvc*> cv;
/// If all sub-cvs use explicit gradients then we also use it /// If all sub-cvs use explicit gradients then we also use it
@ -1514,8 +1512,6 @@ class colvar::CVBasedPath
: public colvar::cvc : public colvar::cvc
{ {
protected: protected:
/// Map from string to the types of colvar components
std::map<std::string, std::function<colvar::cvc* (const std::string& subcv_conf)>> string_cv_map;
/// Sub-colvar components /// Sub-colvar components
std::vector<colvar::cvc*> cv; std::vector<colvar::cvc*> cv;
/// Reference colvar values from path /// Reference colvar values from path

View File

@ -19,10 +19,6 @@
#include "colvar.h" #include "colvar.h"
#include "colvarcomp.h" #include "colvarcomp.h"
namespace GeometricPathCV {
void init_string_cv_map(std::map<std::string, std::function<colvar::cvc* (const std::string& conf)>>& string_cv_map);
}
bool compareColvarComponent(colvar::cvc *i, colvar::cvc *j) bool compareColvarComponent(colvar::cvc *i, colvar::cvc *j)
{ {
return i->name < j->name; return i->name < j->name;
@ -406,9 +402,8 @@ void colvar::gzpath::apply_force(colvarvalue const &force) {
} }
colvar::linearCombination::linearCombination(std::string const &conf): cvc(conf) { colvar::linearCombination::linearCombination(std::string const &conf): cvc(conf) {
GeometricPathCV::init_string_cv_map(string_cv_map);
// Lookup all available sub-cvcs // Lookup all available sub-cvcs
for (auto it_cv_map = string_cv_map.begin(); it_cv_map != string_cv_map.end(); ++it_cv_map) { for (auto it_cv_map = colvar::get_global_cvc_map().begin(); it_cv_map != colvar::get_global_cvc_map().end(); ++it_cv_map) {
if (key_lookup(conf, it_cv_map->first.c_str())) { if (key_lookup(conf, it_cv_map->first.c_str())) {
std::vector<std::string> sub_cvc_confs; std::vector<std::string> sub_cvc_confs;
get_key_string_multi_value(conf, it_cv_map->first.c_str(), sub_cvc_confs); get_key_string_multi_value(conf, it_cv_map->first.c_str(), sub_cvc_confs);
@ -506,9 +501,8 @@ void colvar::linearCombination::apply_force(colvarvalue const &force) {
} }
colvar::CVBasedPath::CVBasedPath(std::string const &conf): cvc(conf) { colvar::CVBasedPath::CVBasedPath(std::string const &conf): cvc(conf) {
GeometricPathCV::init_string_cv_map(string_cv_map);
// Lookup all available sub-cvcs // Lookup all available sub-cvcs
for (auto it_cv_map = string_cv_map.begin(); it_cv_map != string_cv_map.end(); ++it_cv_map) { for (auto it_cv_map = colvar::get_global_cvc_map().begin(); it_cv_map != colvar::get_global_cvc_map().end(); ++it_cv_map) {
if (key_lookup(conf, it_cv_map->first.c_str())) { if (key_lookup(conf, it_cv_map->first.c_str())) {
std::vector<std::string> sub_cvc_confs; std::vector<std::string> sub_cvc_confs;
get_key_string_multi_value(conf, it_cv_map->first.c_str(), sub_cvc_confs); get_key_string_multi_value(conf, it_cv_map->first.c_str(), sub_cvc_confs);
@ -909,33 +903,4 @@ void colvar::gzpathCV::apply_force(colvarvalue const &force) {
} }
} }
void GeometricPathCV::init_string_cv_map(std::map<std::string, std::function<colvar::cvc* (const std::string& subcv_conf)>>& string_cv_map) {
string_cv_map["distance"] = [](const std::string& conf){return new colvar::distance(conf);};
string_cv_map["dihedral"] = [](const std::string& conf){return new colvar::dihedral(conf);};
string_cv_map["angle"] = [](const std::string& conf){return new colvar::angle(conf);};
string_cv_map["rmsd"] = [](const std::string& conf){return new colvar::rmsd(conf);};
string_cv_map["gyration"] = [](const std::string& conf){return new colvar::gyration(conf);};
string_cv_map["inertia"] = [](const std::string& conf){return new colvar::inertia(conf);};
string_cv_map["inertiaZ"] = [](const std::string& conf){return new colvar::inertia_z(conf);};
string_cv_map["tilt"] = [](const std::string& conf){return new colvar::tilt(conf);};
string_cv_map["distanceZ"] = [](const std::string& conf){return new colvar::distance_z(conf);};
string_cv_map["distanceXY"] = [](const std::string& conf){return new colvar::distance_xy(conf);};
string_cv_map["polarTheta"] = [](const std::string& conf){return new colvar::polar_theta(conf);};
string_cv_map["polarPhi"] = [](const std::string& conf){return new colvar::polar_phi(conf);};
string_cv_map["distanceVec"] = [](const std::string& conf){return new colvar::distance_vec(conf);};
string_cv_map["orientationAngle"] = [](const std::string& conf){return new colvar::orientation_angle(conf);};
string_cv_map["distancePairs"] = [](const std::string& conf){return new colvar::distance_pairs(conf);};
string_cv_map["dipoleMagnitude"] = [](const std::string& conf){return new colvar::dipole_magnitude(conf);};
string_cv_map["coordNum"] = [](const std::string& conf){return new colvar::coordnum(conf);};
string_cv_map["selfCoordNum"] = [](const std::string& conf){return new colvar::selfcoordnum(conf);};
string_cv_map["dipoleAngle"] = [](const std::string& conf){return new colvar::dipole_angle(conf);};
string_cv_map["orientation"] = [](const std::string& conf){return new colvar::orientation(conf);};
string_cv_map["orientationProj"] = [](const std::string& conf){return new colvar::orientation_proj(conf);};
string_cv_map["eigenvector"] = [](const std::string& conf){return new colvar::eigenvector(conf);};
string_cv_map["cartesian"] = [](const std::string& conf){return new colvar::cartesian(conf);};
string_cv_map["alpha"] = [](const std::string& conf){return new colvar::alpha_angles(conf);};
string_cv_map["dihedralPC"] = [](const std::string& conf){return new colvar::dihedPC(conf);};
string_cv_map["linearCombination"] = [](const std::string& conf){return new colvar::linearCombination(conf);};
}
#endif #endif

View File

@ -1,3 +1,3 @@
#ifndef COLVARS_VERSION #ifndef COLVARS_VERSION
#define COLVARS_VERSION "2020-07-07" #define COLVARS_VERSION "2020-09-17"
#endif #endif

View File

@ -14,25 +14,19 @@
#include "colvartypes.h" #include "colvartypes.h"
#include "colvarparse.h" #include "colvarparse.h"
#ifdef COLVARS_LAMMPS
// Use open-source Jacobi implementation
#include "math_eigen_impl.h"
#else
// Fall back to NR routine
#include "nr_jacobi.h"
#endif
bool colvarmodule::rotation::monitor_crossings = false; bool colvarmodule::rotation::monitor_crossings = false;
cvm::real colvarmodule::rotation::crossing_threshold = 1.0E-02; cvm::real colvarmodule::rotation::crossing_threshold = 1.0E-02;
namespace {
/// Numerical recipes diagonalization
static int jacobi(cvm::real **a, cvm::real *d, cvm::real **v, int *nrot);
/// Eigenvector sort
static int eigsrt(cvm::real *d, cvm::real **v);
/// Transpose the matrix
static int transpose(cvm::real **v);
}
std::string cvm::rvector::to_simple_string() const std::string cvm::rvector::to_simple_string() const
{ {
std::ostringstream os; std::ostringstream os;
@ -248,6 +242,66 @@ cvm::quaternion::position_derivative_inner(cvm::rvector const &pos,
// Seok C, Dill KA. Using quaternions to calculate RMSD. J Comput // Seok C, Dill KA. Using quaternions to calculate RMSD. J Comput
// Chem. 25(15):1849-57 (2004) DOI: 10.1002/jcc.20110 PubMed: 15376254 // Chem. 25(15):1849-57 (2004) DOI: 10.1002/jcc.20110 PubMed: 15376254
#ifdef COLVARS_LAMMPS
namespace {
inline void *new_Jacobi_solver(int size) {
return reinterpret_cast<void *>(new MathEigen::Jacobi<cvm::real,
cvm::vector1d<cvm::real> &,
cvm::matrix2d<cvm::real> &>(4));
}
}
#endif
colvarmodule::rotation::rotation()
{
b_debug_gradients = false;
#ifdef COLVARS_LAMMPS
jacobi = new_Jacobi_solver(4);
#else
jacobi = NULL;
#endif
}
colvarmodule::rotation::rotation(cvm::quaternion const &qi)
: q(qi)
{
b_debug_gradients = false;
#ifdef COLVARS_LAMMPS
jacobi = new_Jacobi_solver(4);
#else
jacobi = NULL;
#endif
}
colvarmodule::rotation::rotation(cvm::real angle, cvm::rvector const &axis)
{
b_debug_gradients = false;
cvm::rvector const axis_n = axis.unit();
cvm::real const sina = cvm::sin(angle/2.0);
q = cvm::quaternion(cvm::cos(angle/2.0),
sina * axis_n.x, sina * axis_n.y, sina * axis_n.z);
#ifdef COLVARS_LAMMPS
jacobi = new_Jacobi_solver(4);
#else
jacobi = NULL;
#endif
}
colvarmodule::rotation::~rotation()
{
#ifdef COLVARS_LAMMPS
delete reinterpret_cast<
MathEigen::Jacobi<cvm::real,
cvm::vector1d<cvm::real> &,
cvm::matrix2d<cvm::real> &> *>(jacobi);
#endif
}
void colvarmodule::rotation::build_correlation_matrix( void colvarmodule::rotation::build_correlation_matrix(
std::vector<cvm::atom_pos> const &pos1, std::vector<cvm::atom_pos> const &pos1,
std::vector<cvm::atom_pos> const &pos2) std::vector<cvm::atom_pos> const &pos2)
@ -291,10 +345,12 @@ void colvarmodule::rotation::compute_overlap_matrix()
} }
void colvarmodule::rotation::diagonalize_matrix( #ifndef COLVARS_LAMMPS
cvm::matrix2d<cvm::real> &m, namespace {
cvm::vector1d<cvm::real> &eigval,
cvm::matrix2d<cvm::real> &eigvec) void diagonalize_matrix(cvm::matrix2d<cvm::real> &m,
cvm::vector1d<cvm::real> &eigval,
cvm::matrix2d<cvm::real> &eigvec)
{ {
eigval.resize(4); eigval.resize(4);
eigval.reset(); eigval.reset();
@ -303,15 +359,15 @@ void colvarmodule::rotation::diagonalize_matrix(
// diagonalize // diagonalize
int jac_nrot = 0; int jac_nrot = 0;
if (jacobi(m.c_array(), eigval.c_array(), eigvec.c_array(), &jac_nrot) != if (NR_Jacobi::jacobi(m.c_array(), eigval.c_array(), eigvec.c_array(), &jac_nrot) !=
COLVARS_OK) { COLVARS_OK) {
cvm::error("Too many iterations in routine jacobi.\n" cvm::error("Too many iterations in jacobi diagonalization.\n"
"This is usually the result of an ill-defined set of atoms for " "This is usually the result of an ill-defined set of atoms for "
"rotational alignment (RMSD, rotateReference, etc).\n"); "rotational alignment (RMSD, rotateReference, etc).\n");
} }
eigsrt(eigval.c_array(), eigvec.c_array()); NR_Jacobi::eigsrt(eigval.c_array(), eigvec.c_array());
// jacobi saves eigenvectors by columns // jacobi saves eigenvectors by columns
transpose(eigvec.c_array()); NR_Jacobi::transpose(eigvec.c_array());
// normalize eigenvectors // normalize eigenvectors
for (size_t ie = 0; ie < 4; ie++) { for (size_t ie = 0; ie < 4; ie++) {
@ -327,6 +383,9 @@ void colvarmodule::rotation::diagonalize_matrix(
} }
} }
}
#endif
// Calculate the rotation, plus its derivatives // Calculate the rotation, plus its derivatives
@ -349,7 +408,28 @@ void colvarmodule::rotation::calc_optimal_rotation(
cvm::log("S = "+cvm::to_str(S_backup, cvm::cv_width, cvm::cv_prec)+"\n"); cvm::log("S = "+cvm::to_str(S_backup, cvm::cv_width, cvm::cv_prec)+"\n");
} }
S_eigval.resize(4);
S_eigvec.resize(4, 4);
#ifdef COLVARS_LAMMPS
MathEigen::Jacobi<cvm::real,
cvm::vector1d<cvm::real> &,
cvm::matrix2d<cvm::real> &> *ecalc =
reinterpret_cast<MathEigen::Jacobi<cvm::real,
cvm::vector1d<cvm::real> &,
cvm::matrix2d<cvm::real> &> *>(jacobi);
int ierror = ecalc->Diagonalize(S, S_eigval, S_eigvec);
if (ierror) {
cvm::error("Too many iterations in jacobi diagonalization.\n"
"This is usually the result of an ill-defined set of atoms for "
"rotational alignment (RMSD, rotateReference, etc).\n");
}
#else
diagonalize_matrix(S, S_eigval, S_eigvec); diagonalize_matrix(S, S_eigval, S_eigvec);
#endif
// eigenvalues and eigenvectors // eigenvalues and eigenvectors
cvm::real const L0 = S_eigval[0]; cvm::real const L0 = S_eigval[0];
cvm::real const L1 = S_eigval[1]; cvm::real const L1 = S_eigval[1];
@ -521,7 +601,11 @@ void colvarmodule::rotation::calc_optimal_rotation(
// cvm::log("S_new = "+cvm::to_str(cvm::to_str (S_new), cvm::cv_width, cvm::cv_prec)+"\n"); // cvm::log("S_new = "+cvm::to_str(cvm::to_str (S_new), cvm::cv_width, cvm::cv_prec)+"\n");
#ifdef COLVARS_LAMMPS
ecalc->Diagonalize(S_new, S_new_eigval, S_new_eigvec);
#else
diagonalize_matrix(S_new, S_new_eigval, S_new_eigvec); diagonalize_matrix(S_new, S_new_eigval, S_new_eigvec);
#endif
cvm::real const &L0_new = S_new_eigval[0]; cvm::real const &L0_new = S_new_eigval[0];
cvm::quaternion const Q0_new(S_new_eigvec[0]); cvm::quaternion const Q0_new(S_new_eigvec[0]);
@ -544,138 +628,3 @@ void colvarmodule::rotation::calc_optimal_rotation(
// Numerical Recipes routine for diagonalization
#define ROTATE(a,i,j,k,l) g=a[i][j]; \
h=a[k][l]; \
a[i][j]=g-s*(h+g*tau); \
a[k][l]=h+s*(g-h*tau);
#define n 4
namespace {
int jacobi(cvm::real **a, cvm::real *d, cvm::real **v, int *nrot)
{
int j,iq,ip,i;
cvm::real tresh,theta,tau,t,sm,s,h,g,c;
cvm::vector1d<cvm::real> b(n);
cvm::vector1d<cvm::real> z(n);
for (ip=0;ip<n;ip++) {
for (iq=0;iq<n;iq++) {
v[ip][iq]=0.0;
}
v[ip][ip]=1.0;
}
for (ip=0;ip<n;ip++) {
b[ip]=d[ip]=a[ip][ip];
z[ip]=0.0;
}
*nrot=0;
for (i=0;i<=50;i++) {
sm=0.0;
for (ip=0;ip<n-1;ip++) {
for (iq=ip+1;iq<n;iq++)
sm += cvm::fabs(a[ip][iq]);
}
if (sm == 0.0) {
return COLVARS_OK;
}
if (i < 4)
tresh=0.2*sm/(n*n);
else
tresh=0.0;
for (ip=0;ip<n-1;ip++) {
for (iq=ip+1;iq<n;iq++) {
g=100.0*cvm::fabs(a[ip][iq]);
if (i > 4 && (cvm::real)(cvm::fabs(d[ip])+g) == (cvm::real)cvm::fabs(d[ip])
&& (cvm::real)(cvm::fabs(d[iq])+g) == (cvm::real)cvm::fabs(d[iq]))
a[ip][iq]=0.0;
else if (cvm::fabs(a[ip][iq]) > tresh) {
h=d[iq]-d[ip];
if ((cvm::real)(cvm::fabs(h)+g) == (cvm::real)cvm::fabs(h))
t=(a[ip][iq])/h;
else {
theta=0.5*h/(a[ip][iq]);
t=1.0/(cvm::fabs(theta)+cvm::sqrt(1.0+theta*theta));
if (theta < 0.0) t = -t;
}
c=1.0/cvm::sqrt(1+t*t);
s=t*c;
tau=s/(1.0+c);
h=t*a[ip][iq];
z[ip] -= h;
z[iq] += h;
d[ip] -= h;
d[iq] += h;
a[ip][iq]=0.0;
for (j=0;j<=ip-1;j++) {
ROTATE(a,j,ip,j,iq)
}
for (j=ip+1;j<=iq-1;j++) {
ROTATE(a,ip,j,j,iq)
}
for (j=iq+1;j<n;j++) {
ROTATE(a,ip,j,iq,j)
}
for (j=0;j<n;j++) {
ROTATE(v,j,ip,j,iq)
}
++(*nrot);
}
}
}
for (ip=0;ip<n;ip++) {
b[ip] += z[ip];
d[ip]=b[ip];
z[ip]=0.0;
}
}
return COLVARS_ERROR;
}
int eigsrt(cvm::real *d, cvm::real **v)
{
int k,j,i;
cvm::real p;
for (i=0;i<n;i++) {
p=d[k=i];
for (j=i+1;j<n;j++)
if (d[j] >= p) p=d[k=j];
if (k != i) {
d[k]=d[i];
d[i]=p;
for (j=0;j<n;j++) {
p=v[j][i];
v[j][i]=v[j][k];
v[j][k]=p;
}
}
}
return COLVARS_OK;
}
int transpose(cvm::real **v)
{
cvm::real p;
int i,j;
for (i=0;i<n;i++) {
for (j=i+1;j<n;j++) {
p=v[i][j];
v[i][j]=v[j][i];
v[j][i]=p;
}
}
return COLVARS_OK;
}
}
#undef n
#undef ROTATE

View File

@ -1389,30 +1389,16 @@ public:
std::vector<atom_pos> const &pos2); std::vector<atom_pos> const &pos2);
/// Default constructor /// Default constructor
inline rotation() rotation();
: b_debug_gradients(false)
{}
/// Constructor after a quaternion /// Constructor after a quaternion
inline rotation(cvm::quaternion const &qi) rotation(cvm::quaternion const &qi);
: q(qi),
b_debug_gradients(false)
{
}
/// Constructor after an axis of rotation and an angle (in radians) /// Constructor after an axis of rotation and an angle (in radians)
inline rotation(cvm::real angle, cvm::rvector const &axis) rotation(cvm::real angle, cvm::rvector const &axis);
: b_debug_gradients(false)
{
cvm::rvector const axis_n = axis.unit();
cvm::real const sina = cvm::sin(angle/2.0);
q = cvm::quaternion(cvm::cos(angle/2.0),
sina * axis_n.x, sina * axis_n.y, sina * axis_n.z);
}
/// Destructor /// Destructor
inline ~rotation() ~rotation();
{}
/// Return the rotated vector /// Return the rotated vector
inline cvm::rvector rotate(cvm::rvector const &v) const inline cvm::rvector rotate(cvm::rvector const &v) const
@ -1432,7 +1418,6 @@ public:
return q.rotation_matrix(); return q.rotation_matrix();
} }
/// \brief Return the spin angle (in degrees) with respect to the /// \brief Return the spin angle (in degrees) with respect to the
/// provided axis (which MUST be normalized) /// provided axis (which MUST be normalized)
inline cvm::real spin_angle(cvm::rvector const &axis) const inline cvm::real spin_angle(cvm::rvector const &axis) const
@ -1537,10 +1522,8 @@ protected:
/// Compute the overlap matrix S (used by calc_optimal_rotation()) /// Compute the overlap matrix S (used by calc_optimal_rotation())
void compute_overlap_matrix(); void compute_overlap_matrix();
/// Diagonalize a given matrix m (used by calc_optimal_rotation()) /// Pointer to instance of Jacobi solver
static void diagonalize_matrix(cvm::matrix2d<cvm::real> &m, void *jacobi;
cvm::vector1d<cvm::real> &eigval,
cvm::matrix2d<cvm::real> &eigvec);
}; };