forked from lijiext/lammps
Merge pull request #22 from akohlmey/colvars-update
accumulated colvars library update and lib "make clean" improvement
This commit is contained in:
commit
07e55ef61e
doc/src/PDF
lib
atc
Makefile.iccMakefile.mingw32-crossMakefile.mingw32-cross-mpiMakefile.mingw64-crossMakefile.mingw64-cross-mpiMakefile.mpic++Makefile.serial
awpmd
colvars
Makefile.fermiMakefile.g++Makefile.mingw32-crossMakefile.mingw32-cross-mpiMakefile.mingw64-crossMakefile.mingw64-cross-mpicolvar.cppcolvar.hcolvaratoms.cppcolvaratoms.hcolvarbias.cppcolvarbias.hcolvarbias_abf.cppcolvarbias_abf.hcolvarbias_histogram.cppcolvarcomp.cppcolvarcomp.hcolvarcomp_angles.cppcolvarcomp_distances.cppcolvardeps.cppcolvardeps.hcolvargrid.cppcolvargrid.hcolvarmodule.cppcolvarmodule.hcolvarparse.cppcolvarparse.hcolvarproxy.hcolvarscript.cpp
gpu
kokkos
linalg
meam
poems
qmmm
src/USER-COLVARS
Binary file not shown.
|
@ -48,4 +48,4 @@ DEPENDS = $(OBJ:.o=.d)
|
|||
# ------ CLEAN ------
|
||||
|
||||
clean:
|
||||
rm *.o *.d *~ $(LIB)
|
||||
-rm *.o *.d *~ $(LIB)
|
||||
|
|
|
@ -61,7 +61,7 @@ DEPENDS = $(OBJ:.o=.d)
|
|||
# ------ CLEAN ------
|
||||
|
||||
clean:
|
||||
rm $(DIR)*.o $(DIR)*.d *~ $(LIB)
|
||||
-rm $(DIR)*.o $(DIR)*.d *~ $(LIB)
|
||||
|
||||
$(DEPENDS) : $(DIR)
|
||||
sinclude $(DEPENDS)
|
||||
|
|
|
@ -62,7 +62,7 @@ DEPENDS = $(OBJ:.o=.d)
|
|||
# ------ CLEAN ------
|
||||
|
||||
clean:
|
||||
rm $(DIR)*.o $(DIR)*.d *~ $(LIB)
|
||||
-rm $(DIR)*.o $(DIR)*.d *~ $(LIB)
|
||||
|
||||
$(DEPENDS) : $(DIR)
|
||||
sinclude $(DEPENDS)
|
||||
|
|
|
@ -61,7 +61,7 @@ DEPENDS = $(OBJ:.o=.d)
|
|||
# ------ CLEAN ------
|
||||
|
||||
clean:
|
||||
rm $(DIR)*.o $(DIR)*.d *~ $(LIB)
|
||||
-rm $(DIR)*.o $(DIR)*.d *~ $(LIB)
|
||||
|
||||
$(DEPENDS) : $(DIR)
|
||||
sinclude $(DEPENDS)
|
||||
|
|
|
@ -62,7 +62,7 @@ DEPENDS = $(OBJ:.o=.d)
|
|||
# ------ CLEAN ------
|
||||
|
||||
clean:
|
||||
rm $(DIR)*.o $(DIR)*.d *~ $(LIB)
|
||||
-rm $(DIR)*.o $(DIR)*.d *~ $(LIB)
|
||||
|
||||
$(DEPENDS) : $(DIR)
|
||||
sinclude $(DEPENDS)
|
||||
|
|
|
@ -34,6 +34,6 @@ lib: $(OBJ)
|
|||
DEPENDS = $(OBJ:.o=.d)
|
||||
# ------ CLEAN ------
|
||||
clean:
|
||||
@rm *.o *.d *~ $(LIB)
|
||||
-rm *.o *.d *~ $(LIB)
|
||||
|
||||
sinclude $(DEPENDS)
|
||||
|
|
|
@ -46,6 +46,6 @@ DEPENDS = $(OBJ:.o=.d)
|
|||
# ------ CLEAN ------
|
||||
|
||||
clean:
|
||||
@rm *.o *.d *~ $(LIB)
|
||||
-rm *.o *.d *~ $(LIB)
|
||||
|
||||
sinclude $(DEPENDS)
|
||||
|
|
|
@ -77,4 +77,4 @@ DEPENDS = $(OBJ:.o=.d)
|
|||
# ------ CLEAN ------
|
||||
|
||||
clean:
|
||||
rm *.d *~ $(OBJ) $(LIB)
|
||||
-rm *.d *~ $(OBJ) $(LIB)
|
||||
|
|
|
@ -76,4 +76,4 @@ DEPENDS = $(OBJ:.o=.d)
|
|||
# ------ CLEAN ------
|
||||
|
||||
clean:
|
||||
rm *.d *~ $(OBJ) $(LIB)
|
||||
-rm *.d *~ $(OBJ) $(LIB)
|
||||
|
|
|
@ -66,4 +66,4 @@ DEPENDS = $(OBJ:.o=.d)
|
|||
# ------ CLEAN ------
|
||||
|
||||
clean:
|
||||
rm *.d *~ $(OBJ) $(LIB)
|
||||
-rm *.d *~ $(OBJ) $(LIB)
|
||||
|
|
|
@ -54,58 +54,62 @@ colvars_standalone: colvars_main.o colvarproxy_standalone.o $(LIB)
|
|||
# ------ DEPENDENCIES ------
|
||||
#
|
||||
colvaratoms.o: colvaratoms.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarparse.h colvarvalue.h colvaratoms.h
|
||||
colvarvalue.h colvarparse.h colvardeps.h colvaratoms.h
|
||||
colvarbias_abf.o: colvarbias_abf.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvar.h colvarvalue.h colvarparse.h colvarbias_abf.h \
|
||||
colvarbias.h colvargrid.h
|
||||
colvarproxy.h colvarvalue.h colvar.h colvarparse.h colvardeps.h \
|
||||
colvarbias_abf.h colvarbias.h colvargrid.h
|
||||
colvarbias_alb.o: colvarbias_alb.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarbias_alb.h colvar.h colvarvalue.h colvarparse.h \
|
||||
colvarbias_restraint.h colvarbias.h
|
||||
colvarproxy.h colvarvalue.h colvarbias_alb.h colvar.h colvarparse.h \
|
||||
colvardeps.h colvarbias_restraint.h colvarbias.h
|
||||
colvarbias.o: colvarbias.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarbias.h colvar.h colvarparse.h
|
||||
colvarvalue.h colvarbias.h colvar.h colvarparse.h colvardeps.h
|
||||
colvarbias_histogram.o: colvarbias_histogram.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvar.h colvarparse.h \
|
||||
colvarbias_histogram.h colvarbias.h colvargrid.h
|
||||
colvardeps.h colvarbias_histogram.h colvarbias.h colvargrid.h
|
||||
colvarbias_meta.o: colvarbias_meta.cpp colvar.h colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvarbias_meta.h colvarbias.h colvargrid.h
|
||||
colvarbias_restraint.o: colvarbias_restraint.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarbias_restraint.h \
|
||||
colvarbias.h colvar.h colvarparse.h
|
||||
colvarbias.h colvar.h colvarparse.h colvardeps.h
|
||||
colvarcomp_angles.o: colvarcomp_angles.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvar.h colvarvalue.h colvarparse.h colvarcomp.h \
|
||||
colvaratoms.h
|
||||
colvarproxy.h colvarvalue.h colvar.h colvarparse.h colvardeps.h \
|
||||
colvarcomp.h colvaratoms.h
|
||||
colvarcomp_coordnums.o: colvarcomp_coordnums.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarparse.h colvarvalue.h colvaratoms.h \
|
||||
colvar.h colvarcomp.h
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvaratoms.h colvar.h colvarcomp.h
|
||||
colvarcomp.o: colvarcomp.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvar.h colvarparse.h colvarcomp.h colvaratoms.h
|
||||
colvarcomp_distances.o: colvarcomp_distances.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvar.h \
|
||||
colvarcomp.h colvaratoms.h
|
||||
colvarcomp_protein.o: colvarcomp_protein.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvar.h colvarcomp.h \
|
||||
colvarvalue.h colvar.h colvarparse.h colvardeps.h colvarcomp.h \
|
||||
colvaratoms.h
|
||||
colvarcomp_rotations.o: colvarcomp_rotations.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvar.h \
|
||||
colvarcomp_distances.o: colvarcomp_distances.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvar.h colvarcomp.h colvaratoms.h
|
||||
colvarcomp_protein.o: colvarcomp_protein.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h colvar.h \
|
||||
colvarcomp.h colvaratoms.h
|
||||
colvarcomp_rotations.o: colvarcomp_rotations.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvar.h colvarcomp.h colvaratoms.h
|
||||
colvar.o: colvar.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h colvar.h colvarcomp.h colvaratoms.h \
|
||||
colvarscript.h colvarbias.h
|
||||
colvarvalue.h colvarparse.h colvardeps.h colvar.h colvarcomp.h \
|
||||
colvaratoms.h colvarscript.h colvarbias.h
|
||||
colvardeps.o: colvardeps.cpp colvardeps.h colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h
|
||||
colvargrid.o: colvargrid.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h colvar.h colvarcomp.h colvaratoms.h \
|
||||
colvargrid.h
|
||||
colvarvalue.h colvarparse.h colvardeps.h colvar.h colvarcomp.h \
|
||||
colvaratoms.h colvargrid.h
|
||||
colvarmodule.o: colvarmodule.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvar.h colvarbias.h \
|
||||
colvarbias_abf.h colvargrid.h colvarbias_alb.h colvarbias_restraint.h \
|
||||
colvarbias_histogram.h colvarbias_meta.h colvarscript.h
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h colvar.h \
|
||||
colvarbias.h colvarbias_abf.h colvargrid.h colvarbias_alb.h \
|
||||
colvarbias_restraint.h colvarbias_histogram.h colvarbias_meta.h \
|
||||
colvarscript.h
|
||||
colvarparse.o: colvarparse.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h
|
||||
colvarscript.o: colvarscript.cpp colvarscript.h colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvar.h colvarparse.h \
|
||||
colvarbias.h
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarbias.h colvar.h \
|
||||
colvarparse.h colvardeps.h
|
||||
colvartypes.o: colvartypes.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarparse.h colvarvalue.h
|
||||
colvarvalue.h colvarparse.h
|
||||
colvarvalue.o: colvarvalue.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h
|
||||
|
||||
|
|
|
@ -53,56 +53,60 @@ colvars_standalone: colvars_main.o colvarproxy_standalone.o $(LIB)
|
|||
# ------ DEPENDENCIES ------
|
||||
#
|
||||
colvaratoms.o: colvaratoms.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h colvaratoms.h
|
||||
colvarvalue.h colvarparse.h colvardeps.h colvaratoms.h
|
||||
colvarbias_abf.o: colvarbias_abf.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvar.h colvarparse.h colvarbias_abf.h \
|
||||
colvarbias.h colvargrid.h
|
||||
colvarproxy.h colvarvalue.h colvar.h colvarparse.h colvardeps.h \
|
||||
colvarbias_abf.h colvarbias.h colvargrid.h
|
||||
colvarbias_alb.o: colvarbias_alb.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarbias_alb.h colvar.h colvarparse.h \
|
||||
colvarbias_restraint.h colvarbias.h
|
||||
colvardeps.h colvarbias_restraint.h colvarbias.h
|
||||
colvarbias.o: colvarbias.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarbias.h colvar.h colvarparse.h
|
||||
colvarvalue.h colvarbias.h colvar.h colvarparse.h colvardeps.h
|
||||
colvarbias_histogram.o: colvarbias_histogram.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvar.h colvarparse.h \
|
||||
colvarbias_histogram.h colvarbias.h colvargrid.h
|
||||
colvardeps.h colvarbias_histogram.h colvarbias.h colvargrid.h
|
||||
colvarbias_meta.o: colvarbias_meta.cpp colvar.h colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvarbias_meta.h colvarbias.h colvargrid.h
|
||||
colvarbias_restraint.o: colvarbias_restraint.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarbias_restraint.h \
|
||||
colvarbias.h colvar.h colvarparse.h
|
||||
colvarbias.h colvar.h colvarparse.h colvardeps.h
|
||||
colvarcomp_angles.o: colvarcomp_angles.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvar.h colvarparse.h colvarcomp.h \
|
||||
colvaratoms.h
|
||||
colvarproxy.h colvarvalue.h colvar.h colvarparse.h colvardeps.h \
|
||||
colvarcomp.h colvaratoms.h
|
||||
colvarcomp_coordnums.o: colvarcomp_coordnums.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvaratoms.h \
|
||||
colvar.h colvarcomp.h
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvaratoms.h colvar.h colvarcomp.h
|
||||
colvarcomp.o: colvarcomp.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvar.h colvarparse.h colvarcomp.h colvaratoms.h
|
||||
colvarcomp_distances.o: colvarcomp_distances.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvar.h \
|
||||
colvarcomp.h colvaratoms.h
|
||||
colvarcomp_protein.o: colvarcomp_protein.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvar.h colvarcomp.h \
|
||||
colvarvalue.h colvar.h colvarparse.h colvardeps.h colvarcomp.h \
|
||||
colvaratoms.h
|
||||
colvarcomp_rotations.o: colvarcomp_rotations.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvar.h \
|
||||
colvarcomp_distances.o: colvarcomp_distances.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvar.h colvarcomp.h colvaratoms.h
|
||||
colvarcomp_protein.o: colvarcomp_protein.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h colvar.h \
|
||||
colvarcomp.h colvaratoms.h
|
||||
colvarcomp_rotations.o: colvarcomp_rotations.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvar.h colvarcomp.h colvaratoms.h
|
||||
colvar.o: colvar.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h colvar.h colvarcomp.h colvaratoms.h \
|
||||
colvarscript.h colvarbias.h
|
||||
colvarvalue.h colvarparse.h colvardeps.h colvar.h colvarcomp.h \
|
||||
colvaratoms.h colvarscript.h colvarbias.h
|
||||
colvardeps.o: colvardeps.cpp colvardeps.h colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h
|
||||
colvargrid.o: colvargrid.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h colvar.h colvarcomp.h colvaratoms.h \
|
||||
colvargrid.h
|
||||
colvarvalue.h colvarparse.h colvardeps.h colvar.h colvarcomp.h \
|
||||
colvaratoms.h colvargrid.h
|
||||
colvarmodule.o: colvarmodule.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvar.h colvarbias.h \
|
||||
colvarbias_abf.h colvargrid.h colvarbias_alb.h colvarbias_restraint.h \
|
||||
colvarbias_histogram.h colvarbias_meta.h colvarscript.h
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h colvar.h \
|
||||
colvarbias.h colvarbias_abf.h colvargrid.h colvarbias_alb.h \
|
||||
colvarbias_restraint.h colvarbias_histogram.h colvarbias_meta.h \
|
||||
colvarscript.h
|
||||
colvarparse.o: colvarparse.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h
|
||||
colvarscript.o: colvarscript.cpp colvarscript.h colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarbias.h colvar.h \
|
||||
colvarparse.h
|
||||
colvarparse.h colvardeps.h
|
||||
colvartypes.o: colvartypes.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h
|
||||
colvarvalue.o: colvarvalue.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
|
|
|
@ -61,58 +61,62 @@ $(DIR)%.o: %.cpp
|
|||
# ------ DEPENDENCIES ------
|
||||
#
|
||||
$(DIR)colvaratoms.o: colvaratoms.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarparse.h colvarvalue.h colvaratoms.h
|
||||
colvarvalue.h colvarparse.h colvardeps.h colvaratoms.h
|
||||
$(DIR)colvarbias_abf.o: colvarbias_abf.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvar.h colvarvalue.h colvarparse.h colvarbias_abf.h \
|
||||
colvarbias.h colvargrid.h
|
||||
colvarproxy.h colvarvalue.h colvar.h colvarparse.h colvardeps.h \
|
||||
colvarbias_abf.h colvarbias.h colvargrid.h
|
||||
$(DIR)colvarbias_alb.o: colvarbias_alb.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarbias_alb.h colvar.h colvarvalue.h colvarparse.h \
|
||||
colvarbias_restraint.h colvarbias.h
|
||||
colvarproxy.h colvarvalue.h colvarbias_alb.h colvar.h colvarparse.h \
|
||||
colvardeps.h colvarbias_restraint.h colvarbias.h
|
||||
$(DIR)colvarbias.o: colvarbias.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarbias.h colvar.h colvarparse.h
|
||||
colvarvalue.h colvarbias.h colvar.h colvarparse.h colvardeps.h
|
||||
$(DIR)colvarbias_histogram.o: colvarbias_histogram.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvar.h colvarparse.h \
|
||||
colvarbias_histogram.h colvarbias.h colvargrid.h
|
||||
colvardeps.h colvarbias_histogram.h colvarbias.h colvargrid.h
|
||||
$(DIR)colvarbias_meta.o: colvarbias_meta.cpp colvar.h colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvarbias_meta.h colvarbias.h colvargrid.h
|
||||
$(DIR)colvarbias_restraint.o: colvarbias_restraint.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarbias_restraint.h \
|
||||
colvarbias.h colvar.h colvarparse.h
|
||||
colvarbias.h colvar.h colvarparse.h colvardeps.h
|
||||
$(DIR)colvarcomp_angles.o: colvarcomp_angles.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvar.h colvarvalue.h colvarparse.h colvarcomp.h \
|
||||
colvaratoms.h
|
||||
colvarproxy.h colvarvalue.h colvar.h colvarparse.h colvardeps.h \
|
||||
colvarcomp.h colvaratoms.h
|
||||
$(DIR)colvarcomp_coordnums.o: colvarcomp_coordnums.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarparse.h colvarvalue.h colvaratoms.h \
|
||||
colvar.h colvarcomp.h
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvaratoms.h colvar.h colvarcomp.h
|
||||
$(DIR)colvarcomp.o: colvarcomp.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvar.h colvarparse.h colvarcomp.h colvaratoms.h
|
||||
$(DIR)colvarcomp_distances.o: colvarcomp_distances.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvar.h \
|
||||
colvarcomp.h colvaratoms.h
|
||||
$(DIR)colvarcomp_protein.o: colvarcomp_protein.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvar.h colvarcomp.h \
|
||||
colvarvalue.h colvar.h colvarparse.h colvardeps.h colvarcomp.h \
|
||||
colvaratoms.h
|
||||
$(DIR)colvarcomp_rotations.o: colvarcomp_rotations.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvar.h \
|
||||
$(DIR)colvarcomp_distances.o: colvarcomp_distances.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvar.h colvarcomp.h colvaratoms.h
|
||||
$(DIR)colvarcomp_protein.o: colvarcomp_protein.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h colvar.h \
|
||||
colvarcomp.h colvaratoms.h
|
||||
$(DIR)colvarcomp_rotations.o: colvarcomp_rotations.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvar.h colvarcomp.h colvaratoms.h
|
||||
$(DIR)colvar.o: colvar.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h colvar.h colvarcomp.h colvaratoms.h \
|
||||
colvarscript.h colvarbias.h
|
||||
colvarvalue.h colvarparse.h colvardeps.h colvar.h colvarcomp.h \
|
||||
colvaratoms.h colvarscript.h colvarbias.h
|
||||
$(DIR)colvardeps.o: colvardeps.cpp colvardeps.h colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h
|
||||
$(DIR)colvargrid.o: colvargrid.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h colvar.h colvarcomp.h colvaratoms.h \
|
||||
colvargrid.h
|
||||
colvarvalue.h colvarparse.h colvardeps.h colvar.h colvarcomp.h \
|
||||
colvaratoms.h colvargrid.h
|
||||
$(DIR)colvarmodule.o: colvarmodule.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvar.h colvarbias.h \
|
||||
colvarbias_abf.h colvargrid.h colvarbias_alb.h colvarbias_restraint.h \
|
||||
colvarbias_histogram.h colvarbias_meta.h colvarscript.h
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h colvar.h \
|
||||
colvarbias.h colvarbias_abf.h colvargrid.h colvarbias_alb.h \
|
||||
colvarbias_restraint.h colvarbias_histogram.h colvarbias_meta.h \
|
||||
colvarscript.h
|
||||
$(DIR)colvarparse.o: colvarparse.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h
|
||||
$(DIR)colvarscript.o: colvarscript.cpp colvarscript.h colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvar.h colvarparse.h \
|
||||
colvarbias.h
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarbias.h colvar.h \
|
||||
colvarparse.h colvardeps.h
|
||||
$(DIR)colvartypes.o: colvartypes.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarparse.h colvarvalue.h
|
||||
colvarvalue.h colvarparse.h
|
||||
$(DIR)colvarvalue.o: colvarvalue.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ SHELL=/bin/sh
|
|||
|
||||
all:
|
||||
$(MAKE) $(MFLAGS) mingw32-cross
|
||||
rm -f Obj_mingw32-mpi
|
||||
-rm -f Obj_mingw32-mpi
|
||||
ln -s Obj_mingw32 Obj_mingw32-mpi
|
||||
|
||||
clean:
|
||||
$(MAKE) $(MFLAGS) clean-mingw32-cross
|
||||
rm -f Obj_mingw32-mpi
|
||||
-rm -f Obj_mingw32-mpi
|
||||
|
||||
|
|
|
@ -61,58 +61,62 @@ $(DIR)%.o: %.cpp
|
|||
# ------ DEPENDENCIES ------
|
||||
#
|
||||
$(DIR)colvaratoms.o: colvaratoms.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarparse.h colvarvalue.h colvaratoms.h
|
||||
colvarvalue.h colvarparse.h colvardeps.h colvaratoms.h
|
||||
$(DIR)colvarbias_abf.o: colvarbias_abf.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvar.h colvarvalue.h colvarparse.h colvarbias_abf.h \
|
||||
colvarbias.h colvargrid.h
|
||||
colvarproxy.h colvarvalue.h colvar.h colvarparse.h colvardeps.h \
|
||||
colvarbias_abf.h colvarbias.h colvargrid.h
|
||||
$(DIR)colvarbias_alb.o: colvarbias_alb.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarbias_alb.h colvar.h colvarvalue.h colvarparse.h \
|
||||
colvarbias_restraint.h colvarbias.h
|
||||
colvarproxy.h colvarvalue.h colvarbias_alb.h colvar.h colvarparse.h \
|
||||
colvardeps.h colvarbias_restraint.h colvarbias.h
|
||||
$(DIR)colvarbias.o: colvarbias.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarbias.h colvar.h colvarparse.h
|
||||
colvarvalue.h colvarbias.h colvar.h colvarparse.h colvardeps.h
|
||||
$(DIR)colvarbias_histogram.o: colvarbias_histogram.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvar.h colvarparse.h \
|
||||
colvarbias_histogram.h colvarbias.h colvargrid.h
|
||||
colvardeps.h colvarbias_histogram.h colvarbias.h colvargrid.h
|
||||
$(DIR)colvarbias_meta.o: colvarbias_meta.cpp colvar.h colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvarbias_meta.h colvarbias.h colvargrid.h
|
||||
$(DIR)colvarbias_restraint.o: colvarbias_restraint.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarbias_restraint.h \
|
||||
colvarbias.h colvar.h colvarparse.h
|
||||
colvarbias.h colvar.h colvarparse.h colvardeps.h
|
||||
$(DIR)colvarcomp_angles.o: colvarcomp_angles.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvar.h colvarvalue.h colvarparse.h colvarcomp.h \
|
||||
colvaratoms.h
|
||||
colvarproxy.h colvarvalue.h colvar.h colvarparse.h colvardeps.h \
|
||||
colvarcomp.h colvaratoms.h
|
||||
$(DIR)colvarcomp_coordnums.o: colvarcomp_coordnums.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarparse.h colvarvalue.h colvaratoms.h \
|
||||
colvar.h colvarcomp.h
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvaratoms.h colvar.h colvarcomp.h
|
||||
$(DIR)colvarcomp.o: colvarcomp.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvar.h colvarparse.h colvarcomp.h colvaratoms.h
|
||||
$(DIR)colvarcomp_distances.o: colvarcomp_distances.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvar.h \
|
||||
colvarcomp.h colvaratoms.h
|
||||
$(DIR)colvarcomp_protein.o: colvarcomp_protein.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvar.h colvarcomp.h \
|
||||
colvarvalue.h colvar.h colvarparse.h colvardeps.h colvarcomp.h \
|
||||
colvaratoms.h
|
||||
$(DIR)colvarcomp_rotations.o: colvarcomp_rotations.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvar.h \
|
||||
$(DIR)colvarcomp_distances.o: colvarcomp_distances.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvar.h colvarcomp.h colvaratoms.h
|
||||
$(DIR)colvarcomp_protein.o: colvarcomp_protein.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h colvar.h \
|
||||
colvarcomp.h colvaratoms.h
|
||||
$(DIR)colvarcomp_rotations.o: colvarcomp_rotations.cpp colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h \
|
||||
colvar.h colvarcomp.h colvaratoms.h
|
||||
$(DIR)colvar.o: colvar.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h colvar.h colvarcomp.h colvaratoms.h \
|
||||
colvarscript.h colvarbias.h
|
||||
colvarvalue.h colvarparse.h colvardeps.h colvar.h colvarcomp.h \
|
||||
colvaratoms.h colvarscript.h colvarbias.h
|
||||
$(DIR)colvardeps.o: colvardeps.cpp colvardeps.h colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h
|
||||
$(DIR)colvargrid.o: colvargrid.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h colvar.h colvarcomp.h colvaratoms.h \
|
||||
colvargrid.h
|
||||
colvarvalue.h colvarparse.h colvardeps.h colvar.h colvarcomp.h \
|
||||
colvaratoms.h colvargrid.h
|
||||
$(DIR)colvarmodule.o: colvarmodule.cpp colvarmodule.h colvartypes.h \
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvar.h colvarbias.h \
|
||||
colvarbias_abf.h colvargrid.h colvarbias_alb.h colvarbias_restraint.h \
|
||||
colvarbias_histogram.h colvarbias_meta.h colvarscript.h
|
||||
colvarproxy.h colvarvalue.h colvarparse.h colvardeps.h colvar.h \
|
||||
colvarbias.h colvarbias_abf.h colvargrid.h colvarbias_alb.h \
|
||||
colvarbias_restraint.h colvarbias_histogram.h colvarbias_meta.h \
|
||||
colvarscript.h
|
||||
$(DIR)colvarparse.o: colvarparse.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h colvarparse.h
|
||||
$(DIR)colvarscript.o: colvarscript.cpp colvarscript.h colvarmodule.h \
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvar.h colvarparse.h \
|
||||
colvarbias.h
|
||||
colvartypes.h colvarproxy.h colvarvalue.h colvarbias.h colvar.h \
|
||||
colvarparse.h colvardeps.h
|
||||
$(DIR)colvartypes.o: colvartypes.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarparse.h colvarvalue.h
|
||||
colvarvalue.h colvarparse.h
|
||||
$(DIR)colvarvalue.o: colvarvalue.cpp colvarmodule.h colvartypes.h colvarproxy.h \
|
||||
colvarvalue.h
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ SHELL=/bin/sh
|
|||
|
||||
all:
|
||||
$(MAKE) $(MFLAGS) mingw64-cross
|
||||
rm -f Obj_mingw64-mpi
|
||||
-rm -f Obj_mingw64-mpi
|
||||
ln -s Obj_mingw64 Obj_mingw64-mpi
|
||||
|
||||
clean:
|
||||
$(MAKE) $(MFLAGS) clean-mingw64-cross
|
||||
rm -f Obj_mingw64-mpi
|
||||
-rm -f Obj_mingw64-mpi
|
||||
|
||||
|
|
|
@ -43,7 +43,8 @@ colvar::colvar(std::string const &conf)
|
|||
kinetic_energy = 0.0;
|
||||
potential_energy = 0.0;
|
||||
|
||||
cvm::combine_errors(error_code, init_components(conf));
|
||||
error_code |= init_components(conf);
|
||||
if (error_code != COLVARS_OK) return;
|
||||
|
||||
size_t i;
|
||||
|
||||
|
@ -373,10 +374,19 @@ colvar::colvar(std::string const &conf)
|
|||
}
|
||||
|
||||
{
|
||||
bool b_output_system_force;
|
||||
get_keyval(conf, "outputSystemForce", b_output_system_force, false);
|
||||
if (b_output_system_force) {
|
||||
enable(f_cv_output_system_force);
|
||||
bool temp;
|
||||
if (get_keyval(conf, "outputSystemForce", temp, false)) {
|
||||
cvm::error("Colvar option outputSystemForce is deprecated.\n"
|
||||
"Please use outputTotalForce, or outputSystemForce within an ABF bias.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
bool b_output_total_force;
|
||||
get_keyval(conf, "outputTotalForce", b_output_total_force, false);
|
||||
if (b_output_total_force) {
|
||||
enable(f_cv_output_total_force);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -492,110 +502,44 @@ int colvar::init_components(std::string const &conf)
|
|||
{
|
||||
int error_code = COLVARS_OK;
|
||||
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<distance>(conf,
|
||||
"distance", "distance"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<distance_vec>(conf,
|
||||
"distance vector", "distanceVec"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<cartesian>(conf,
|
||||
"Cartesian coordinates", "cartesian"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<distance_dir>(conf,
|
||||
"distance vector "
|
||||
"direction", "distanceDir"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<distance_z>(conf,
|
||||
"distance projection "
|
||||
"on an axis", "distanceZ"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<distance_xy>(conf,
|
||||
"distance projection "
|
||||
"on a plane", "distanceXY"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<distance_inv>(conf,
|
||||
"average distance "
|
||||
"weighted by inverse power",
|
||||
"distanceInv"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<distance_pairs>(conf,
|
||||
"N1xN2-long vector "
|
||||
"of pairwise distances",
|
||||
"distancePairs"));
|
||||
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<coordnum>(conf,
|
||||
"coordination "
|
||||
"number", "coordNum"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<selfcoordnum>(conf,
|
||||
"self-coordination "
|
||||
"number", "selfCoordNum"));
|
||||
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<angle>(conf,
|
||||
"angle", "angle"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<dipole_angle>(conf,
|
||||
"dipole angle", "dipoleAngle"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<dihedral>(conf,
|
||||
"dihedral", "dihedral"));
|
||||
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<h_bond>(conf,
|
||||
"hydrogen bond", "hBond"));
|
||||
|
||||
// cvm::combine_errors(error_code, init_components_type<alpha_dihedrals>(conf, "alpha helix", "alphaDihedrals"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<alpha_angles>(conf,
|
||||
"alpha helix", "alpha"));
|
||||
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<dihedPC>(conf,
|
||||
"dihedral "
|
||||
"principal component", "dihedralPC"));
|
||||
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<orientation>(conf,
|
||||
"orientation", "orientation"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<orientation_angle>(conf,
|
||||
"orientation "
|
||||
"angle", "orientationAngle"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<orientation_proj>(conf,
|
||||
"orientation "
|
||||
"projection", "orientationProj"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<tilt>(conf,
|
||||
"tilt", "tilt"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<spin_angle>(conf,
|
||||
"spin angle", "spinAngle"));
|
||||
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<rmsd>(conf,
|
||||
"RMSD", "rmsd"));
|
||||
|
||||
// cvm::combine_errors(error_code, init_components_type <logmsd>(conf,"logarithm of MSD", "logmsd"));
|
||||
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<gyration>(conf,
|
||||
"radius of "
|
||||
"gyration", "gyration"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<inertia>(conf,
|
||||
"moment of "
|
||||
"inertia", "inertia"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<inertia_z>(conf,
|
||||
"moment of inertia around an axis",
|
||||
"inertiaZ"));
|
||||
cvm::combine_errors(error_code,
|
||||
init_components_type<eigenvector>(conf,
|
||||
"eigenvector", "eigenvector"));
|
||||
error_code |= init_components_type<distance>(conf, "distance", "distance");
|
||||
error_code |= init_components_type<distance_vec>(conf, "distance vector", "distanceVec");
|
||||
error_code |= init_components_type<cartesian>(conf, "Cartesian coordinates", "cartesian");
|
||||
error_code |= init_components_type<distance_dir>(conf, "distance vector "
|
||||
"direction", "distanceDir");
|
||||
error_code |= init_components_type<distance_z>(conf, "distance projection "
|
||||
"on an axis", "distanceZ");
|
||||
error_code |= init_components_type<distance_xy>(conf, "distance projection "
|
||||
"on a plane", "distanceXY");
|
||||
error_code |= init_components_type<distance_inv>(conf, "average distance "
|
||||
"weighted by inverse power", "distanceInv");
|
||||
error_code |= init_components_type<distance_pairs>(conf, "N1xN2-long vector "
|
||||
"of pairwise distances", "distancePairs");
|
||||
error_code |= init_components_type<coordnum>(conf, "coordination "
|
||||
"number", "coordNum");
|
||||
error_code |= init_components_type<selfcoordnum>(conf, "self-coordination "
|
||||
"number", "selfCoordNum");
|
||||
error_code |= init_components_type<angle>(conf, "angle", "angle");
|
||||
error_code |= init_components_type<dipole_angle>(conf, "dipole angle", "dipoleAngle");
|
||||
error_code |= init_components_type<dihedral>(conf, "dihedral", "dihedral");
|
||||
error_code |= init_components_type<h_bond>(conf, "hydrogen bond", "hBond");
|
||||
error_code |= init_components_type<alpha_angles>(conf, "alpha helix", "alpha");
|
||||
error_code |= init_components_type<dihedPC>(conf, "dihedral "
|
||||
"principal component", "dihedralPC");
|
||||
error_code |= init_components_type<orientation>(conf, "orientation", "orientation");
|
||||
error_code |= init_components_type<orientation_angle>(conf, "orientation "
|
||||
"angle", "orientationAngle");
|
||||
error_code |= init_components_type<orientation_proj>(conf, "orientation "
|
||||
"projection", "orientationProj");
|
||||
error_code |= init_components_type<tilt>(conf, "tilt", "tilt");
|
||||
error_code |= init_components_type<spin_angle>(conf, "spin angle", "spinAngle");
|
||||
error_code |= init_components_type<rmsd>(conf, "RMSD", "rmsd");
|
||||
error_code |= init_components_type<gyration>(conf, "radius of "
|
||||
"gyration", "gyration");
|
||||
error_code |= init_components_type<inertia>(conf, "moment of "
|
||||
"inertia", "inertia");
|
||||
error_code |= init_components_type<inertia_z>(conf, "moment of inertia around an axis", "inertiaZ");
|
||||
error_code |= init_components_type<eigenvector>(conf, "eigenvector", "eigenvector");
|
||||
|
||||
if (!cvcs.size() || (error_code != COLVARS_OK)) {
|
||||
cvm::error("Error: no valid components were provided "
|
||||
|
@ -620,8 +564,8 @@ int colvar::init_components(std::string const &conf)
|
|||
int colvar::refresh_deps()
|
||||
{
|
||||
// If enabled features are changed upstream, the features below should be refreshed
|
||||
if (is_enabled(f_cv_system_force_calc)) {
|
||||
cvm::request_system_force();
|
||||
if (is_enabled(f_cv_total_force_calc)) {
|
||||
cvm::request_total_force();
|
||||
}
|
||||
if (is_enabled(f_cv_collect_gradient) && atom_ids.size() == 0) {
|
||||
build_atom_list();
|
||||
|
@ -732,7 +676,7 @@ int colvar::parse_analysis(std::string const &conf)
|
|||
} else {
|
||||
cvm::log("Unknown type of correlation function, \""+
|
||||
acf_type_str+"\".\n");
|
||||
cvm::set_error_bit(INPUT_ERROR);
|
||||
cvm::set_error_bits(INPUT_ERROR);
|
||||
}
|
||||
|
||||
get_keyval(conf, "corrFuncOffset", acf_offset, 0);
|
||||
|
@ -803,9 +747,11 @@ int colvar::calc()
|
|||
// Note: if anything is added here, it should be added also in the SMP block of calc_colvars()
|
||||
int error_code = COLVARS_OK;
|
||||
if (is_enabled(f_cv_active)) {
|
||||
cvm::combine_errors(error_code, update_cvc_flags());
|
||||
cvm::combine_errors(error_code, calc_cvcs());
|
||||
cvm::combine_errors(error_code, collect_cvc_data());
|
||||
error_code |= update_cvc_flags();
|
||||
if (error_code != COLVARS_OK) return error_code;
|
||||
error_code |= calc_cvcs();
|
||||
if (error_code != COLVARS_OK) return error_code;
|
||||
error_code |= collect_cvc_data();
|
||||
}
|
||||
return error_code;
|
||||
}
|
||||
|
@ -818,15 +764,15 @@ int colvar::calc_cvcs(int first_cvc, size_t num_cvcs)
|
|||
cvm::log("Calculating colvar \""+this->name+"\", components "+
|
||||
cvm::to_str(first_cvc)+" through "+cvm::to_str(first_cvc+num_cvcs)+".\n");
|
||||
|
||||
cvm::combine_errors(error_code, check_cvc_range(first_cvc, num_cvcs));
|
||||
error_code |= check_cvc_range(first_cvc, num_cvcs);
|
||||
if (error_code != COLVARS_OK) {
|
||||
return error_code;
|
||||
}
|
||||
|
||||
cvm::combine_errors(error_code, calc_cvc_values(first_cvc, num_cvcs));
|
||||
cvm::combine_errors(error_code, calc_cvc_gradients(first_cvc, num_cvcs));
|
||||
cvm::combine_errors(error_code, calc_cvc_sys_forces(first_cvc, num_cvcs));
|
||||
cvm::combine_errors(error_code, calc_cvc_Jacobians(first_cvc, num_cvcs));
|
||||
error_code |= calc_cvc_values(first_cvc, num_cvcs);
|
||||
error_code |= calc_cvc_gradients(first_cvc, num_cvcs);
|
||||
error_code |= calc_cvc_total_force(first_cvc, num_cvcs);
|
||||
error_code |= calc_cvc_Jacobians(first_cvc, num_cvcs);
|
||||
|
||||
if (cvm::debug())
|
||||
cvm::log("Done calculating colvar \""+this->name+"\".\n");
|
||||
|
@ -842,12 +788,11 @@ int colvar::collect_cvc_data()
|
|||
|
||||
int error_code = COLVARS_OK;
|
||||
|
||||
cvm::combine_errors(error_code, collect_cvc_values());
|
||||
cvm::combine_errors(error_code, collect_cvc_gradients());
|
||||
cvm::combine_errors(error_code, collect_cvc_sys_forces());
|
||||
cvm::combine_errors(error_code, collect_cvc_Jacobians());
|
||||
|
||||
cvm::combine_errors(error_code, calc_colvar_properties());
|
||||
error_code |= collect_cvc_values();
|
||||
error_code |= collect_cvc_gradients();
|
||||
error_code |= collect_cvc_total_forces();
|
||||
error_code |= collect_cvc_Jacobians();
|
||||
error_code |= calc_colvar_properties();
|
||||
|
||||
if (cvm::debug())
|
||||
cvm::log("Done calculating colvar \""+this->name+"\"'s properties.\n");
|
||||
|
@ -944,21 +889,22 @@ int colvar::calc_cvc_gradients(int first_cvc, size_t num_cvcs)
|
|||
size_t const cvc_max_count = num_cvcs ? num_cvcs : num_active_cvcs();
|
||||
size_t i, cvc_count;
|
||||
|
||||
if (is_enabled(f_cv_gradient)) {
|
||||
if (cvm::debug())
|
||||
cvm::log("Calculating gradients of colvar \""+this->name+"\".\n");
|
||||
|
||||
if (cvm::debug())
|
||||
cvm::log("Calculating gradients of colvar \""+this->name+"\".\n");
|
||||
// calculate the gradients of each component
|
||||
cvm::increase_depth();
|
||||
for (i = first_cvc, cvc_count = 0;
|
||||
(i < cvcs.size()) && (cvc_count < cvc_max_count);
|
||||
i++) {
|
||||
if (!cvcs[i]->is_enabled()) continue;
|
||||
cvc_count++;
|
||||
|
||||
// calculate the gradients of each component
|
||||
cvm::increase_depth();
|
||||
for (i = first_cvc, cvc_count = 0;
|
||||
(i < cvcs.size()) && (cvc_count < cvc_max_count);
|
||||
i++) {
|
||||
if (!cvcs[i]->is_enabled()) continue;
|
||||
cvc_count++;
|
||||
if ((cvcs[i])->is_enabled(f_cvc_gradient)) {
|
||||
(cvcs[i])->calc_gradients();
|
||||
// if requested, propagate (via chain rule) the gradients above
|
||||
// to the atoms used to define the roto-translation
|
||||
// This could be integrated in the CVC base class
|
||||
for (size_t ig = 0; ig < cvcs[i]->atom_groups.size(); ig++) {
|
||||
if (cvcs[i]->atom_groups[ig]->b_fit_gradients)
|
||||
cvcs[i]->atom_groups[ig]->calc_fit_gradients();
|
||||
|
@ -969,6 +915,7 @@ int colvar::calc_cvc_gradients(int first_cvc, size_t num_cvcs)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
cvm::decrease_depth();
|
||||
|
||||
if (cvm::debug())
|
||||
|
@ -1031,22 +978,22 @@ int colvar::collect_cvc_gradients()
|
|||
}
|
||||
|
||||
|
||||
int colvar::calc_cvc_sys_forces(int first_cvc, size_t num_cvcs)
|
||||
int colvar::calc_cvc_total_force(int first_cvc, size_t num_cvcs)
|
||||
{
|
||||
size_t const cvc_max_count = num_cvcs ? num_cvcs : num_active_cvcs();
|
||||
size_t i, cvc_count;
|
||||
|
||||
if (is_enabled(f_cv_system_force_calc)) {
|
||||
if (is_enabled(f_cv_total_force_calc)) {
|
||||
if (cvm::debug())
|
||||
cvm::log("Calculating system force of colvar \""+this->name+"\".\n");
|
||||
cvm::log("Calculating total force of colvar \""+this->name+"\".\n");
|
||||
|
||||
// if (!tasks[task_extended_lagrangian] && (cvm::step_relative() > 0)) {
|
||||
// Disabled check to allow for explicit system force calculation
|
||||
// Disabled check to allow for explicit total force calculation
|
||||
// even with extended Lagrangian
|
||||
|
||||
if (cvm::step_relative() > 0) {
|
||||
cvm::increase_depth();
|
||||
// get from the cvcs the system forces from the PREVIOUS step
|
||||
// get from the cvcs the total forces from the PREVIOUS step
|
||||
for (i = first_cvc, cvc_count = 0;
|
||||
(i < cvcs.size()) && (cvc_count < cvc_max_count);
|
||||
i++) {
|
||||
|
@ -1058,29 +1005,29 @@ int colvar::calc_cvc_sys_forces(int first_cvc, size_t num_cvcs)
|
|||
}
|
||||
|
||||
if (cvm::debug())
|
||||
cvm::log("Done calculating system force of colvar \""+this->name+"\".\n");
|
||||
cvm::log("Done calculating total force of colvar \""+this->name+"\".\n");
|
||||
}
|
||||
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
|
||||
int colvar::collect_cvc_sys_forces()
|
||||
int colvar::collect_cvc_total_forces()
|
||||
{
|
||||
if (is_enabled(f_cv_system_force_calc)) {
|
||||
if (is_enabled(f_cv_total_force_calc)) {
|
||||
ft.reset();
|
||||
|
||||
if (cvm::step_relative() > 0) {
|
||||
// get from the cvcs the system forces from the PREVIOUS step
|
||||
// get from the cvcs the total forces from the PREVIOUS step
|
||||
for (size_t i = 0; i < cvcs.size(); i++) {
|
||||
if (!cvcs[i]->is_enabled()) continue;
|
||||
// linear combination is assumed
|
||||
ft += (cvcs[i])->system_force() * (cvcs[i])->sup_coeff / active_cvc_square_norm;
|
||||
ft += (cvcs[i])->total_force() * (cvcs[i])->sup_coeff / active_cvc_square_norm;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_enabled(f_cv_hide_Jacobian)) {
|
||||
// add the Jacobian force to the system force, and don't apply any silent
|
||||
// add the Jacobian force to the total force, and don't apply any silent
|
||||
// correction internally: biases such as colvarbias_abf will handle it
|
||||
ft += fj;
|
||||
}
|
||||
|
@ -1152,10 +1099,8 @@ int colvar::calc_colvar_properties()
|
|||
// report the restraint center as "value"
|
||||
x_reported = xr;
|
||||
v_reported = vr;
|
||||
// the "system force" with the extended Lagrangian is just the
|
||||
// harmonic term acting on the extended coordinate
|
||||
// Note: this is the force for current timestep
|
||||
ft_reported = (-0.5 * ext_force_k) * this->dist2_lgrad(xr, x);
|
||||
// the "total force" with the extended Lagrangian is
|
||||
// calculated in update_forces_energy() below
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -1181,46 +1126,12 @@ cvm::real colvar::update_forces_energy()
|
|||
f += fb;
|
||||
|
||||
if (is_enabled(f_cv_Jacobian)) {
|
||||
// the instantaneous Jacobian force was not included in the reported system force;
|
||||
// the instantaneous Jacobian force was not included in the reported total force;
|
||||
// instead, it is subtracted from the applied force (silent Jacobian correction)
|
||||
if (is_enabled(f_cv_hide_Jacobian))
|
||||
f -= fj;
|
||||
}
|
||||
|
||||
if (is_enabled(f_cv_extended_Lagrangian)) {
|
||||
|
||||
cvm::real dt = cvm::dt();
|
||||
cvm::real f_ext;
|
||||
|
||||
// the total force is applied to the fictitious mass, while the
|
||||
// atoms only feel the harmonic force
|
||||
// fr: bias force on extended coordinate (without harmonic spring), for output in trajectory
|
||||
// f_ext: total force on extended coordinate (including harmonic spring)
|
||||
// f: - initially, external biasing force
|
||||
// - after this code block, colvar force to be applied to atomic coordinates, ie. spring force
|
||||
// (note: wall potential is added to f after this block)
|
||||
fr = f;
|
||||
f_ext = f + (-0.5 * ext_force_k) * this->dist2_lgrad(xr, x);
|
||||
f = (-0.5 * ext_force_k) * this->dist2_rgrad(xr, x);
|
||||
|
||||
// leapfrog: starting from x_i, f_i, v_(i-1/2)
|
||||
vr += (0.5 * dt) * f_ext / ext_mass;
|
||||
// Because of leapfrog, kinetic energy at time i is approximate
|
||||
kinetic_energy = 0.5 * ext_mass * vr * vr;
|
||||
potential_energy = 0.5 * ext_force_k * this->dist2(xr, x);
|
||||
// leap to v_(i+1/2)
|
||||
if (is_enabled(f_cv_Langevin)) {
|
||||
vr -= dt * ext_gamma * vr.real_value;
|
||||
vr += dt * ext_sigma * cvm::rand_gaussian() / ext_mass;
|
||||
}
|
||||
vr += (0.5 * dt) * f_ext / ext_mass;
|
||||
xr += dt * vr;
|
||||
xr.apply_constraints();
|
||||
if (this->b_periodic) this->wrap(xr);
|
||||
}
|
||||
|
||||
|
||||
// Adding wall potential to "true" colvar force, whether or not an extended coordinate is in use
|
||||
if (is_enabled(f_cv_lower_wall) || is_enabled(f_cv_upper_wall)) {
|
||||
|
||||
// Wall force
|
||||
|
@ -1257,6 +1168,41 @@ cvm::real colvar::update_forces_energy()
|
|||
}
|
||||
}
|
||||
|
||||
if (is_enabled(f_cv_extended_Lagrangian)) {
|
||||
|
||||
cvm::real dt = cvm::dt();
|
||||
cvm::real f_ext;
|
||||
|
||||
// the total force is applied to the fictitious mass, while the
|
||||
// atoms only feel the harmonic force
|
||||
// fr: bias force on extended variable (without harmonic spring), for output in trajectory
|
||||
// f_ext: total force on extended variable (including harmonic spring)
|
||||
// f: - initially, external biasing force
|
||||
// - after this code block, colvar force to be applied to atomic coordinates, ie. spring force
|
||||
fr = f;
|
||||
f_ext = f + (-0.5 * ext_force_k) * this->dist2_lgrad(xr, x);
|
||||
f = (-0.5 * ext_force_k) * this->dist2_rgrad(xr, x);
|
||||
|
||||
// The total force acting on the extended variable is f_ext
|
||||
// This will be used in the next timestep
|
||||
ft_reported = f_ext;
|
||||
|
||||
// leapfrog: starting from x_i, f_i, v_(i-1/2)
|
||||
vr += (0.5 * dt) * f_ext / ext_mass;
|
||||
// Because of leapfrog, kinetic energy at time i is approximate
|
||||
kinetic_energy = 0.5 * ext_mass * vr * vr;
|
||||
potential_energy = 0.5 * ext_force_k * this->dist2(xr, x);
|
||||
// leap to v_(i+1/2)
|
||||
if (is_enabled(f_cv_Langevin)) {
|
||||
vr -= dt * ext_gamma * vr.real_value;
|
||||
vr += dt * ext_sigma * cvm::rand_gaussian() / ext_mass;
|
||||
}
|
||||
vr += (0.5 * dt) * f_ext / ext_mass;
|
||||
xr += dt * vr;
|
||||
xr.apply_constraints();
|
||||
if (this->b_periodic) this->wrap(xr);
|
||||
}
|
||||
|
||||
f_accumulated += f;
|
||||
|
||||
if (is_enabled(f_cv_fdiff_velocity)) {
|
||||
|
@ -1377,7 +1323,7 @@ bool colvar::periodic_boundaries(colvarvalue const &lb, colvarvalue const &ub) c
|
|||
if ( (!is_enabled(f_cv_lower_boundary)) || (!is_enabled(f_cv_upper_boundary)) ) {
|
||||
cvm::log("Error: checking periodicity for collective variable \""+this->name+"\" "
|
||||
"requires lower and upper boundaries to be defined.\n");
|
||||
cvm::set_error_bit(INPUT_ERROR);
|
||||
cvm::set_error_bits(INPUT_ERROR);
|
||||
}
|
||||
|
||||
if (period > 0.0) {
|
||||
|
@ -1549,7 +1495,7 @@ std::istream & colvar::read_traj(std::istream &is)
|
|||
}
|
||||
}
|
||||
|
||||
if (is_enabled(f_cv_output_system_force)) {
|
||||
if (is_enabled(f_cv_output_total_force)) {
|
||||
is >> ft;
|
||||
ft_reported = ft;
|
||||
}
|
||||
|
@ -1634,8 +1580,8 @@ std::ostream & colvar::write_traj_label(std::ostream & os)
|
|||
<< cvm::wrap_string(this->name, this_cv_width-3);
|
||||
}
|
||||
|
||||
if (is_enabled(f_cv_output_system_force)) {
|
||||
os << " fs_"
|
||||
if (is_enabled(f_cv_output_total_force)) {
|
||||
os << " ft_"
|
||||
<< cvm::wrap_string(this->name, this_cv_width-3);
|
||||
}
|
||||
|
||||
|
@ -1687,7 +1633,7 @@ std::ostream & colvar::write_traj(std::ostream &os)
|
|||
}
|
||||
|
||||
|
||||
if (is_enabled(f_cv_output_system_force)) {
|
||||
if (is_enabled(f_cv_output_total_force)) {
|
||||
os << " "
|
||||
<< std::setprecision(cvm::cv_prec) << std::setw(cvm::cv_width)
|
||||
<< ft_reported;
|
||||
|
@ -2019,4 +1965,4 @@ void colvar::calc_runave()
|
|||
|
||||
// Static members
|
||||
|
||||
std::vector<cvm::deps::feature *> colvar::cv_features;
|
||||
std::vector<colvardeps::feature *> colvar::cv_features;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
/// \link colvarvalue \endlink type, you should also add its
|
||||
/// initialization line in the \link colvar \endlink constructor.
|
||||
|
||||
class colvar : public colvarparse, public cvm::deps {
|
||||
class colvar : public colvarparse, public colvardeps {
|
||||
|
||||
public:
|
||||
|
||||
|
@ -54,7 +54,7 @@ public:
|
|||
/// \brief Current velocity (previously set by calc() or by read_traj())
|
||||
colvarvalue const & velocity() const;
|
||||
|
||||
/// \brief Current system force (previously obtained from calc() or
|
||||
/// \brief Current total force (previously obtained from calc() or
|
||||
/// read_traj()). Note: this is calculated using the atomic forces
|
||||
/// from the last simulation step.
|
||||
///
|
||||
|
@ -62,7 +62,7 @@ public:
|
|||
/// acting on the collective variable is calculated summing those
|
||||
/// from all colvar components, the bias and walls forces are
|
||||
/// subtracted.
|
||||
colvarvalue const & system_force() const;
|
||||
colvarvalue const & total_force() const;
|
||||
|
||||
/// \brief Typical fluctuation amplitude for this collective
|
||||
/// variable (e.g. local width of a free energy basin)
|
||||
|
@ -160,7 +160,7 @@ protected:
|
|||
/// \brief Jacobian force, when Jacobian_force is enabled
|
||||
colvarvalue fj;
|
||||
|
||||
/// Cached reported system force
|
||||
/// Cached reported total force
|
||||
colvarvalue ft_reported;
|
||||
|
||||
public:
|
||||
|
@ -176,7 +176,7 @@ public:
|
|||
colvarvalue f;
|
||||
|
||||
/// \brief Total force, as derived from the atomic trajectory;
|
||||
/// should equal the total system force plus \link f \endlink
|
||||
/// should equal the system force plus \link f \endlink
|
||||
colvarvalue ft;
|
||||
|
||||
|
||||
|
@ -253,8 +253,8 @@ public:
|
|||
int calc_cvc_values(int first, size_t num_cvcs);
|
||||
/// \brief Same as \link colvar::calc_cvc_values \endlink but for gradients
|
||||
int calc_cvc_gradients(int first, size_t num_cvcs);
|
||||
/// \brief Same as \link colvar::calc_cvc_values \endlink but for system forces
|
||||
int calc_cvc_sys_forces(int first, size_t num_cvcs);
|
||||
/// \brief Same as \link colvar::calc_cvc_values \endlink but for total forces
|
||||
int calc_cvc_total_force(int first, size_t num_cvcs);
|
||||
/// \brief Same as \link colvar::calc_cvc_values \endlink but for Jacobian derivatives/forces
|
||||
int calc_cvc_Jacobians(int first, size_t num_cvcs);
|
||||
|
||||
|
@ -265,8 +265,8 @@ public:
|
|||
int collect_cvc_values();
|
||||
/// \brief Same as \link colvar::collect_cvc_values \endlink but for gradients
|
||||
int collect_cvc_gradients();
|
||||
/// \brief Same as \link colvar::collect_cvc_values \endlink but for system forces
|
||||
int collect_cvc_sys_forces();
|
||||
/// \brief Same as \link colvar::collect_cvc_values \endlink but for total forces
|
||||
int collect_cvc_total_forces();
|
||||
/// \brief Same as \link colvar::collect_cvc_values \endlink but for Jacobian derivatives/forces
|
||||
int collect_cvc_Jacobians();
|
||||
/// \brief Calculate the quantities associated to the colvar (but not to the CVCs)
|
||||
|
@ -555,7 +555,7 @@ inline colvarvalue const & colvar::velocity() const
|
|||
}
|
||||
|
||||
|
||||
inline colvarvalue const & colvar::system_force() const
|
||||
inline colvarvalue const & colvar::total_force() const
|
||||
{
|
||||
return ft_reported;
|
||||
}
|
||||
|
|
|
@ -297,7 +297,7 @@ int cvm::atom_group::parse(std::string const &conf)
|
|||
std::string numbers_conf = "";
|
||||
size_t pos = 0;
|
||||
while (key_lookup(group_conf, "atomNumbers", numbers_conf, pos)) {
|
||||
cvm::combine_errors(parse_error, add_atom_numbers(numbers_conf));
|
||||
parse_error |= add_atom_numbers(numbers_conf);
|
||||
numbers_conf = "";
|
||||
}
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ int cvm::atom_group::parse(std::string const &conf)
|
|||
std::string index_group_name;
|
||||
if (get_keyval(group_conf, "indexGroup", index_group_name)) {
|
||||
// use an index group from the index file read globally
|
||||
cvm::combine_errors(parse_error, add_index_group(index_group_name));
|
||||
parse_error |= add_index_group(index_group_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -315,7 +315,7 @@ int cvm::atom_group::parse(std::string const &conf)
|
|||
size_t pos = 0;
|
||||
while (key_lookup(group_conf, "atomNumbersRange",
|
||||
range_conf, pos)) {
|
||||
cvm::combine_errors(parse_error, add_atom_numbers_range(range_conf));
|
||||
parse_error |= add_atom_numbers_range(range_conf);
|
||||
range_conf = "";
|
||||
}
|
||||
}
|
||||
|
@ -342,8 +342,8 @@ int cvm::atom_group::parse(std::string const &conf)
|
|||
cvm::error("Error: more instances of \"atomNameResidueRange\" than "
|
||||
"values of \"psfSegID\".\n", INPUT_ERROR);
|
||||
} else {
|
||||
cvm::combine_errors(parse_error, add_atom_name_residue_range(psf_segids.size() ?
|
||||
*psii : std::string(""), range_conf));
|
||||
parse_error |= add_atom_name_residue_range(psf_segids.size() ?
|
||||
*psii : std::string(""), range_conf);
|
||||
if (psf_segids.size()) psii++;
|
||||
}
|
||||
range_conf = "";
|
||||
|
@ -407,7 +407,7 @@ int cvm::atom_group::parse(std::string const &conf)
|
|||
index = (cvm::proxy)->init_atom_group(atoms_ids);
|
||||
}
|
||||
|
||||
cvm::combine_errors(parse_error, parse_fitting_options(group_conf));
|
||||
parse_error |= parse_fitting_options(group_conf);
|
||||
|
||||
// TODO move this to colvarparse object
|
||||
check_keywords(group_conf, key.c_str());
|
||||
|
@ -870,21 +870,21 @@ void cvm::atom_group::read_velocities()
|
|||
|
||||
|
||||
// TODO make this a calc function
|
||||
void cvm::atom_group::read_system_forces()
|
||||
void cvm::atom_group::read_total_forces()
|
||||
{
|
||||
if (b_dummy) return;
|
||||
|
||||
if (b_rotate) {
|
||||
|
||||
for (cvm::atom_iter ai = this->begin(); ai != this->end(); ai++) {
|
||||
ai->read_system_force();
|
||||
ai->system_force = rot.rotate(ai->system_force);
|
||||
ai->read_total_force();
|
||||
ai->total_force = rot.rotate(ai->total_force);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
for (cvm::atom_iter ai = this->begin(); ai != this->end(); ai++) {
|
||||
ai->read_system_force();
|
||||
ai->read_total_force();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1070,15 +1070,15 @@ std::vector<cvm::rvector> cvm::atom_group::velocities() const
|
|||
return v;
|
||||
}
|
||||
|
||||
std::vector<cvm::rvector> cvm::atom_group::system_forces() const
|
||||
std::vector<cvm::rvector> cvm::atom_group::total_forces() const
|
||||
{
|
||||
if (b_dummy) {
|
||||
cvm::error("Error: system forces are not available "
|
||||
cvm::error("Error: total forces are not available "
|
||||
"from a dummy atom group.\n", INPUT_ERROR);
|
||||
}
|
||||
|
||||
if (is_enabled(f_ag_scalable)) {
|
||||
cvm::error("Error: atomic system forces are not available "
|
||||
cvm::error("Error: atomic total forces are not available "
|
||||
"from a scalable atom group.\n", INPUT_ERROR);
|
||||
}
|
||||
|
||||
|
@ -1086,27 +1086,27 @@ std::vector<cvm::rvector> cvm::atom_group::system_forces() const
|
|||
cvm::atom_const_iter ai = this->begin();
|
||||
std::vector<cvm::atom_pos>::iterator fi = f.begin();
|
||||
for ( ; ai != this->end(); ++fi, ++ai) {
|
||||
*fi = ai->system_force;
|
||||
*fi = ai->total_force;
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
// TODO make this an accessor
|
||||
cvm::rvector cvm::atom_group::system_force() const
|
||||
cvm::rvector cvm::atom_group::total_force() const
|
||||
{
|
||||
if (b_dummy) {
|
||||
cvm::error("Error: total system forces are not available "
|
||||
cvm::error("Error: total total forces are not available "
|
||||
"from a dummy atom group.\n", INPUT_ERROR);
|
||||
}
|
||||
|
||||
if (is_enabled(f_ag_scalable)) {
|
||||
return (cvm::proxy)->get_atom_group_system_force(index);
|
||||
return (cvm::proxy)->get_atom_group_total_force(index);
|
||||
}
|
||||
|
||||
cvm::rvector f(0.0);
|
||||
for (cvm::atom_const_iter ai = this->begin(); ai != this->end(); ai++) {
|
||||
f += ai->system_force;
|
||||
f += ai->total_force;
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
@ -1192,6 +1192,6 @@ void cvm::atom_group::apply_force(cvm::rvector const &force)
|
|||
|
||||
// Static members
|
||||
|
||||
std::vector<cvm::deps::feature *> cvm::atom_group::ag_features;
|
||||
std::vector<colvardeps::feature *> cvm::atom_group::ag_features;
|
||||
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
|
||||
/// \brief System force at the previous step (copied from the
|
||||
/// program, can be modified if necessary)
|
||||
cvm::rvector system_force;
|
||||
cvm::rvector total_force;
|
||||
|
||||
/// \brief Gradient of a scalar collective variable with respect
|
||||
/// to this atom
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
inline void reset_data()
|
||||
{
|
||||
pos = cvm::atom_pos(0.0);
|
||||
vel = grad = system_force = cvm::rvector(0.0);
|
||||
vel = grad = total_force = cvm::rvector(0.0);
|
||||
}
|
||||
|
||||
/// Get the latest value of the mass
|
||||
|
@ -113,10 +113,10 @@ public:
|
|||
vel = (cvm::proxy)->get_atom_velocity(index);
|
||||
}
|
||||
|
||||
/// Get the system force
|
||||
inline void read_system_force()
|
||||
/// Get the total force
|
||||
inline void read_total_force()
|
||||
{
|
||||
system_force = (cvm::proxy)->get_atom_system_force(index);
|
||||
total_force = (cvm::proxy)->get_atom_total_force(index);
|
||||
}
|
||||
|
||||
/// \brief Apply a force to the atom
|
||||
|
@ -139,7 +139,7 @@ public:
|
|||
/// \brief Group of \link atom \endlink objects, mostly used by a
|
||||
/// \link cvc \endlink object to gather all atomic data
|
||||
class colvarmodule::atom_group
|
||||
: public colvarparse, public cvm::deps
|
||||
: public colvarparse, public colvardeps
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -336,10 +336,10 @@ public:
|
|||
/// rotation applied to the coordinates will be used
|
||||
void read_velocities();
|
||||
|
||||
/// \brief Get the current system_forces; this must be called always
|
||||
/// \brief Get the current total_forces; this must be called always
|
||||
/// *after* read_positions(); if b_rotate is defined, the same
|
||||
/// rotation applied to the coordinates will be used
|
||||
void read_system_forces();
|
||||
void read_total_forces();
|
||||
|
||||
/// Call reset_data() for each atom
|
||||
inline void reset_atoms_data()
|
||||
|
@ -410,11 +410,11 @@ public:
|
|||
return dip;
|
||||
}
|
||||
|
||||
/// \brief Return a copy of the system forces
|
||||
std::vector<cvm::rvector> system_forces() const;
|
||||
/// \brief Return a copy of the total forces
|
||||
std::vector<cvm::rvector> total_forces() const;
|
||||
|
||||
/// \brief Return a copy of the aggregated total force on the group
|
||||
cvm::rvector system_force() const;
|
||||
cvm::rvector total_force() const;
|
||||
|
||||
|
||||
/// \brief Shorthand: save the specified gradient on each atom,
|
||||
|
|
|
@ -203,7 +203,7 @@ cvm::real colvarbias::energy_difference(std::string const &conf)
|
|||
}
|
||||
|
||||
|
||||
// So far, these are only implemented in colvarsbias_abf
|
||||
// So far, these are only implemented in colvarbias_abf
|
||||
int colvarbias::bin_num()
|
||||
{
|
||||
cvm::error("Error: bin_num() not implemented.\n");
|
||||
|
@ -246,4 +246,4 @@ std::ostream & colvarbias::write_traj(std::ostream &os)
|
|||
|
||||
// Static members
|
||||
|
||||
std::vector<cvm::deps::feature *> colvarbias::cvb_features;
|
||||
std::vector<colvardeps::feature *> colvarbias::cvb_features;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
|
||||
/// \brief Collective variable bias, base class
|
||||
class colvarbias : public colvarparse, public cvm::deps {
|
||||
class colvarbias : public colvarparse, public colvardeps {
|
||||
public:
|
||||
|
||||
/// Name of this bias
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
|
||||
colvarbias_abf::colvarbias_abf(char const *key)
|
||||
: colvarbias(key),
|
||||
force(NULL),
|
||||
system_force(NULL),
|
||||
gradients(NULL),
|
||||
samples(NULL),
|
||||
z_gradients(NULL),
|
||||
z_samples(NULL),
|
||||
czar_gradients(NULL),
|
||||
last_gradients(NULL),
|
||||
last_samples(NULL)
|
||||
{
|
||||
|
@ -30,10 +31,8 @@ int colvarbias_abf::init(std::string const &conf)
|
|||
|
||||
// ************* parsing general ABF options ***********************
|
||||
|
||||
get_keyval(conf, "applyBias", apply_bias, true);
|
||||
if (apply_bias) {
|
||||
enable(f_cvb_apply_force);
|
||||
} else {
|
||||
get_keyval_feature((colvarparse *)this, conf, "applyBias", f_cvb_apply_force, true);
|
||||
if (!is_enabled(f_cvb_apply_force)){
|
||||
cvm::log("WARNING: ABF biases will *not* be applied!\n");
|
||||
}
|
||||
|
||||
|
@ -80,11 +79,8 @@ int colvarbias_abf::init(std::string const &conf)
|
|||
}
|
||||
|
||||
if (update_bias) {
|
||||
// Request calculation of system force (which also checks for availability)
|
||||
if(enable(f_cvb_get_system_force)) return cvm::get_error();
|
||||
}
|
||||
if (apply_bias) {
|
||||
if(enable(f_cvb_apply_force)) return cvm::get_error();
|
||||
// Request calculation of total force (which also checks for availability)
|
||||
if(enable(f_cvb_get_total_force)) return cvm::get_error();
|
||||
}
|
||||
|
||||
bool b_extended = false;
|
||||
|
@ -111,7 +107,7 @@ int colvarbias_abf::init(std::string const &conf)
|
|||
if (max_force.size() != colvars.size()) {
|
||||
cvm::error("Error: Number of parameters to maxForce does not match number of colvars.");
|
||||
}
|
||||
for (size_t i=0; i<colvars.size(); i++) {
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
if (max_force[i] < 0.0) {
|
||||
cvm::error("Error: maxForce should be non-negative.");
|
||||
}
|
||||
|
@ -123,7 +119,7 @@ int colvarbias_abf::init(std::string const &conf)
|
|||
|
||||
bin.assign(colvars.size(), 0);
|
||||
force_bin.assign(colvars.size(), 0);
|
||||
force = new cvm::real [colvars.size()];
|
||||
system_force = new cvm::real [colvars.size()];
|
||||
|
||||
// Construct empty grids based on the colvars
|
||||
if (cvm::debug()) {
|
||||
|
@ -144,6 +140,7 @@ int colvarbias_abf::init(std::string const &conf)
|
|||
z_gradients->request_actual_value();
|
||||
z_gradients->samples = z_samples;
|
||||
z_samples->has_parent_data = true;
|
||||
czar_gradients = new colvar_grid_gradient(colvars);
|
||||
}
|
||||
|
||||
// For shared ABF, we store a second set of grids.
|
||||
|
@ -178,6 +175,21 @@ colvarbias_abf::~colvarbias_abf()
|
|||
gradients = NULL;
|
||||
}
|
||||
|
||||
if (z_samples) {
|
||||
delete z_samples;
|
||||
z_samples = NULL;
|
||||
}
|
||||
|
||||
if (z_gradients) {
|
||||
delete z_gradients;
|
||||
z_gradients = NULL;
|
||||
}
|
||||
|
||||
if (czar_gradients) {
|
||||
delete czar_gradients;
|
||||
czar_gradients = NULL;
|
||||
}
|
||||
|
||||
// shared ABF
|
||||
// We used to only do this if "shared" was defined,
|
||||
// but now we can call shared externally
|
||||
|
@ -191,9 +203,9 @@ colvarbias_abf::~colvarbias_abf()
|
|||
last_gradients = NULL;
|
||||
}
|
||||
|
||||
if (force) {
|
||||
delete [] force;
|
||||
force = NULL;
|
||||
if (system_force) {
|
||||
delete [] system_force;
|
||||
system_force = NULL;
|
||||
}
|
||||
|
||||
if (cvm::n_abf_biases > 0)
|
||||
|
@ -214,31 +226,44 @@ int colvarbias_abf::update()
|
|||
// initialization stuff (file operations relying on n_abf_biases
|
||||
// compute current value of colvars
|
||||
|
||||
for (size_t i=0; i<colvars.size(); i++) {
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
bin[i] = samples->current_bin_scalar(i);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
for (size_t i=0; i<colvars.size(); i++) {
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
bin[i] = samples->current_bin_scalar(i);
|
||||
}
|
||||
|
||||
if ( update_bias && samples->index_ok(force_bin) ) {
|
||||
// Only if requested and within bounds of the grid...
|
||||
|
||||
for (size_t i=0; i<colvars.size(); i++) { // get forces(lagging by 1 timestep) from colvars
|
||||
force[i] = colvars[i]->system_force();
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
// get total forces (lagging by 1 timestep) from colvars
|
||||
// and subtract previous ABF force
|
||||
system_force[i] = colvars[i]->total_force().real_value
|
||||
- colvar_forces[i].real_value;
|
||||
// if (cvm::debug())
|
||||
// cvm::log("ABF System force calc: cv " + cvm::to_str(i) +
|
||||
// " fs " + cvm::to_str(system_force[i]) +
|
||||
// " = ft " + cvm::to_str(colvars[i]->total_force().real_value) +
|
||||
// " - fa " + cvm::to_str(colvar_forces[i].real_value));
|
||||
}
|
||||
gradients->acc_force(force_bin, force);
|
||||
gradients->acc_force(force_bin, system_force);
|
||||
}
|
||||
if ( z_gradients && update_bias ) {
|
||||
for (size_t i=0; i<colvars.size(); i++) {
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
z_bin[i] = z_samples->current_bin_scalar(i);
|
||||
}
|
||||
if ( z_samples->index_ok(z_bin) ) {
|
||||
// Set increment flag to 0 to only increment
|
||||
z_gradients->acc_force(z_bin, force);
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
// If we are outside the range of xi, the force has not been obtained above
|
||||
// the function is just an accessor, so cheap to call again anyway
|
||||
system_force[i] = colvars[i]->total_force().real_value
|
||||
- colvar_forces[i].real_value;
|
||||
}
|
||||
z_gradients->acc_force(z_bin, system_force);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -247,12 +272,12 @@ int colvarbias_abf::update()
|
|||
force_bin = bin;
|
||||
|
||||
// Reset biasing forces from previous timestep
|
||||
for (size_t i=0; i<colvars.size(); i++) {
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
colvar_forces[i].reset();
|
||||
}
|
||||
|
||||
// Compute and apply the new bias, if applicable
|
||||
if ( apply_bias && samples->index_ok(bin) ) {
|
||||
if (is_enabled(f_cvb_apply_force) && samples->index_ok(bin)) {
|
||||
|
||||
size_t count = samples->value(bin);
|
||||
cvm::real fact = 1.0;
|
||||
|
@ -271,13 +296,13 @@ int colvarbias_abf::update()
|
|||
// in other words: boundary condition is that the biasing potential is periodic
|
||||
colvar_forces[0].real_value = fact * (grad[0] / cvm::real(count) - gradients->average());
|
||||
} else {
|
||||
for (size_t i=0; i<colvars.size(); i++) {
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
// subtracting the mean force (opposite of the FE gradient) means adding the gradient
|
||||
colvar_forces[i].real_value = fact * grad[i] / cvm::real(count);
|
||||
}
|
||||
}
|
||||
if (cap_force) {
|
||||
for (size_t i=0; i<colvars.size(); i++) {
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
if ( colvar_forces[i].real_value * colvar_forces[i].real_value > max_force[i] * max_force[i] ) {
|
||||
colvar_forces[i].real_value = (colvar_forces[i].real_value > 0 ? max_force[i] : -1.0 * max_force[i]);
|
||||
}
|
||||
|
@ -404,14 +429,10 @@ void colvarbias_abf::write_gradients_samples(const std::string &prefix, bool app
|
|||
{
|
||||
std::string samples_out_name = prefix + ".count";
|
||||
std::string gradients_out_name = prefix + ".grad";
|
||||
std::string z_gradients_out_name = prefix + ".zgrad";
|
||||
std::string z_samples_out_name = prefix + ".zcount";
|
||||
std::ios::openmode mode = (append ? std::ios::app : std::ios::out);
|
||||
|
||||
cvm::ofstream samples_os;
|
||||
cvm::ofstream gradients_os;
|
||||
cvm::ofstream z_samples_os;
|
||||
cvm::ofstream z_gradients_os;
|
||||
|
||||
if (!append) cvm::backup_file(samples_out_name.c_str());
|
||||
samples_os.open(samples_out_name.c_str(), mode);
|
||||
|
@ -442,6 +463,14 @@ void colvarbias_abf::write_gradients_samples(const std::string &prefix, bool app
|
|||
}
|
||||
|
||||
if (z_gradients) {
|
||||
// Write eABF-related quantities
|
||||
std::string z_samples_out_name = prefix + ".zcount";
|
||||
std::string z_gradients_out_name = prefix + ".zgrad";
|
||||
std::string czar_gradients_out_name = prefix + ".czar";
|
||||
cvm::ofstream z_samples_os;
|
||||
cvm::ofstream z_gradients_os;
|
||||
cvm::ofstream czar_gradients_os;
|
||||
|
||||
if (!append) cvm::backup_file(z_samples_out_name.c_str());
|
||||
z_samples_os.open(z_samples_out_name.c_str(), mode);
|
||||
if (!z_samples_os.is_open()) {
|
||||
|
@ -458,6 +487,24 @@ void colvarbias_abf::write_gradients_samples(const std::string &prefix, bool app
|
|||
z_gradients->write_multicol(z_gradients_os);
|
||||
z_gradients_os.close();
|
||||
|
||||
// Calculate CZAR estimator of gradients
|
||||
for (std::vector<int> ix = czar_gradients->new_index();
|
||||
czar_gradients->index_ok(ix); czar_gradients->incr(ix)) {
|
||||
for (size_t n = 0; n < czar_gradients->multiplicity(); n++) {
|
||||
czar_gradients->set_value(ix, z_gradients->value_output(ix, n)
|
||||
- cvm::temperature() * cvm::boltzmann() * z_samples->log_gradient_finite_diff(ix, n),
|
||||
n);
|
||||
}
|
||||
}
|
||||
|
||||
if (!append) cvm::backup_file(czar_gradients_out_name.c_str());
|
||||
czar_gradients_os.open(czar_gradients_out_name.c_str(), mode);
|
||||
if (!czar_gradients_os.is_open()) {
|
||||
cvm::error("Error opening CZAR gradient file " + czar_gradients_out_name + " for writing");
|
||||
}
|
||||
czar_gradients->write_multicol(czar_gradients_os);
|
||||
czar_gradients_os.close();
|
||||
|
||||
if (colvars.size() == 1) {
|
||||
std::string z_pmf_out_name = prefix + ".zpmf";
|
||||
if (!append) cvm::backup_file(z_pmf_out_name.c_str());
|
||||
|
@ -468,6 +515,16 @@ void colvarbias_abf::write_gradients_samples(const std::string &prefix, bool app
|
|||
z_gradients->write_1D_integral(z_pmf_os);
|
||||
z_pmf_os << std::endl;
|
||||
z_pmf_os.close();
|
||||
|
||||
std::string czar_pmf_out_name = prefix + ".czarpmf";
|
||||
if (!append) cvm::backup_file(czar_pmf_out_name.c_str());
|
||||
cvm::ofstream czar_pmf_os;
|
||||
// Do numerical integration and output a PMF
|
||||
czar_pmf_os.open(czar_pmf_out_name.c_str(), mode);
|
||||
if (!czar_pmf_os.is_open()) cvm::error("Error opening CZAR pmf file " + czar_pmf_out_name + " for writing");
|
||||
czar_gradients->write_1D_integral(czar_pmf_os);
|
||||
czar_pmf_os << std::endl;
|
||||
czar_pmf_os.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -545,24 +602,27 @@ std::ostream & colvarbias_abf::write_restart(std::ostream& os)
|
|||
{
|
||||
|
||||
std::ios::fmtflags flags(os.flags());
|
||||
os.setf(std::ios::fmtflags(0), std::ios::floatfield); // default floating-point format
|
||||
|
||||
os << "abf {\n"
|
||||
<< " configuration {\n"
|
||||
<< " name " << this->name << "\n";
|
||||
os << " }\n";
|
||||
|
||||
os << "samples\n";
|
||||
os.setf(std::ios::fmtflags(0), std::ios::floatfield); // default floating-point format
|
||||
os << "\nsamples\n";
|
||||
samples->write_raw(os, 8);
|
||||
os.flags(flags);
|
||||
|
||||
os << "\ngradient\n";
|
||||
gradients->write_raw(os);
|
||||
gradients->write_raw(os, 8);
|
||||
|
||||
if (z_gradients) {
|
||||
os << "z_samples\n";
|
||||
os.setf(std::ios::fmtflags(0), std::ios::floatfield); // default floating-point format
|
||||
os << "\nz_samples\n";
|
||||
z_samples->write_raw(os, 8);
|
||||
os.flags(flags);
|
||||
os << "\nz_gradient\n";
|
||||
z_gradients->write_raw(os);
|
||||
z_gradients->write_raw(os, 8);
|
||||
}
|
||||
|
||||
os << "}\n\n";
|
||||
|
@ -638,7 +698,7 @@ std::istream & colvarbias_abf::read_restart(std::istream& is)
|
|||
}
|
||||
|
||||
if (z_gradients) {
|
||||
if ( !(is >> key) || !(key == "z_samples")) {
|
||||
if ( !(is >> key) || !(key == "z_samples")) {
|
||||
cvm::log("Error: in reading restart configuration for ABF bias \""+
|
||||
this->name+"\" at position "+
|
||||
cvm::to_str(is.tellg())+" in stream.\n");
|
||||
|
|
|
@ -27,12 +27,11 @@ public:
|
|||
private:
|
||||
|
||||
/// Filename prefix for human-readable gradient/sample count output
|
||||
std::string output_prefix;
|
||||
std::string output_prefix;
|
||||
|
||||
/// Base filename(s) for reading previous gradient data (replaces data from restart file)
|
||||
std::vector<std::string> input_prefix;
|
||||
|
||||
bool apply_bias;
|
||||
bool update_bias;
|
||||
bool hide_Jacobian;
|
||||
size_t full_samples;
|
||||
|
@ -50,7 +49,7 @@ private:
|
|||
// Internal data and methods
|
||||
|
||||
std::vector<int> bin, force_bin, z_bin;
|
||||
gradient_t force;
|
||||
gradient_t system_force, applied_force;
|
||||
|
||||
/// n-dim grid of free energy gradients
|
||||
colvar_grid_gradient *gradients;
|
||||
|
@ -60,6 +59,8 @@ private:
|
|||
colvar_grid_gradient *z_gradients;
|
||||
/// n-dim grid of number of samples on "real" coordinate for eABF z-based estimator
|
||||
colvar_grid_count *z_samples;
|
||||
/// n-dim grid contining CZAR estimator of "real" free energy gradients
|
||||
colvar_grid_gradient *czar_gradients;
|
||||
|
||||
// shared ABF
|
||||
bool shared_on;
|
||||
|
|
|
@ -75,13 +75,12 @@ int colvarbias_histogram::init(std::string const &conf)
|
|||
}
|
||||
|
||||
grid = new colvar_grid_scalar();
|
||||
grid->init_from_colvars(colvars);
|
||||
|
||||
{
|
||||
std::string grid_conf;
|
||||
if (key_lookup(conf, "grid", grid_conf)) {
|
||||
grid->parse_params(grid_conf);
|
||||
} else {
|
||||
grid->init_from_colvars(colvars);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +104,7 @@ int colvarbias_histogram::update()
|
|||
{
|
||||
int error_code = COLVARS_OK;
|
||||
// update base class
|
||||
cvm::combine_errors(error_code, colvarbias::update());
|
||||
error_code |= colvarbias::update();
|
||||
|
||||
if (cvm::debug()) {
|
||||
cvm::log("Updating histogram bias " + this->name);
|
||||
|
@ -158,7 +157,7 @@ int colvarbias_histogram::update()
|
|||
write_output_files();
|
||||
}
|
||||
|
||||
cvm::combine_errors(error_code, cvm::get_error());
|
||||
error_code |= cvm::get_error();
|
||||
return error_code;
|
||||
}
|
||||
|
||||
|
@ -256,6 +255,9 @@ std::istream & colvarbias_histogram::read_restart(std::istream& is)
|
|||
|
||||
std::ostream & colvarbias_histogram::write_restart(std::ostream& os)
|
||||
{
|
||||
std::ios::fmtflags flags(os.flags());
|
||||
os.setf(std::ios::fmtflags(0), std::ios::floatfield);
|
||||
|
||||
os << "histogram {\n"
|
||||
<< " configuration {\n"
|
||||
<< " name " << this->name << "\n";
|
||||
|
@ -266,5 +268,6 @@ std::ostream & colvarbias_histogram::write_restart(std::ostream& os)
|
|||
|
||||
os << "}\n\n";
|
||||
|
||||
os.flags(flags);
|
||||
return os;
|
||||
}
|
||||
|
|
|
@ -43,11 +43,8 @@ colvar::cvc::cvc(std::string const &conf)
|
|||
|
||||
// All cvcs implement this
|
||||
provide(f_cvc_debug_gradient);
|
||||
{
|
||||
bool b_debug_gradient;
|
||||
get_keyval(conf, "debugGradients", b_debug_gradient, false, parse_silent);
|
||||
if (b_debug_gradient) enable(f_cvc_debug_gradient);
|
||||
}
|
||||
get_keyval_feature((colvarparse *)this, conf, "debugGradients",
|
||||
f_cvc_debug_gradient, false, parse_silent);
|
||||
|
||||
// Attempt scalable calculations when in parallel? (By default yes, if available)
|
||||
get_keyval(conf, "scalable", b_try_scalable, true);
|
||||
|
@ -107,7 +104,7 @@ int colvar::cvc::setup()
|
|||
description = "cvc " + name;
|
||||
|
||||
for (i = 0; i < atom_groups.size(); i++) {
|
||||
add_child((cvm::deps *) atom_groups[i]);
|
||||
add_child((colvardeps *) atom_groups[i]);
|
||||
}
|
||||
|
||||
return COLVARS_OK;
|
||||
|
@ -276,4 +273,4 @@ void colvar::cvc::debug_gradients(cvm::atom_group *group)
|
|||
|
||||
// Static members
|
||||
|
||||
std::vector<cvm::deps::feature *> colvar::cvc::cvc_features;
|
||||
std::vector<colvardeps::feature *> colvar::cvc::cvc_features;
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
/// call to e.g. apply_force().
|
||||
|
||||
class colvar::cvc
|
||||
: public colvarparse, public cvm::deps
|
||||
: public colvarparse, public colvardeps
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -153,8 +153,8 @@ public:
|
|||
// /// \brief Return const pointer to the previously calculated value
|
||||
// virtual const colvarvalue *p_value() const;
|
||||
|
||||
/// \brief Return the previously calculated system force
|
||||
virtual colvarvalue const & system_force() const;
|
||||
/// \brief Return the previously calculated total force
|
||||
virtual colvarvalue const & total_force() const;
|
||||
|
||||
/// \brief Return the previously calculated divergence of the
|
||||
/// inverse atomic gradients
|
||||
|
@ -232,7 +232,7 @@ protected:
|
|||
/// \brief Value at the previous step
|
||||
colvarvalue x_old;
|
||||
|
||||
/// \brief Calculated system force (\b Note: this is calculated from
|
||||
/// \brief Calculated total force (\b Note: this is calculated from
|
||||
/// the total atomic forces read from the program, subtracting fromt
|
||||
/// the "internal" forces of the system the "external" forces from
|
||||
/// the colvar biases)
|
||||
|
@ -256,7 +256,7 @@ inline colvarvalue const & colvar::cvc::value() const
|
|||
// return &x;
|
||||
// }
|
||||
|
||||
inline colvarvalue const & colvar::cvc::system_force() const
|
||||
inline colvarvalue const & colvar::cvc::total_force() const
|
||||
{
|
||||
return ft;
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ protected:
|
|||
cvm::rvector dist_v;
|
||||
/// Use absolute positions, ignoring PBCs when present
|
||||
bool b_no_PBC;
|
||||
/// Compute system force on first site only to avoid unwanted
|
||||
/// Compute total force on first site only to avoid unwanted
|
||||
/// coupling to other colvars (see e.g. Ciccotti et al., 2005)
|
||||
bool b_1site_force;
|
||||
public:
|
||||
|
@ -388,7 +388,7 @@ protected:
|
|||
cvm::atom_group *ref2;
|
||||
/// Use absolute positions, ignoring PBCs when present
|
||||
bool b_no_PBC;
|
||||
/// Compute system force on one site only to avoid unwanted
|
||||
/// Compute total force on one site only to avoid unwanted
|
||||
/// coupling to other colvars (see e.g. Ciccotti et al., 2005)
|
||||
bool b_1site_force;
|
||||
/// Vector on which the distance vector is projected
|
||||
|
@ -637,7 +637,7 @@ protected:
|
|||
/// Derivatives wrt group centers of mass
|
||||
cvm::rvector dxdr1, dxdr3;
|
||||
|
||||
/// Compute system force on first site only to avoid unwanted
|
||||
/// Compute total force on first site only to avoid unwanted
|
||||
/// coupling to other colvars (see e.g. Ciccotti et al., 2005)
|
||||
/// (or to allow dummy atoms)
|
||||
bool b_1site_force;
|
||||
|
@ -683,7 +683,7 @@ protected:
|
|||
/// Derivatives wrt group centers of mass
|
||||
cvm::rvector dxdr1, dxdr3;
|
||||
|
||||
/// Compute system force on first site only to avoid unwanted
|
||||
/// Compute total force on first site only to avoid unwanted
|
||||
/// coupling to other colvars (see e.g. Ciccotti et al., 2005)
|
||||
/// (or to allow dummy atoms)
|
||||
bool b_1site_force;
|
||||
|
@ -724,7 +724,7 @@ protected:
|
|||
/// Inter site vectors
|
||||
cvm::rvector r12, r23, r34;
|
||||
|
||||
/// \brief Compute system force on first site only to avoid unwanted
|
||||
/// \brief Compute total force on first site only to avoid unwanted
|
||||
/// coupling to other colvars (see e.g. Ciccotti et al., 2005)
|
||||
bool b_1site_force;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ colvar::angle::angle(std::string const &conf)
|
|||
group2 = parse_group(conf, "group2");
|
||||
group3 = parse_group(conf, "group3");
|
||||
if (get_keyval(conf, "oneSiteSystemForce", b_1site_force, false)) {
|
||||
cvm::log("Computing system force on group 1 only");
|
||||
cvm::log("Computing total force on group 1 only");
|
||||
}
|
||||
x.type(colvarvalue::type_scalar);
|
||||
}
|
||||
|
@ -95,15 +95,15 @@ void colvar::angle::calc_force_invgrads()
|
|||
// when propagating changes in the angle)
|
||||
|
||||
if (b_1site_force) {
|
||||
group1->read_system_forces();
|
||||
group1->read_total_forces();
|
||||
cvm::real norm_fact = 1.0 / dxdr1.norm2();
|
||||
ft.real_value = norm_fact * dxdr1 * group1->system_force();
|
||||
ft.real_value = norm_fact * dxdr1 * group1->total_force();
|
||||
} else {
|
||||
group1->read_system_forces();
|
||||
group3->read_system_forces();
|
||||
group1->read_total_forces();
|
||||
group3->read_total_forces();
|
||||
cvm::real norm_fact = 1.0 / (dxdr1.norm2() + dxdr3.norm2());
|
||||
ft.real_value = norm_fact * ( dxdr1 * group1->system_force()
|
||||
+ dxdr3 * group3->system_force());
|
||||
ft.real_value = norm_fact * ( dxdr1 * group1->total_force()
|
||||
+ dxdr3 * group3->total_force());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ colvar::dipole_angle::dipole_angle(std::string const &conf)
|
|||
group3 = parse_group(conf, "group3");
|
||||
|
||||
if (get_keyval(conf, "oneSiteSystemForce", b_1site_force, false)) {
|
||||
cvm::log("Computing system force on group 1 only");
|
||||
cvm::log("Computing total force on group 1 only");
|
||||
}
|
||||
x.type(colvarvalue::type_scalar);
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ colvar::dihedral::dihedral(std::string const &conf)
|
|||
provide(f_cvc_com_based);
|
||||
|
||||
if (get_keyval(conf, "oneSiteSystemForce", b_1site_force, false)) {
|
||||
cvm::log("Computing system force on group 1 only");
|
||||
cvm::log("Computing total force on group 1 only");
|
||||
}
|
||||
group1 = parse_group(conf, "group1");
|
||||
group2 = parse_group(conf, "group2");
|
||||
|
@ -421,15 +421,15 @@ void colvar::dihedral::calc_force_invgrads()
|
|||
cvm::real const fact1 = d12 * std::sqrt(1.0 - dot1 * dot1);
|
||||
cvm::real const fact4 = d34 * std::sqrt(1.0 - dot4 * dot4);
|
||||
|
||||
group1->read_system_forces();
|
||||
group1->read_total_forces();
|
||||
if ( b_1site_force ) {
|
||||
// This is only measuring the force on group 1
|
||||
ft.real_value = PI/180.0 * fact1 * (cross1 * group1->system_force());
|
||||
ft.real_value = PI/180.0 * fact1 * (cross1 * group1->total_force());
|
||||
} else {
|
||||
// Default case: use groups 1 and 4
|
||||
group4->read_system_forces();
|
||||
ft.real_value = PI/180.0 * 0.5 * (fact1 * (cross1 * group1->system_force())
|
||||
+ fact4 * (cross4 * group4->system_force()));
|
||||
group4->read_total_forces();
|
||||
ft.real_value = PI/180.0 * 0.5 * (fact1 * (cross1 * group1->total_force())
|
||||
+ fact4 * (cross4 * group4->total_force()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ colvar::distance::distance(std::string const &conf)
|
|||
cvm::log("Computing distance using absolute positions (not minimal-image)");
|
||||
}
|
||||
if (get_keyval(conf, "oneSiteSystemForce", b_1site_force, false)) {
|
||||
cvm::log("Computing system force on group 1 only");
|
||||
cvm::log("Computing total force on group 1 only");
|
||||
}
|
||||
group1 = parse_group(conf, "group1");
|
||||
group2 = parse_group(conf, "group2");
|
||||
|
@ -66,12 +66,12 @@ void colvar::distance::calc_gradients()
|
|||
|
||||
void colvar::distance::calc_force_invgrads()
|
||||
{
|
||||
group1->read_system_forces();
|
||||
group1->read_total_forces();
|
||||
if ( b_1site_force ) {
|
||||
ft.real_value = -1.0 * (group1->system_force() * dist_v.unit());
|
||||
ft.real_value = -1.0 * (group1->total_force() * dist_v.unit());
|
||||
} else {
|
||||
group2->read_system_forces();
|
||||
ft.real_value = 0.5 * ((group2->system_force() - group1->system_force()) * dist_v.unit());
|
||||
group2->read_total_forces();
|
||||
ft.real_value = 0.5 * ((group2->total_force() - group1->total_force()) * dist_v.unit());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ colvar::distance_z::distance_z(std::string const &conf)
|
|||
cvm::log("Computing distance using absolute positions (not minimal-image)");
|
||||
}
|
||||
if (get_keyval(conf, "oneSiteSystemForce", b_1site_force, false)) {
|
||||
cvm::log("Computing system force on group \"main\" only");
|
||||
cvm::log("Computing total force on group \"main\" only");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -249,13 +249,13 @@ void colvar::distance_z::calc_gradients()
|
|||
|
||||
void colvar::distance_z::calc_force_invgrads()
|
||||
{
|
||||
main->read_system_forces();
|
||||
main->read_total_forces();
|
||||
|
||||
if (fixed_axis && !b_1site_force) {
|
||||
ref1->read_system_forces();
|
||||
ft.real_value = 0.5 * ((main->system_force() - ref1->system_force()) * axis);
|
||||
ref1->read_total_forces();
|
||||
ft.real_value = 0.5 * ((main->total_force() - ref1->total_force()) * axis);
|
||||
} else {
|
||||
ft.real_value = main->system_force() * axis;
|
||||
ft.real_value = main->total_force() * axis;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -349,13 +349,13 @@ void colvar::distance_xy::calc_gradients()
|
|||
|
||||
void colvar::distance_xy::calc_force_invgrads()
|
||||
{
|
||||
main->read_system_forces();
|
||||
main->read_total_forces();
|
||||
|
||||
if (fixed_axis && !b_1site_force) {
|
||||
ref1->read_system_forces();
|
||||
ft.real_value = 0.5 / x.real_value * ((main->system_force() - ref1->system_force()) * dist_v_ortho);
|
||||
ref1->read_total_forces();
|
||||
ft.real_value = 0.5 / x.real_value * ((main->total_force() - ref1->total_force()) * dist_v_ortho);
|
||||
} else {
|
||||
ft.real_value = 1.0 / x.real_value * main->system_force() * dist_v_ortho;
|
||||
ft.real_value = 1.0 / x.real_value * main->total_force() * dist_v_ortho;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -655,13 +655,13 @@ void colvar::gyration::calc_gradients()
|
|||
|
||||
void colvar::gyration::calc_force_invgrads()
|
||||
{
|
||||
atoms->read_system_forces();
|
||||
atoms->read_total_forces();
|
||||
|
||||
cvm::real const dxdr = 1.0/x.real_value;
|
||||
ft.real_value = 0.0;
|
||||
|
||||
for (cvm::atom_iter ai = atoms->begin(); ai != atoms->end(); ai++) {
|
||||
ft.real_value += dxdr * ai->pos * ai->system_force;
|
||||
ft.real_value += dxdr * ai->pos * ai->total_force;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -903,13 +903,13 @@ void colvar::rmsd::apply_force(colvarvalue const &force)
|
|||
|
||||
void colvar::rmsd::calc_force_invgrads()
|
||||
{
|
||||
atoms->read_system_forces();
|
||||
atoms->read_total_forces();
|
||||
ft.real_value = 0.0;
|
||||
|
||||
// Note: gradient square norm is 1/N_atoms
|
||||
|
||||
for (size_t ia = 0; ia < atoms->size(); ia++) {
|
||||
ft.real_value += (*atoms)[ia].grad * (*atoms)[ia].system_force;
|
||||
ft.real_value += (*atoms)[ia].grad * (*atoms)[ia].total_force;
|
||||
}
|
||||
ft.real_value *= atoms->size();
|
||||
}
|
||||
|
@ -1191,12 +1191,12 @@ void colvar::eigenvector::apply_force(colvarvalue const &force)
|
|||
|
||||
void colvar::eigenvector::calc_force_invgrads()
|
||||
{
|
||||
atoms->read_system_forces();
|
||||
atoms->read_total_forces();
|
||||
ft.real_value = 0.0;
|
||||
|
||||
for (size_t ia = 0; ia < atoms->size(); ia++) {
|
||||
ft.real_value += eigenvec_invnorm2 * (*atoms)[ia].grad *
|
||||
(*atoms)[ia].system_force;
|
||||
(*atoms)[ia].total_force;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#include "colvarmodule.h"
|
||||
#include "colvardeps.h"
|
||||
|
||||
|
||||
cvm::deps::~deps() {
|
||||
colvardeps::~colvardeps() {
|
||||
size_t i;
|
||||
|
||||
for (i=0; i<feature_states.size(); i++) {
|
||||
|
@ -25,12 +24,24 @@ cvm::deps::~deps() {
|
|||
}
|
||||
|
||||
|
||||
void cvm::deps::provide(int feature_id) {
|
||||
void colvardeps::provide(int feature_id) {
|
||||
feature_states[feature_id]->available = true;
|
||||
}
|
||||
|
||||
|
||||
int cvm::deps::enable(int feature_id,
|
||||
bool colvardeps::get_keyval_feature(colvarparse *cvp,
|
||||
std::string const &conf, char const *key,
|
||||
int feature_id, bool const &def_value,
|
||||
colvarparse::Parse_Mode const parse_mode)
|
||||
{
|
||||
bool value;
|
||||
bool const found = cvp->get_keyval(conf, key, value, def_value, parse_mode);
|
||||
if (value) enable(feature_id);
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
int colvardeps::enable(int feature_id,
|
||||
bool dry_run /* default: false */,
|
||||
// dry_run: fail silently, do not enable if available
|
||||
// flag is passed recursively to deps of this feature
|
||||
|
@ -48,7 +59,7 @@ int cvm::deps::enable(int feature_id,
|
|||
if (cvm::debug()) {
|
||||
cvm::log("DEPS: " + description +
|
||||
(dry_run ? " testing " : " requiring ") +
|
||||
"\"" + f->description);
|
||||
"\"" + f->description +"\"");
|
||||
}
|
||||
|
||||
if (fs->enabled) {
|
||||
|
@ -140,11 +151,7 @@ int cvm::deps::enable(int feature_id,
|
|||
// 4) solve deps in children
|
||||
for (i=0; i<f->requires_children.size(); i++) {
|
||||
int g = f->requires_children[i];
|
||||
if (cvm::debug())
|
||||
cvm::log("requires children " + features()[g]->description);
|
||||
// cvm::log("children " + cvm::to_str(g));
|
||||
for (j=0; j<children.size(); j++) {
|
||||
// cvm::log("child " + children[j]->description);
|
||||
cvm::increase_depth();
|
||||
res = children[j]->enable(g, dry_run, false);
|
||||
cvm::decrease_depth();
|
||||
|
@ -193,7 +200,7 @@ int cvm::deps::enable(int feature_id,
|
|||
features()[f]->requires_alt.back()[1] = h; \
|
||||
features()[f]->requires_alt.back()[2] = i
|
||||
|
||||
void cvm::deps::init_cvb_requires() {
|
||||
void colvardeps::init_cvb_requires() {
|
||||
int i;
|
||||
if (features().size() == 0) {
|
||||
for (i = 0; i < f_cvb_ntot; i++) {
|
||||
|
@ -207,8 +214,8 @@ void cvm::deps::init_cvb_requires() {
|
|||
f_description(f_cvb_apply_force, "apply force");
|
||||
f_req_children(f_cvb_apply_force, f_cv_gradient);
|
||||
|
||||
f_description(f_cvb_get_system_force, "obtain system force");
|
||||
f_req_children(f_cvb_get_system_force, f_cv_system_force);
|
||||
f_description(f_cvb_get_total_force, "obtain total force");
|
||||
f_req_children(f_cvb_get_total_force, f_cv_total_force);
|
||||
|
||||
f_description(f_cvb_history_dependent, "history-dependent");
|
||||
|
||||
|
@ -225,7 +232,7 @@ void cvm::deps::init_cvb_requires() {
|
|||
}
|
||||
|
||||
|
||||
void cvm::deps::init_cv_requires() {
|
||||
void colvardeps::init_cv_requires() {
|
||||
size_t i;
|
||||
if (features().size() == 0) {
|
||||
for (i = 0; i < f_cv_ntot; i++) {
|
||||
|
@ -247,15 +254,15 @@ void cvm::deps::init_cv_requires() {
|
|||
f_description(f_cv_fdiff_velocity, "fdiff_velocity");
|
||||
|
||||
// System force: either trivial (spring force); through extended Lagrangian, or calculated explicitly
|
||||
f_description(f_cv_system_force, "system force");
|
||||
f_req_alt2(f_cv_system_force, f_cv_extended_Lagrangian, f_cv_system_force_calc);
|
||||
f_description(f_cv_total_force, "total force");
|
||||
f_req_alt2(f_cv_total_force, f_cv_extended_Lagrangian, f_cv_total_force_calc);
|
||||
|
||||
// Deps for explicit system force calculation
|
||||
f_description(f_cv_system_force_calc, "system force calculation");
|
||||
f_req_self(f_cv_system_force_calc, f_cv_scalar);
|
||||
f_req_self(f_cv_system_force_calc, f_cv_linear);
|
||||
f_req_children(f_cv_system_force_calc, f_cvc_inv_gradient);
|
||||
f_req_self(f_cv_system_force_calc, f_cv_Jacobian);
|
||||
// Deps for explicit total force calculation
|
||||
f_description(f_cv_total_force_calc, "total force calculation");
|
||||
f_req_self(f_cv_total_force_calc, f_cv_scalar);
|
||||
f_req_self(f_cv_total_force_calc, f_cv_linear);
|
||||
f_req_children(f_cv_total_force_calc, f_cvc_inv_gradient);
|
||||
f_req_self(f_cv_total_force_calc, f_cv_Jacobian);
|
||||
|
||||
f_description(f_cv_Jacobian, "Jacobian derivative");
|
||||
f_req_self(f_cv_Jacobian, f_cv_scalar);
|
||||
|
@ -283,8 +290,8 @@ void cvm::deps::init_cv_requires() {
|
|||
|
||||
f_description(f_cv_output_applied_force, "output applied force");
|
||||
|
||||
f_description(f_cv_output_system_force, "output system force");
|
||||
f_req_self(f_cv_output_system_force, f_cv_system_force);
|
||||
f_description(f_cv_output_total_force, "output total force");
|
||||
f_req_self(f_cv_output_total_force, f_cv_total_force);
|
||||
|
||||
f_description(f_cv_lower_boundary, "lower boundary");
|
||||
f_req_self(f_cv_lower_boundary, f_cv_scalar);
|
||||
|
@ -342,11 +349,11 @@ void cvm::deps::init_cv_requires() {
|
|||
}
|
||||
|
||||
|
||||
void cvm::deps::init_cvc_requires() {
|
||||
void colvardeps::init_cvc_requires() {
|
||||
size_t i;
|
||||
// Initialize static array once and for all
|
||||
if (features().size() == 0) {
|
||||
for (i = 0; i < cvm::deps::f_cvc_ntot; i++) {
|
||||
for (i = 0; i < colvardeps::f_cvc_ntot; i++) {
|
||||
features().push_back(new feature);
|
||||
}
|
||||
|
||||
|
@ -364,7 +371,7 @@ void cvm::deps::init_cvc_requires() {
|
|||
f_description(f_cvc_debug_gradient, "debug gradient");
|
||||
f_req_self(f_cvc_debug_gradient, f_cvc_gradient);
|
||||
|
||||
f_description(f_cvc_Jacobian, "Jacobian");
|
||||
f_description(f_cvc_Jacobian, "Jacobian derivative");
|
||||
f_req_self(f_cvc_Jacobian, f_cvc_inv_gradient);
|
||||
|
||||
f_description(f_cvc_com_based, "depends on group centers of mass");
|
||||
|
@ -384,7 +391,7 @@ void cvm::deps::init_cvc_requires() {
|
|||
// Initialize feature_states for each instance
|
||||
// default as unavailable, not enabled
|
||||
feature_states.reserve(f_cvc_ntot);
|
||||
for (i = 0; i < cvm::deps::f_cvc_ntot; i++) {
|
||||
for (i = 0; i < colvardeps::f_cvc_ntot; i++) {
|
||||
feature_states.push_back(new feature_state(false, false));
|
||||
}
|
||||
|
||||
|
@ -392,12 +399,12 @@ void cvm::deps::init_cvc_requires() {
|
|||
// Each cvc specifies what other features are available
|
||||
feature_states[f_cvc_active]->available = true;
|
||||
feature_states[f_cvc_gradient]->available = true;
|
||||
feature_states[f_cvc_scalable_com]->available = (proxy->scalable_group_coms() == COLVARS_OK);
|
||||
feature_states[f_cvc_scalable_com]->available = (cvm::proxy->scalable_group_coms() == COLVARS_OK);
|
||||
feature_states[f_cvc_scalable]->available = feature_states[f_cvc_scalable_com]->available;
|
||||
}
|
||||
|
||||
|
||||
void cvm::deps::init_ag_requires() {
|
||||
void colvardeps::init_ag_requires() {
|
||||
size_t i;
|
||||
// Initialize static array once and for all
|
||||
if (features().size() == 0) {
|
||||
|
@ -428,18 +435,18 @@ void cvm::deps::init_ag_requires() {
|
|||
// Initialize feature_states for each instance
|
||||
// default as unavailable, not enabled
|
||||
feature_states.reserve(f_ag_ntot);
|
||||
for (i = 0; i < cvm::deps::f_ag_ntot; i++) {
|
||||
for (i = 0; i < colvardeps::f_ag_ntot; i++) {
|
||||
feature_states.push_back(new feature_state(false, false));
|
||||
}
|
||||
|
||||
// Features that are implemented (or not) by all atom groups
|
||||
feature_states[f_ag_active]->available = true;
|
||||
feature_states[f_ag_scalable_com]->available = (proxy->scalable_group_coms() == COLVARS_OK);
|
||||
feature_states[f_ag_scalable_com]->available = (cvm::proxy->scalable_group_coms() == COLVARS_OK);
|
||||
feature_states[f_ag_scalable]->available = feature_states[f_ag_scalable_com]->available;
|
||||
}
|
||||
|
||||
|
||||
void cvm::deps::print_state() {
|
||||
void colvardeps::print_state() {
|
||||
size_t i;
|
||||
cvm::log("Enabled features of " + description);
|
||||
for (i = 0; i < feature_states.size(); i++) {
|
||||
|
@ -456,13 +463,13 @@ void cvm::deps::print_state() {
|
|||
|
||||
|
||||
|
||||
void cvm::deps::add_child(deps *child) {
|
||||
void colvardeps::add_child(colvardeps *child) {
|
||||
children.push_back(child);
|
||||
child->parents.push_back((deps *)this);
|
||||
child->parents.push_back((colvardeps *)this);
|
||||
}
|
||||
|
||||
|
||||
void cvm::deps::remove_child(deps *child) {
|
||||
void colvardeps::remove_child(colvardeps *child) {
|
||||
int i;
|
||||
bool found = false;
|
||||
|
||||
|
@ -490,7 +497,7 @@ void cvm::deps::remove_child(deps *child) {
|
|||
}
|
||||
|
||||
|
||||
void cvm::deps::remove_all_children() {
|
||||
void colvardeps::remove_all_children() {
|
||||
size_t i;
|
||||
int j;
|
||||
bool found;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
// -*- c++ -*-
|
||||
|
||||
#include "colvarmodule.h"
|
||||
|
||||
#ifndef COLVARDEPS_H
|
||||
#define COLVARDEPS_H
|
||||
|
||||
#include "colvarmodule.h"
|
||||
#include "colvarparse.h"
|
||||
|
||||
/// Parent class for a member object of a bias, cv or cvc etc. containing dependencies
|
||||
/// (features) and handling dependency resolution
|
||||
|
||||
|
@ -16,11 +17,11 @@
|
|||
|
||||
// It seems important to have available default to false (for safety) and enabled to false (for efficiency)
|
||||
|
||||
class cvm::deps {
|
||||
class colvardeps {
|
||||
public:
|
||||
|
||||
deps() {}
|
||||
virtual ~deps();
|
||||
colvardeps() {}
|
||||
virtual ~colvardeps();
|
||||
|
||||
// Subclasses should initialize the following members:
|
||||
|
||||
|
@ -84,9 +85,9 @@ public:
|
|||
// implement this as virtual to allow overriding
|
||||
virtual std::vector<feature *>&features() = 0;
|
||||
|
||||
void add_child(deps *child);
|
||||
void add_child(colvardeps *child);
|
||||
|
||||
void remove_child(deps *child);
|
||||
void remove_child(colvardeps *child);
|
||||
|
||||
/// Used before deleting an object, if not handled by that object's destructor
|
||||
/// (useful for cvcs because their children are member objects)
|
||||
|
@ -98,11 +99,11 @@ private:
|
|||
// pointers to objects this object depends on
|
||||
// list should be maintained by any code that modifies the object
|
||||
// this could be secured by making lists of colvars / cvcs / atom groups private and modified through accessor functions
|
||||
std::vector<deps *> children;
|
||||
std::vector<colvardeps *> children;
|
||||
|
||||
// pointers to objects that depend on this object
|
||||
// the size of this array is in effect a reference counter
|
||||
std::vector<deps *> parents;
|
||||
std::vector<colvardeps *> parents;
|
||||
|
||||
public:
|
||||
// disabling a feature f:
|
||||
|
@ -115,7 +116,7 @@ public:
|
|||
//
|
||||
// }
|
||||
|
||||
// std::vector<deps *> parents; // Needed to trigger a refresh if capabilities of this object change
|
||||
// std::vector<colvardeps *> parents; // Needed to trigger a refresh if capabilities of this object change
|
||||
|
||||
// End of members to be initialized by subclasses
|
||||
|
||||
|
@ -133,6 +134,12 @@ public:
|
|||
|
||||
void provide(int feature_id); // set the feature's flag to available in local object
|
||||
|
||||
/// Parse a keyword and enable a feature accordingly
|
||||
bool get_keyval_feature(colvarparse *cvp,
|
||||
std::string const &conf, char const *key,
|
||||
int feature_id, bool const &def_value,
|
||||
colvarparse::Parse_Mode const parse_mode = colvarparse::parse_normal);
|
||||
|
||||
int enable(int f, bool dry_run = false, bool toplevel = true); // enable a feature and recursively solve its dependencies
|
||||
// dry_run is set to true to recursively test if a feature is available, without enabling it
|
||||
// int disable(int f);
|
||||
|
@ -148,7 +155,7 @@ public:
|
|||
/// \brief Bias is active
|
||||
f_cvb_active,
|
||||
f_cvb_apply_force, // will apply forces
|
||||
f_cvb_get_system_force, // requires system forces
|
||||
f_cvb_get_total_force, // requires total forces
|
||||
f_cvb_history_dependent, // depends on simulation history
|
||||
f_cvb_ntot
|
||||
};
|
||||
|
@ -164,14 +171,14 @@ public:
|
|||
f_cv_collect_gradient,
|
||||
/// \brief Calculate the velocity with finite differences
|
||||
f_cv_fdiff_velocity,
|
||||
/// \brief The system force is calculated, projecting the atomic
|
||||
/// \brief The total force is calculated, projecting the atomic
|
||||
/// forces on the inverse gradient
|
||||
f_cv_system_force,
|
||||
/// \brief Calculate system force from atomic forces
|
||||
f_cv_system_force_calc,
|
||||
f_cv_total_force,
|
||||
/// \brief Calculate total force from atomic forces
|
||||
f_cv_total_force_calc,
|
||||
/// \brief Estimate Jacobian derivative
|
||||
f_cv_Jacobian,
|
||||
/// \brief Do not report the Jacobian force as part of the system force
|
||||
/// \brief Do not report the Jacobian force as part of the total force
|
||||
/// instead, apply a correction internally to cancel it
|
||||
f_cv_hide_Jacobian,
|
||||
/// \brief The variable has a harmonic restraint around a moving
|
||||
|
@ -189,8 +196,8 @@ public:
|
|||
f_cv_output_velocity,
|
||||
/// \brief Output the applied force to the trajectory file
|
||||
f_cv_output_applied_force,
|
||||
/// \brief Output the system force to the trajectory file
|
||||
f_cv_output_system_force,
|
||||
/// \brief Output the total force to the trajectory file
|
||||
f_cv_output_total_force,
|
||||
/// \brief A lower boundary is defined
|
||||
f_cv_lower_boundary,
|
||||
/// \brief An upper boundary is defined
|
||||
|
|
|
@ -35,13 +35,13 @@ colvar_grid_scalar::colvar_grid_scalar(colvar_grid_scalar const &g)
|
|||
}
|
||||
|
||||
colvar_grid_scalar::colvar_grid_scalar(std::vector<int> const &nx_i)
|
||||
: colvar_grid<cvm::real>(nx_i, 0.0, 1), samples(NULL)
|
||||
: colvar_grid<cvm::real>(nx_i, 0.0, 1), samples(NULL), grad(NULL)
|
||||
{
|
||||
grad = new cvm::real[nd];
|
||||
}
|
||||
|
||||
colvar_grid_scalar::colvar_grid_scalar(std::vector<colvar *> &colvars, bool margin)
|
||||
: colvar_grid<cvm::real>(colvars, 0.0, 1, margin), samples(NULL)
|
||||
: colvar_grid<cvm::real>(colvars, 0.0, 1, margin), samples(NULL), grad(NULL)
|
||||
{
|
||||
grad = new cvm::real[nd];
|
||||
}
|
||||
|
|
|
@ -1160,6 +1160,50 @@ public:
|
|||
}
|
||||
has_data = true;
|
||||
}
|
||||
|
||||
/// \brief Return the log-gradient from finite differences
|
||||
/// on the *same* grid for dimension n
|
||||
inline const cvm::real log_gradient_finite_diff( const std::vector<int> &ix0,
|
||||
int n = 0)
|
||||
{
|
||||
cvm::real A0, A1;
|
||||
std::vector<int> ix;
|
||||
|
||||
// factor for mesh width, 2.0 for central finite difference
|
||||
// but only 1.0 on edges for non-PBC coordinates
|
||||
cvm::real factor;
|
||||
|
||||
if (periodic[n]) {
|
||||
factor = 2.;
|
||||
ix = ix0;
|
||||
ix[n]--; wrap(ix);
|
||||
A0 = data[address(ix)];
|
||||
ix = ix0;
|
||||
ix[n]++; wrap(ix);
|
||||
A1 = data[address(ix)];
|
||||
} else {
|
||||
factor = 0.;
|
||||
ix = ix0;
|
||||
if (ix[n] > 0) { // not left edge
|
||||
ix[n]--;
|
||||
factor += 1.;
|
||||
}
|
||||
A0 = data[address(ix)];
|
||||
ix = ix0;
|
||||
if (ix[n]+1 < nx[n]) { // not right edge
|
||||
ix[n]++;
|
||||
factor += 1.;
|
||||
}
|
||||
A1 = data[address(ix)];
|
||||
}
|
||||
if (A0 == 0 || A1 == 0) {
|
||||
// can't handle empty bins
|
||||
return 0.;
|
||||
} else {
|
||||
return (std::log((cvm::real)A1) - std::log((cvm::real)A0))
|
||||
/ (widths[n] * factor);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -83,7 +83,9 @@ int colvarmodule::read_config_file(char const *config_filename)
|
|||
std::string conf = "";
|
||||
std::string line;
|
||||
while (colvarparse::getline_nocomments(config_s, line)) {
|
||||
conf.append(line+"\n");
|
||||
// Delete lines that contain only white space after removing comments
|
||||
if (line.find_first_not_of(colvarparse::white_space) != std::string::npos)
|
||||
conf.append(line+"\n");
|
||||
}
|
||||
config_s.close();
|
||||
|
||||
|
@ -101,7 +103,9 @@ int colvarmodule::read_config_string(std::string const &config_str)
|
|||
std::string conf = "";
|
||||
std::string line;
|
||||
while (colvarparse::getline_nocomments(config_s, line)) {
|
||||
conf.append(line+"\n");
|
||||
// Delete lines that contain only white space after removing comments
|
||||
if (line.find_first_not_of(colvarparse::white_space) != std::string::npos)
|
||||
conf.append(line+"\n");
|
||||
}
|
||||
return parse_config(conf);
|
||||
}
|
||||
|
@ -302,7 +306,7 @@ int colvarmodule::parse_biases(std::string const &conf)
|
|||
size_t i;
|
||||
|
||||
for (i = 0; i < biases.size(); i++) {
|
||||
biases[i]->enable(cvm::deps::f_cvb_active);
|
||||
biases[i]->enable(colvardeps::f_cvb_active);
|
||||
if (cvm::debug())
|
||||
biases[i]->print_state();
|
||||
}
|
||||
|
@ -310,8 +314,8 @@ int colvarmodule::parse_biases(std::string const &conf)
|
|||
size_t n_hist_dep_biases = 0;
|
||||
std::vector<std::string> hist_dep_biases_names;
|
||||
for (i = 0; i < biases.size(); i++) {
|
||||
if (biases[i]->is_enabled(cvm::deps::f_cvb_apply_force) &&
|
||||
biases[i]->is_enabled(cvm::deps::f_cvb_history_dependent)) {
|
||||
if (biases[i]->is_enabled(colvardeps::f_cvb_apply_force) &&
|
||||
biases[i]->is_enabled(colvardeps::f_cvb_history_dependent)) {
|
||||
n_hist_dep_biases++;
|
||||
hist_dep_biases_names.push_back(biases[i]->name);
|
||||
}
|
||||
|
@ -340,8 +344,8 @@ int colvarmodule::parse_biases(std::string const &conf)
|
|||
int colvarmodule::catch_input_errors(int result)
|
||||
{
|
||||
if (result != COLVARS_OK || get_error()) {
|
||||
set_error_bit(result);
|
||||
set_error_bit(INPUT_ERROR);
|
||||
set_error_bits(result);
|
||||
set_error_bits(INPUT_ERROR);
|
||||
parse->init();
|
||||
return get_error();
|
||||
}
|
||||
|
@ -493,27 +497,27 @@ int colvarmodule::calc()
|
|||
cvm::to_str(cvm::step_absolute())+"\n");
|
||||
}
|
||||
|
||||
combine_errors(error_code, calc_colvars());
|
||||
error_code |= calc_colvars();
|
||||
// set biasing forces to zero before biases are calculated and summed over
|
||||
for (std::vector<colvar *>::iterator cvi = colvars.begin();
|
||||
cvi != colvars.end(); cvi++) {
|
||||
(*cvi)->reset_bias_force();
|
||||
}
|
||||
combine_errors(error_code, calc_biases());
|
||||
combine_errors(error_code, update_colvar_forces());
|
||||
error_code |= calc_biases();
|
||||
error_code |= update_colvar_forces();
|
||||
|
||||
if (cvm::b_analysis) {
|
||||
combine_errors(error_code, analyze());
|
||||
error_code |= analyze();
|
||||
}
|
||||
|
||||
// write trajectory files, if needed
|
||||
if (cv_traj_freq && cv_traj_name.size()) {
|
||||
combine_errors(error_code, write_traj_files());
|
||||
error_code |= write_traj_files();
|
||||
}
|
||||
|
||||
// write restart files, if needed
|
||||
if (restart_out_freq && restart_out_name.size()) {
|
||||
combine_errors(error_code, write_restart_files());
|
||||
error_code |= write_restart_files();
|
||||
}
|
||||
|
||||
return error_code;
|
||||
|
@ -531,7 +535,7 @@ int colvarmodule::calc_colvars()
|
|||
|
||||
// Determine which colvars are active at this time step
|
||||
for (cvi = colvars.begin(); cvi != colvars.end(); cvi++) {
|
||||
(*cvi)->feature_states[cvm::deps::f_cv_active]->enabled = (step_absolute() % (*cvi)->get_time_step_factor() == 0);
|
||||
(*cvi)->feature_states[colvardeps::f_cv_active]->enabled = (step_absolute() % (*cvi)->get_time_step_factor() == 0);
|
||||
}
|
||||
|
||||
// if SMP support is available, split up the work
|
||||
|
@ -551,7 +555,7 @@ int colvarmodule::calc_colvars()
|
|||
for (cvi = colvars.begin(); cvi != colvars.end(); cvi++) {
|
||||
|
||||
if (!(*cvi)->is_enabled()) continue;
|
||||
combine_errors(error_code, (*cvi)->update_cvc_flags());
|
||||
error_code |= (*cvi)->update_cvc_flags();
|
||||
|
||||
size_t num_items = (*cvi)->num_active_cvcs();
|
||||
colvars_smp.reserve(colvars_smp.size() + num_items);
|
||||
|
@ -566,12 +570,12 @@ int colvarmodule::calc_colvars()
|
|||
cvm::decrease_depth();
|
||||
|
||||
// calculate colvar components in parallel
|
||||
combine_errors(error_code, proxy->smp_colvars_loop());
|
||||
error_code |= proxy->smp_colvars_loop();
|
||||
|
||||
cvm::increase_depth();
|
||||
for (cvi = colvars.begin(); cvi != colvars.end(); cvi++) {
|
||||
if (!(*cvi)->is_enabled()) continue;
|
||||
combine_errors(error_code, (*cvi)->collect_cvc_data());
|
||||
error_code |= (*cvi)->collect_cvc_data();
|
||||
}
|
||||
cvm::decrease_depth();
|
||||
|
||||
|
@ -581,7 +585,7 @@ int colvarmodule::calc_colvars()
|
|||
cvm::increase_depth();
|
||||
for (cvi = colvars.begin(); cvi != colvars.end(); cvi++) {
|
||||
if (!(*cvi)->is_enabled()) continue;
|
||||
combine_errors(error_code, (*cvi)->calc());
|
||||
error_code |= (*cvi)->calc();
|
||||
if (cvm::get_error()) {
|
||||
return COLVARS_ERROR;
|
||||
}
|
||||
|
@ -589,7 +593,7 @@ int colvarmodule::calc_colvars()
|
|||
cvm::decrease_depth();
|
||||
}
|
||||
|
||||
combine_errors(error_code, cvm::get_error());
|
||||
error_code |= cvm::get_error();
|
||||
return error_code;
|
||||
}
|
||||
|
||||
|
@ -609,21 +613,21 @@ int colvarmodule::calc_biases()
|
|||
|
||||
if (use_scripted_forces && !scripting_after_biases) {
|
||||
// calculate biases and scripted forces in parallel
|
||||
combine_errors(error_code, proxy->smp_biases_script_loop());
|
||||
error_code |= proxy->smp_biases_script_loop();
|
||||
} else {
|
||||
// calculate biases in parallel
|
||||
combine_errors(error_code, proxy->smp_biases_loop());
|
||||
error_code |= proxy->smp_biases_loop();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (use_scripted_forces && !scripting_after_biases) {
|
||||
combine_errors(error_code, calc_scripted_forces());
|
||||
error_code |= calc_scripted_forces();
|
||||
}
|
||||
|
||||
cvm::increase_depth();
|
||||
for (bi = biases.begin(); bi != biases.end(); bi++) {
|
||||
combine_errors(error_code, (*bi)->update());
|
||||
error_code |= (*bi)->update();
|
||||
if (cvm::get_error()) {
|
||||
return COLVARS_ERROR;
|
||||
}
|
||||
|
@ -661,7 +665,7 @@ int colvarmodule::update_colvar_forces()
|
|||
cvm::decrease_depth();
|
||||
|
||||
if (use_scripted_forces && scripting_after_biases) {
|
||||
combine_errors(error_code, calc_scripted_forces());
|
||||
error_code |= calc_scripted_forces();
|
||||
}
|
||||
|
||||
cvm::real total_colvar_energy = 0.0;
|
||||
|
@ -689,7 +693,7 @@ int colvarmodule::update_colvar_forces()
|
|||
cvm::log("Communicating forces from the colvars to the atoms.\n");
|
||||
cvm::increase_depth();
|
||||
for (cvi = colvars.begin(); cvi != colvars.end(); cvi++) {
|
||||
if ((*cvi)->is_enabled(cvm::deps::f_cv_gradient)) {
|
||||
if ((*cvi)->is_enabled(colvardeps::f_cv_gradient)) {
|
||||
if (!(*cvi)->is_enabled()) continue;
|
||||
(*cvi)->communicate_forces();
|
||||
if (cvm::get_error()) {
|
||||
|
@ -913,17 +917,17 @@ int colvarmodule::setup_output()
|
|||
std::string(""));
|
||||
|
||||
if (cv_traj_freq && cv_traj_name.size()) {
|
||||
combine_errors(error_code, open_traj_file(cv_traj_name));
|
||||
error_code |= open_traj_file(cv_traj_name);
|
||||
}
|
||||
|
||||
for (std::vector<colvarbias *>::iterator bi = biases.begin();
|
||||
bi != biases.end();
|
||||
bi++) {
|
||||
combine_errors(error_code, (*bi)->setup_output());
|
||||
error_code |= (*bi)->setup_output();
|
||||
}
|
||||
|
||||
if (error_code != COLVARS_OK || cvm::get_error()) {
|
||||
set_error_bit(FILE_ERROR);
|
||||
set_error_bits(FILE_ERROR);
|
||||
}
|
||||
|
||||
return (cvm::get_error() ? COLVARS_ERROR : COLVARS_OK);
|
||||
|
@ -1259,29 +1263,20 @@ size_t & cvm::depth()
|
|||
}
|
||||
|
||||
|
||||
void colvarmodule::set_error_bit(int code)
|
||||
void colvarmodule::set_error_bits(int code)
|
||||
{
|
||||
if (code > 0) {
|
||||
cvm::fatal_error("Error: set_error_bit() received positive error code.\n");
|
||||
if (code < 0) {
|
||||
cvm::fatal_error("Error: set_error_bits() received negative error code.\n");
|
||||
return;
|
||||
}
|
||||
proxy->smp_lock();
|
||||
errorCode = -1 * ((-1 * errorCode) | (-1 * code) | (-1 * COLVARS_ERROR));
|
||||
errorCode |= code | COLVARS_ERROR;
|
||||
proxy->smp_unlock();
|
||||
}
|
||||
|
||||
bool colvarmodule::get_error_bit(int code)
|
||||
{
|
||||
return bool((-1 * errorCode) & (-1 * code));
|
||||
}
|
||||
|
||||
void colvarmodule::combine_errors(int &target, int const code)
|
||||
{
|
||||
if (code > 0 || target > 0) {
|
||||
cvm::fatal_error("Error: combine_errors() received positive error code.\n");
|
||||
return;
|
||||
}
|
||||
target = -1 * ((-1 * target) | (-1 * code));
|
||||
return bool(errorCode & code);
|
||||
}
|
||||
|
||||
void colvarmodule::clear_error()
|
||||
|
@ -1294,7 +1289,7 @@ void colvarmodule::clear_error()
|
|||
|
||||
void cvm::error(std::string const &message, int code)
|
||||
{
|
||||
set_error_bit(code);
|
||||
set_error_bits(code);
|
||||
proxy->error(message);
|
||||
}
|
||||
|
||||
|
@ -1303,7 +1298,7 @@ void cvm::fatal_error(std::string const &message)
|
|||
{
|
||||
// TODO once all non-fatal errors have been set to be handled by error(),
|
||||
// set DELETE_COLVARS here for VMD to handle it
|
||||
set_error_bit(FATAL_ERROR);
|
||||
set_error_bits(FATAL_ERROR);
|
||||
proxy->fatal_error(message);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#define COLVARMODULE_H
|
||||
|
||||
#ifndef COLVARS_VERSION
|
||||
#define COLVARS_VERSION "2016-08-01"
|
||||
#define COLVARS_VERSION "2016-09-03"
|
||||
#endif
|
||||
|
||||
#ifndef COLVARS_DEBUG
|
||||
|
@ -23,19 +23,16 @@
|
|||
/// shared between all object instances) to be accessed from other
|
||||
/// objects.
|
||||
|
||||
// Error codes are the negative of powers-of-two
|
||||
// as a result, error codes should NOT be bitwise-ORed but only
|
||||
// accessed through set_error_bit() and get_error_bit()
|
||||
#define COLVARS_OK 0
|
||||
#define COLVARS_ERROR -1
|
||||
#define COLVARS_NOT_IMPLEMENTED (-1*(1<<1))
|
||||
#define INPUT_ERROR (-1*(1<<2)) // out of bounds or inconsistent input
|
||||
#define BUG_ERROR (-1*(1<<3)) // Inconsistent state indicating bug
|
||||
#define FILE_ERROR (-1*(1<<4))
|
||||
#define MEMORY_ERROR (-1*(1<<5))
|
||||
#define FATAL_ERROR (-1*(1<<6)) // Should be set, or not, together with other bits
|
||||
#define DELETE_COLVARS (-1*(1<<7)) // Instruct the caller to delete cvm
|
||||
#define COLVARS_NO_SUCH_FRAME (-1*(1<<8)) // Cannot load the requested frame
|
||||
#define COLVARS_ERROR 1
|
||||
#define COLVARS_NOT_IMPLEMENTED (1<<1)
|
||||
#define INPUT_ERROR (1<<2) // out of bounds or inconsistent input
|
||||
#define BUG_ERROR (1<<3) // Inconsistent state indicating bug
|
||||
#define FILE_ERROR (1<<4)
|
||||
#define MEMORY_ERROR (1<<5)
|
||||
#define FATAL_ERROR (1<<6) // Should be set, or not, together with other bits
|
||||
#define DELETE_COLVARS (1<<7) // Instruct the caller to delete cvm
|
||||
#define COLVARS_NO_SUCH_FRAME (1<<8) // Cannot load the requested frame
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
@ -77,9 +74,6 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
/// Base class to handle mutual dependencies of most objects
|
||||
class deps;
|
||||
|
||||
friend class colvarproxy;
|
||||
// TODO colvarscript should be unaware of colvarmodule's internals
|
||||
friend class colvarscript;
|
||||
|
@ -118,12 +112,10 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
static void set_error_bit(int code);
|
||||
static void set_error_bits(int code);
|
||||
|
||||
static bool get_error_bit(int code);
|
||||
|
||||
static void combine_errors(int &target, int const code);
|
||||
|
||||
static inline int get_error()
|
||||
{
|
||||
return errorCode;
|
||||
|
@ -392,8 +384,8 @@ public:
|
|||
/// \brief Time step of MD integrator (fs)
|
||||
static real dt();
|
||||
|
||||
/// Request calculation of system force from MD engine
|
||||
static void request_system_force();
|
||||
/// Request calculation of total force from MD engine
|
||||
static void request_total_force();
|
||||
|
||||
/// Print a message to the main log
|
||||
static void log(std::string const &message);
|
||||
|
@ -642,9 +634,9 @@ inline int cvm::replica_comm_send(char* msg_data, int msg_len, int dest_rep) {
|
|||
}
|
||||
|
||||
|
||||
inline void cvm::request_system_force()
|
||||
inline void cvm::request_total_force()
|
||||
{
|
||||
proxy->request_system_force(true);
|
||||
proxy->request_total_force(true);
|
||||
}
|
||||
|
||||
inline void cvm::select_closest_image(atom_pos &pos,
|
||||
|
|
|
@ -524,7 +524,7 @@ int colvarparse::check_keywords(std::string &conf, char const *key)
|
|||
}
|
||||
}
|
||||
|
||||
init();
|
||||
clear_keyword_registry();
|
||||
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
@ -548,6 +548,10 @@ bool colvarparse::key_lookup(std::string const &conf,
|
|||
std::string &data,
|
||||
size_t &save_pos)
|
||||
{
|
||||
if (cvm::debug()) {
|
||||
cvm::log("Looking for the keyword \""+std::string(key_in)+"\" and its value.\n");
|
||||
}
|
||||
|
||||
// add this keyword to the register (in its camelCase version)
|
||||
add_keyword(key_in);
|
||||
|
||||
|
@ -568,11 +572,14 @@ bool colvarparse::key_lookup(std::string const &conf,
|
|||
// start from the first occurrence of key
|
||||
size_t pos = conf_lower.find(key, save_pos);
|
||||
|
||||
// iterate over all instances until it finds the isolated keyword
|
||||
// iterate over all instances of the substring until it finds it as isolated keyword
|
||||
while (true) {
|
||||
|
||||
if (pos == std::string::npos) {
|
||||
// no valid instance of the keyword has been found
|
||||
if (cvm::debug()) {
|
||||
cvm::log("Keyword \""+std::string(key_in)+"\" not found.\n");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -625,25 +632,46 @@ bool colvarparse::key_lookup(std::string const &conf,
|
|||
size_t data_begin = (to_lower_cppstr(line)).find(key) + key.size();
|
||||
data_begin = line.find_first_not_of(white_space, data_begin+1);
|
||||
|
||||
// size_t data_begin_absolute = data_begin + line_begin;
|
||||
// size_t data_end_absolute = data_begin;
|
||||
|
||||
if (data_begin != std::string::npos) {
|
||||
|
||||
size_t data_end = line.find_last_not_of(white_space) + 1;
|
||||
data_end = (data_end == std::string::npos) ? line.size() : data_end;
|
||||
// data_end_absolute = data_end + line_begin;
|
||||
|
||||
if (line.find('{', data_begin) != std::string::npos) {
|
||||
size_t brace = line.find('{', data_begin); // look for an opening brace
|
||||
size_t brace_last = brace;
|
||||
|
||||
size_t brace_count = 1;
|
||||
size_t brace = line.find('{', data_begin); // start from the first opening brace
|
||||
if (brace != std::string::npos) {
|
||||
|
||||
// find the matching closing brace
|
||||
|
||||
if (cvm::debug()) {
|
||||
cvm::log("Multi-line value, config is now \""+line+"\".\n");
|
||||
}
|
||||
|
||||
int brace_count = 1;
|
||||
|
||||
while (brace_count > 0) {
|
||||
|
||||
// find the matching closing brace
|
||||
brace = line.find_first_of("{}", brace+1);
|
||||
while (brace == std::string::npos) {
|
||||
brace = line.find_first_of("{}", brace_last+1);
|
||||
// find all braces within this line
|
||||
while (brace < std::string::npos) {
|
||||
brace_last = brace;
|
||||
if (line[brace] == '{') brace_count++;
|
||||
if (line[brace] == '}') brace_count--;
|
||||
if (brace_count == 0) {
|
||||
data_end = brace+1;
|
||||
break;
|
||||
}
|
||||
brace = line.find_first_of("{}", brace+1);
|
||||
}
|
||||
|
||||
if (brace_count == 0) {
|
||||
data_end = brace+1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (brace == std::string::npos) {
|
||||
|
||||
// add a new line
|
||||
if (line_end >= conf.size()) {
|
||||
cvm::error("Parse error: reached the end while "
|
||||
|
@ -652,8 +680,6 @@ bool colvarparse::key_lookup(std::string const &conf,
|
|||
line+"\".\n", INPUT_ERROR);
|
||||
return false;
|
||||
}
|
||||
size_t const old_end = line.size();
|
||||
// data_end_absolute += old_end+1;
|
||||
|
||||
line_begin = line_end;
|
||||
nl = conf.find('\n', line_begin+1);
|
||||
|
@ -663,36 +689,35 @@ bool colvarparse::key_lookup(std::string const &conf,
|
|||
line_end = nl;
|
||||
line.append(conf, line_begin, (line_end-line_begin));
|
||||
|
||||
brace = line.find_first_of("{}", old_end);
|
||||
if (cvm::debug()) {
|
||||
cvm::log("Added a new line, config is now \""+line+"\".\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (line[brace] == '{') brace_count++;
|
||||
if (line[brace] == '}') brace_count--;
|
||||
if (brace_count < 0) {
|
||||
cvm::error("Error: found closing brace without opening brace.\n", INPUT_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
// set data_begin after the opening brace
|
||||
data_begin = line.find_first_of('{', data_begin) + 1;
|
||||
// strip the leading and trailing braces
|
||||
data_begin = line.find_first_of('{') + 1;
|
||||
data_begin = line.find_first_not_of(white_space,
|
||||
data_begin);
|
||||
// set data_end before the closing brace
|
||||
data_end = brace;
|
||||
data_end = line.find_last_not_of(white_space+"}",
|
||||
data_end) + 1;
|
||||
// data_end_absolute = line_end;
|
||||
|
||||
if (data_end > line.size())
|
||||
data_end = line.size();
|
||||
data_end = line.find_last_of('}', line.size()) - 1;
|
||||
data_end = line.find_last_not_of(white_space,
|
||||
data_end) + 1;
|
||||
}
|
||||
|
||||
data.append(line, data_begin, (data_end-data_begin));
|
||||
|
||||
if (cvm::debug()) {
|
||||
cvm::log("Keyword value = \""+data+"\".\n");
|
||||
}
|
||||
|
||||
if (data.size() && save_delimiters) {
|
||||
data_begin_pos.push_back(conf.find(data, pos+key.size()));
|
||||
data_end_pos.push_back(data_begin_pos.back()+data.size());
|
||||
// std::cerr << "key = " << key << ", data = \""
|
||||
// << data << "\", data_begin, data_end = "
|
||||
// << data_begin_pos.back() << ", " << data_end_pos.back()
|
||||
// << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -180,7 +180,6 @@ public:
|
|||
bool &value,
|
||||
bool const &def_value = false,
|
||||
Parse_Mode const parse_mode = parse_normal);
|
||||
|
||||
bool get_keyval(std::string const &conf,
|
||||
char const *key,
|
||||
std::vector<int> &values,
|
||||
|
|
|
@ -69,12 +69,12 @@ public:
|
|||
virtual cvm::real rand_gaussian(void) = 0;
|
||||
|
||||
/// \brief Get the current frame number
|
||||
// Negative return values indicate error
|
||||
virtual int frame() { return COLVARS_NOT_IMPLEMENTED; }
|
||||
// Returns error code
|
||||
virtual int get_frame(long int&) { return COLVARS_NOT_IMPLEMENTED; }
|
||||
|
||||
/// \brief Set the current frame number
|
||||
// return frame number on success, COLVARS_NO_SUCH_FRAME otherwise
|
||||
virtual int frame(int) { return COLVARS_NOT_IMPLEMENTED; }
|
||||
/// \brief Set the current frame number (as well as colvarmodule::it)
|
||||
// Returns error code
|
||||
virtual int set_frame(long int) { return COLVARS_NOT_IMPLEMENTED; }
|
||||
|
||||
/// \brief Prefix to be used for input files (restarts, not
|
||||
/// configuration)
|
||||
|
@ -295,11 +295,11 @@ public:
|
|||
/// Pass restraint energy value for current timestep to MD engine
|
||||
virtual void add_energy(cvm::real energy) = 0;
|
||||
|
||||
/// Tell the proxy whether system forces are needed (may not always be available)
|
||||
virtual void request_system_force(bool yesno)
|
||||
/// Tell the proxy whether total forces are needed (may not always be available)
|
||||
virtual void request_total_force(bool yesno)
|
||||
{
|
||||
if (yesno == true)
|
||||
cvm::error("Error: system forces are currently not implemented.\n",
|
||||
cvm::error("Error: total forces are currently not implemented.\n",
|
||||
COLVARS_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
|
@ -354,8 +354,6 @@ protected:
|
|||
std::vector<cvm::rvector> atoms_positions;
|
||||
/// \brief Most recent total forces on each atom
|
||||
std::vector<cvm::rvector> atoms_total_forces;
|
||||
/// \brief Most recent forces applied by external potentials onto each atom
|
||||
std::vector<cvm::rvector> atoms_applied_forces;
|
||||
/// \brief Forces applied from colvars, to be communicated to the MD integrator
|
||||
std::vector<cvm::rvector> atoms_new_colvar_forces;
|
||||
|
||||
|
@ -368,7 +366,6 @@ protected:
|
|||
atoms_charges.push_back(0.0);
|
||||
atoms_positions.push_back(cvm::rvector(0.0, 0.0, 0.0));
|
||||
atoms_total_forces.push_back(cvm::rvector(0.0, 0.0, 0.0));
|
||||
atoms_applied_forces.push_back(cvm::rvector(0.0, 0.0, 0.0));
|
||||
atoms_new_colvar_forces.push_back(cvm::rvector(0.0, 0.0, 0.0));
|
||||
return (atoms_ids.size() - 1);
|
||||
}
|
||||
|
@ -439,10 +436,10 @@ public:
|
|||
return atoms_positions[index];
|
||||
}
|
||||
|
||||
/// Read the current total system force of the given atom
|
||||
inline cvm::rvector get_atom_system_force(int index) const
|
||||
/// Read the current total force of the given atom
|
||||
inline cvm::rvector get_atom_total_force(int index) const
|
||||
{
|
||||
return atoms_total_forces[index] - atoms_applied_forces[index];
|
||||
return atoms_total_forces[index];
|
||||
}
|
||||
|
||||
/// Request that this force is applied to the given atom
|
||||
|
@ -465,7 +462,6 @@ public:
|
|||
inline std::vector<cvm::real> *modify_atom_charges() { return &atoms_charges; }
|
||||
inline std::vector<cvm::rvector> *modify_atom_positions() { return &atoms_positions; }
|
||||
inline std::vector<cvm::rvector> *modify_atom_total_forces() { return &atoms_total_forces; }
|
||||
inline std::vector<cvm::rvector> *modify_atom_applied_forces() { return &atoms_applied_forces; }
|
||||
inline std::vector<cvm::rvector> *modify_atom_new_colvar_forces() { return &atoms_new_colvar_forces; }
|
||||
|
||||
/// \brief Read atom identifiers from a file \param filename name of
|
||||
|
@ -513,8 +509,6 @@ protected:
|
|||
std::vector<cvm::rvector> atom_groups_coms;
|
||||
/// \brief Most recently updated total forces on the com of each group
|
||||
std::vector<cvm::rvector> atom_groups_total_forces;
|
||||
/// \brief Most recent forces applied by external potentials onto each group
|
||||
std::vector<cvm::rvector> atom_groups_applied_forces;
|
||||
/// \brief Forces applied from colvars, to be communicated to the MD integrator
|
||||
std::vector<cvm::rvector> atom_groups_new_colvar_forces;
|
||||
|
||||
|
@ -538,7 +532,6 @@ public:
|
|||
atom_groups_charges.push_back(0.0);
|
||||
atom_groups_coms.push_back(cvm::rvector(0.0, 0.0, 0.0));
|
||||
atom_groups_total_forces.push_back(cvm::rvector(0.0, 0.0, 0.0));
|
||||
atom_groups_applied_forces.push_back(cvm::rvector(0.0, 0.0, 0.0));
|
||||
atom_groups_new_colvar_forces.push_back(cvm::rvector(0.0, 0.0, 0.0));
|
||||
return (atom_groups_ids.size() - 1);
|
||||
}
|
||||
|
@ -592,10 +585,10 @@ public:
|
|||
return atom_groups_coms[index];
|
||||
}
|
||||
|
||||
/// Read the current total system force of the given atom group
|
||||
inline cvm::rvector get_atom_group_system_force(int index) const
|
||||
/// Read the current total force of the given atom group
|
||||
inline cvm::rvector get_atom_group_total_force(int index) const
|
||||
{
|
||||
return atom_groups_total_forces[index] - atom_groups_applied_forces[index];
|
||||
return atom_groups_total_forces[index];
|
||||
}
|
||||
|
||||
/// Request that this force is applied to the given atom group
|
||||
|
|
|
@ -55,14 +55,14 @@ int colvarscript::run(int argc, char const *argv[]) {
|
|||
if (cmd == "delete") {
|
||||
// Note: the delete bit may be ignored by some backends
|
||||
// it is mostly useful in VMD
|
||||
colvars->set_error_bit(DELETE_COLVARS);
|
||||
colvars->set_error_bits(DELETE_COLVARS);
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
if (cmd == "update") {
|
||||
cvm::combine_errors(error_code, proxy->update_input());
|
||||
cvm::combine_errors(error_code, colvars->calc());
|
||||
cvm::combine_errors(error_code, proxy->update_output());
|
||||
error_code |= proxy->update_input();
|
||||
error_code |= colvars->calc();
|
||||
error_code |= proxy->update_output();
|
||||
if (error_code) {
|
||||
result += "Error updating the colvars module.\n";
|
||||
}
|
||||
|
@ -142,8 +142,8 @@ int colvarscript::run(int argc, char const *argv[]) {
|
|||
}
|
||||
proxy->output_prefix_str = argv[2];
|
||||
int error = 0;
|
||||
cvm::combine_errors(error, colvars->setup_output());
|
||||
cvm::combine_errors(error, colvars->write_output_files());
|
||||
error |= colvars->setup_output();
|
||||
error |= colvars->write_output_files();
|
||||
return error ? COLVARSCRIPT_ERROR : COLVARS_OK;
|
||||
}
|
||||
|
||||
|
@ -163,8 +163,9 @@ int colvarscript::run(int argc, char const *argv[]) {
|
|||
|
||||
if (cmd == "frame") {
|
||||
if (argc == 2) {
|
||||
int f = proxy->frame();
|
||||
if (f >= 0) {
|
||||
long int f;
|
||||
int error = proxy->get_frame(f);
|
||||
if (error == COLVARS_OK) {
|
||||
result = cvm::to_str(f);
|
||||
return COLVARS_OK;
|
||||
} else {
|
||||
|
@ -173,10 +174,9 @@ int colvarscript::run(int argc, char const *argv[]) {
|
|||
}
|
||||
} else if (argc == 3) {
|
||||
// Failure of this function does not trigger an error, but
|
||||
// returns the plain result to let scripts detect available frames
|
||||
long int f = proxy->frame(strtol(argv[2], NULL, 10));
|
||||
colvars->it = proxy->frame();
|
||||
result = cvm::to_str(f);
|
||||
// returns nonzero, to let scripts detect available frames
|
||||
int error = proxy->set_frame(strtol(argv[2], NULL, 10));
|
||||
result = cvm::to_str(error == COLVARS_OK ? 0 : -1);
|
||||
return COLVARS_OK;
|
||||
} else {
|
||||
result = "Wrong arguments to command \"frame\"\n" + help_string();
|
||||
|
@ -248,7 +248,7 @@ int colvarscript::proc_colvar(int argc, char const *argv[]) {
|
|||
}
|
||||
|
||||
if (subcmd == "getsystemforce") {
|
||||
result = (cv->system_force()).to_simple_string();
|
||||
result = (cv->total_force()).to_simple_string();
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
|
@ -336,6 +336,11 @@ int colvarscript::proc_bias(int argc, char const *argv[]) {
|
|||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
if (subcmd == "state") {
|
||||
b->print_state();
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
// Subcommands for MW ABF
|
||||
if (subcmd == "bin") {
|
||||
int r = b->current_bin();
|
||||
|
@ -414,7 +419,8 @@ Input and output:\n\
|
|||
printframe -- return a summary of the current frame\n\
|
||||
printframelabels -- return labels to annotate printframe's output\n";
|
||||
|
||||
if (proxy->frame() != COLVARS_NOT_IMPLEMENTED) {
|
||||
long int tmp;
|
||||
if (proxy->get_frame(tmp) != COLVARS_NOT_IMPLEMENTED) {
|
||||
buf += "\
|
||||
frame -- return current frame number\n\
|
||||
frame <new_frame> -- set frame number\n";
|
||||
|
|
|
@ -789,10 +789,10 @@ $(GPU_LIB): $(OBJS) $(CUDPP)
|
|||
@cp $(EXTRAMAKE) Makefile.lammps
|
||||
|
||||
clean:
|
||||
rm -f $(EXECS) $(GPU_LIB) $(OBJS) $(CUDPP) $(CBNS) *.linkinfo
|
||||
-rm -f $(EXECS) $(GPU_LIB) $(OBJS) $(CUDPP) $(CBNS) *.linkinfo
|
||||
|
||||
veryclean: clean
|
||||
rm -rf *~ *.linkinfo
|
||||
-rm -rf *~ *.linkinfo
|
||||
|
||||
cleanlib:
|
||||
rm -f $(EXECS) $(GPU_LIB) $(OBJS) $(CBNS) *.linkinfo
|
||||
-rm -f $(EXECS) $(GPU_LIB) $(OBJS) $(CBNS) *.linkinfo
|
||||
|
|
|
@ -577,8 +577,8 @@ $(OCL_LIB): $(OBJS) $(PTXS)
|
|||
opencl: $(OCL_EXECS)
|
||||
|
||||
clean:
|
||||
rm -rf $(EXECS) $(OCL_EXECS) $(OCL_LIB) $(OBJS) $(KERS) *.linkinfo
|
||||
-rm -rf $(EXECS) $(OCL_EXECS) $(OCL_LIB) $(OBJS) $(KERS) *.linkinfo
|
||||
|
||||
veryclean: clean
|
||||
rm -rf *~ *.linkinfo
|
||||
-rm -rf *~ *.linkinfo
|
||||
|
||||
|
|
|
@ -471,7 +471,7 @@ KOKKOS_OBJ_LINK = $(notdir $(KOKKOS_OBJ))
|
|||
include $(KOKKOS_PATH)/Makefile.targets
|
||||
|
||||
kokkos-clean:
|
||||
rm -f $(KOKKOS_OBJ_LINK) KokkosCore_config.h KokkosCore_config.tmp libkokkos.a
|
||||
-rm -f $(KOKKOS_OBJ_LINK) KokkosCore_config.h KokkosCore_config.tmp libkokkos.a
|
||||
|
||||
libkokkos.a: $(KOKKOS_OBJ_LINK) $(KOKKOS_SRC) $(KOKKOS_HEADERS)
|
||||
ar cr libkokkos.a $(KOKKOS_OBJ_LINK)
|
||||
|
|
|
@ -4,10 +4,10 @@ SHELL=/bin/sh
|
|||
|
||||
all:
|
||||
$(MAKE) $(MFLAGS) mingw32-cross
|
||||
rm -f Obj_mingw32-mpi
|
||||
-rm -f Obj_mingw32-mpi
|
||||
ln -s Obj_mingw32 Obj_mingw32-mpi
|
||||
|
||||
clean:
|
||||
$(MAKE) $(MFLAGS) clean-mingw32-cross
|
||||
rm -f Obj_mingw32-mpi
|
||||
-rm -f Obj_mingw32-mpi
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ SHELL=/bin/sh
|
|||
|
||||
all:
|
||||
$(MAKE) $(MFLAGS) mingw64-cross
|
||||
rm -f Obj_mingw64-mpi
|
||||
-rm -f Obj_mingw64-mpi
|
||||
ln -s Obj_mingw64 Obj_mingw64-mpi
|
||||
|
||||
clean:
|
||||
$(MAKE) $(MFLAGS) clean-mingw64-cross
|
||||
rm -f Obj_mingw64-mpi
|
||||
-rm -f Obj_mingw64-mpi
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ SHELL=/bin/sh
|
|||
|
||||
all:
|
||||
$(MAKE) $(MFLAGS) mingw32-cross
|
||||
rm -f Obj_mingw32-mpi
|
||||
-rm -f Obj_mingw32-mpi
|
||||
ln -s Obj_mingw32 Obj_mingw32-mpi
|
||||
|
||||
clean:
|
||||
$(MAKE) $(MFLAGS) clean-mingw32-cross
|
||||
rm -f Obj_mingw32-mpi
|
||||
-rm -f Obj_mingw32-mpi
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ SHELL=/bin/sh
|
|||
|
||||
all:
|
||||
$(MAKE) $(MFLAGS) mingw64-cross
|
||||
rm -f Obj_mingw64-mpi
|
||||
-rm -f Obj_mingw64-mpi
|
||||
ln -s Obj_mingw64 Obj_mingw64-mpi
|
||||
|
||||
clean:
|
||||
$(MAKE) $(MFLAGS) clean-mingw64-cross
|
||||
rm -f Obj_mingw64-mpi
|
||||
-rm -f Obj_mingw64-mpi
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ SHELL=/bin/sh
|
|||
|
||||
all:
|
||||
$(MAKE) $(MFLAGS) mingw32-cross
|
||||
rm -f Obj_mingw32-mpi
|
||||
-rm -f Obj_mingw32-mpi
|
||||
ln -s Obj_mingw32 Obj_mingw32-mpi
|
||||
|
||||
clean:
|
||||
$(MAKE) $(MFLAGS) clean-mingw32-cross
|
||||
rm -f Obj_mingw32-mpi
|
||||
-rm -f Obj_mingw32-mpi
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ SHELL=/bin/sh
|
|||
|
||||
all:
|
||||
$(MAKE) $(MFLAGS) mingw64-cross
|
||||
rm -f Obj_mingw64-mpi
|
||||
-rm -f Obj_mingw64-mpi
|
||||
ln -s Obj_mingw64 Obj_mingw64-mpi
|
||||
|
||||
clean:
|
||||
$(MAKE) $(MFLAGS) clean-mingw64-cross
|
||||
rm -f Obj_mingw64-mpi
|
||||
-rm -f Obj_mingw64-mpi
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ tldeps:
|
|||
$(MAKE) -C ../../src $(MFLAGS) mode=lib $(LAMMPSCFG)
|
||||
|
||||
clean :
|
||||
- /bin/rm -f *.x *.o *.a *~ *.F90 *.d *.mod *.i *.L
|
||||
-rm -f *.x *.o *.a *~ *.F90 *.d *.mod *.i *.L
|
||||
|
||||
# explicit dependencies
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ tldeps:
|
|||
$(MAKE) -C ../../src $(MFLAGS) mode=lib $(LAMMPSCFG)
|
||||
|
||||
clean :
|
||||
- /bin/rm -f *.x *.o *.a *~ *.F90 *.d *.mod *.i *.L
|
||||
-rm -f *.x *.o *.a *~ *.F90 *.d *.mod *.i *.L
|
||||
|
||||
# explicit dependencies
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ colvarproxy_lammps::colvarproxy_lammps(LAMMPS_NS::LAMMPS *lmp,
|
|||
_random = new LAMMPS_NS::RanPark(lmp,seed);
|
||||
|
||||
first_timestep=true;
|
||||
system_force_requested=false;
|
||||
total_force_requested=false;
|
||||
previous_step=-1;
|
||||
t_target=temp;
|
||||
do_exit=false;
|
||||
|
@ -154,7 +154,6 @@ void colvarproxy_lammps::init(const char *conf_file)
|
|||
log("atoms_ids = "+cvm::to_str(atoms_ids)+"\n");
|
||||
log("atoms_ncopies = "+cvm::to_str(atoms_ncopies)+"\n");
|
||||
log("atoms_positions = "+cvm::to_str(atoms_positions)+"\n");
|
||||
log("atoms_applied_forces = "+cvm::to_str(atoms_applied_forces)+"\n");
|
||||
log(cvm::line_marker);
|
||||
log("Info: done initializing the colvars proxy object.\n");
|
||||
}
|
||||
|
@ -199,13 +198,8 @@ double colvarproxy_lammps::compute()
|
|||
"Updating internal data.\n");
|
||||
}
|
||||
|
||||
// backup applied forces if necessary to calculate system forces
|
||||
if (system_force_requested) {
|
||||
atoms_applied_forces = atoms_new_colvar_forces;
|
||||
}
|
||||
|
||||
// zero the forces on the atoms, so that they can be accumulated by the colvars
|
||||
for (size_t i = 0; i < atoms_applied_forces.size(); i++) {
|
||||
for (size_t i = 0; i < atoms_new_colvar_forces.size(); i++) {
|
||||
atoms_new_colvar_forces[i].reset();
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class colvarproxy_lammps : public colvarproxy {
|
|||
int previous_step;
|
||||
|
||||
bool first_timestep;
|
||||
bool system_force_requested;
|
||||
bool total_force_requested;
|
||||
bool do_exit;
|
||||
|
||||
// std::vector<int> colvars_atoms;
|
||||
|
@ -86,7 +86,7 @@ class colvarproxy_lammps : public colvarproxy {
|
|||
// methods for lammps to move data or trigger actions in the proxy
|
||||
public:
|
||||
void set_temperature(double t) { t_target = t; };
|
||||
bool need_system_forces() const { return system_force_requested; };
|
||||
bool need_total_forces() const { return total_force_requested; };
|
||||
bool want_exit() const { return do_exit; };
|
||||
|
||||
// perform colvars computation. returns biasing energy
|
||||
|
@ -109,7 +109,7 @@ class colvarproxy_lammps : public colvarproxy {
|
|||
inline size_t restart_frequency() { return restart_every; };
|
||||
|
||||
void add_energy(cvm::real energy) { bias_energy += energy; };
|
||||
void request_system_force(bool yesno) { system_force_requested = yesno; };
|
||||
void request_total_force(bool yesno) { total_force_requested = yesno; };
|
||||
|
||||
void log(std::string const &message);
|
||||
void error(std::string const &message);
|
||||
|
|
|
@ -766,7 +766,7 @@ void FixColvars::post_force(int vflag)
|
|||
// call our workhorse and retrieve additional information.
|
||||
if (me == 0) {
|
||||
energy = proxy->compute();
|
||||
store_forces = proxy->need_system_forces();
|
||||
store_forces = proxy->need_total_forces();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
Loading…
Reference in New Issue