Skip to content

Commit

Permalink
More checks on PBCs, bump version to 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jhenin committed Jan 16, 2019
1 parent e1cb8d0 commit a857aed
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@

VERSION=1.2
TCLINC=/usr/include/tcl
VERSION=1.3
TCLINC=/usr/include/tcl8.6
PLUGINDIR=${HOME}/lib/vmd/plugins/LINUXAMD64/tcl

CPP=g++
#CPPFLAGS=-fpic -g -I${TCLINC}
CPPFLAGS=-fpic -O3 -I${TCLINC}
CPPFLAGS=-fpic -O3 -I${TCLINC} -DVERSION=\"${VERSION}\"

all: qwrap.so qwrap.tar.gz
all: qwrap.so pkgIndex.tcl

qwrap.so: qwrap.o
$(CPP) -shared qwrap.o -o qwrap.so

qwrap.tar.gz: qwrap.cpp Makefile
qwrap.tar.gz: qwrap.cpp Makefile pkgIndex.tcl
tar czf qwrap${VERSION}.tar.gz qwrap.cpp Makefile pkgIndex.tcl

pkgIndex.tcl: qwrap.so
tclsh mkindex.tcl

clean:
rm *.o *.so *.tar.gz

install:
install: all
mkdir -p ${PLUGINDIR}/qwrap${VERSION} && \
rsync -av qwrap.so pkgIndex.tcl ${PLUGINDIR}/qwrap${VERSION}/.
12 changes: 0 additions & 12 deletions pkgIndex.tcl

This file was deleted.

14 changes: 11 additions & 3 deletions qwrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,17 +337,25 @@ static int do_qwrap(ClientData data, Tcl_Interp *interp, int argc, Tcl_Obj * con
// except if unwrapping and at first frame, then it's not needed

if (!(unwrap && frame == first_frame)) {
Tcl_Obj *get_abc = Tcl_ObjPrintf ("molinfo top get {a b c}");
Tcl_Obj *get_abc = Tcl_ObjPrintf ("molinfo top get {a b c alpha beta gamma}");
result = Tcl_EvalObjEx(interp, get_abc, TCL_EVAL_DIRECT);
if (result != TCL_OK) { return TCL_ERROR; }

object = Tcl_GetObjResult(interp);
{
int num = parse_vector(object, PBC, interp);
if (num != 3 || PBC[0]*PBC[1]*PBC[2] == 0.0) {
if (num != 6) {
Tcl_SetResult(interp, (char *) "qwrap: error parsing PBC", TCL_STATIC);
return TCL_ERROR;
}
if (PBC[0]*PBC[1]*PBC[2] == 0.0) {
Tcl_SetResult(interp, (char *) "qwrap: error: at least one PBC box length is zero", TCL_STATIC);
return TCL_ERROR;
}
if (PBC[3] != 90. || PBC[4] != 90. || PBC[5] != 90.) {
Tcl_SetResult(interp, (char *) "qwrap: non-orthorhombic cell detected, unsupported by qwrap; use PbcTools for this system", TCL_STATIC);
return TCL_ERROR;
}
}
}

Expand Down Expand Up @@ -499,7 +507,7 @@ extern "C" {
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateObjCommand(interp, "qunwrap", obj_qunwrap,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_EvalEx(interp, "package provide qwrap 1.2", -1, 0);
Tcl_EvalEx(interp, "package provide qwrap " VERSION, -1, 0);
return TCL_OK;
}
}

0 comments on commit a857aed

Please sign in to comment.