Skip to content

Commit

Permalink
Merge ee548f5 into b855bb5
Browse files Browse the repository at this point in the history
  • Loading branch information
Miha Purg committed Sep 10, 2020
2 parents b855bb5 + ee548f5 commit 4010c69
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 100 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
@@ -1,12 +1,10 @@
language: python
python:
- "2.7"
- "3.4"
- "3.5"
- "3.5-dev"
- "3.6"
- "3.6-dev"
- "3.7-dev"
- "3.7"
- "3.8"
before_install:
- pip install pytest pytest-cov
- pip install coveralls
Expand Down
17 changes: 8 additions & 9 deletions README.md
Expand Up @@ -28,27 +28,26 @@ qtools is a toolset comprised of a Python library Qpyl and a set of command-line

#### Requirements

The library and tools do not have any dependencies, except *matplotlib*
which is required only for *q_plot.py*, a non-essential utility used mostly for
troubleshooting simulations.

The only requirements are a *Unix-like OS (Linux or OSX)*, *Python (versions 2.7, 3.4+)* and *Q* (see the [Q6 github page](https://github.com/qusers/Q6)).
- Python 3.4+
- Q (see the [Q6 github page](https://github.com/qusers/Q6)).
- matplotlib is required for *q_plot.py*, a non-essential utility used mostly for troubleshooting simulations.

#### Installation (Linux, OSX)

Clone the repository to your local directory:
Clone the repository:
```
mkdir -p ~/bin && cd ~/bin
git clone https://github.com/mpurg/qtools
```

Add this line to your `~/.bashrc` or `~/.bash_profile`:
If using Bash, add this line to your `~/.bashrc`:
```
source $HOME/bin/qtools/qtools_init.sh
```

Open a new shell session and run the CLI config script:
Reload *.bashrc* and run the CLI config script:
```
source ~/.bashrc
qscripts_config.py
```
This script looks for Q executables in your `PATH` and creates a default settings-file `$QTOOLS_HOME/qscripts.cfg`.
Expand Down Expand Up @@ -82,7 +81,7 @@ DOI of the latest release:
[![DOI](https://zenodo.org/badge/80016679.svg)](https://zenodo.org/badge/latestdoi/80016679)

*Example:*
*...analysis was performed with qtools v0.5.10 (DOI: 10.5281/zenodo.842003).*
*...analysis was performed with qtools v0.7.0 (DOI: 10.5281/zenodo.842003).*

#### Bugs, feature requests, and contributions
Submit issues and feature requests to Github (https://github.com/mpurg/qtools/issues).
Expand Down
3 changes: 1 addition & 2 deletions packages/Qpyl/__init__.py
Expand Up @@ -12,6 +12,5 @@
"""
__author__ = "Miha Purg"
__license__ = "MIT"
__version__ = "0.6.1"

__version__ = "0.7.0"

12 changes: 10 additions & 2 deletions qscripts-cli/q_amber2q.py
Expand Up @@ -247,6 +247,14 @@
time.ctime(), qlib.get_string())
open(libfn, "w").write(outstring)

# make a list of unique torsion prms
# (generics for same atypes are returned from .prm_full as
# separate _PrmTorsion objects)
torsion_prms = [x.prm_full for x in qtop.torsions]
torsion_prms_unique = {x.prm_id: x for x in torsion_prms}.values()
improper_prms = [x.prm_full for x in qtop.impropers]
improper_prms_unique = {x.prm_id: x for x in improper_prms}.values()

print("Writing the parameter file: {}".format(prmfn))
backup = backup_file(prmfn)
if backup:
Expand All @@ -260,8 +268,8 @@
qprm.get_string(atom_types=[x.prm for x in qtop.atoms],
bonds=[x.prm for x in qtop.bonds],
angles=[x.prm for x in qtop.angles],
torsions=[x.prm_full for x in qtop.torsions],
impropers=[x.prm_full for x in qtop.impropers]))
torsions=torsion_prms_unique,
impropers=improper_prms_unique))
open(prmfn, "w").write(outstring)

print("Writing the parameter check file: {}".format(prmchkfn))
Expand Down
12 changes: 7 additions & 5 deletions qscripts-cli/q_plot.py
Expand Up @@ -70,7 +70,6 @@ def __init__(self, parent, plotdata, plotdata_files):
self.subplot_lines = {}
self.legend_font = FontProperties(size="xx-small")


self.lb1_entries = ODict()
for plot_key, plot in six.iteritems(self.plots):
self.lb1_entries[ list(plot.values())[0].title ] = plot_key
Expand Down Expand Up @@ -229,10 +228,12 @@ def draw_plots(self):
marker="s")

elif plot.plot_type == "wireframe":
line = plt.plot_wireframe(subplot_data["xdata"],
subplot_data["ydata"],
subplot_data["zdata"],
color=self._COLORS[plot_number])
line = plt.scatter(subplot_data["xdata"],
subplot_data["ydata"],
subplot_data["zdata"],
c=subplot_data["ydata"],
cmap=matplotlib.cm.viridis)


# add the line that was drawn to subplot_lines
# so that we can change color if lb2 selection changes
Expand Down Expand Up @@ -406,6 +407,7 @@ def on_resize(self,event):
from matplotlib.figure import Figure
import matplotlib.patches as mpatches
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
except ImportError:
print("""Matplotlib is required for this script to work. Try something like:
(ubuntu) $ sudo apt-get install python-matplotlib
Expand Down
22 changes: 2 additions & 20 deletions tests/Qpyl/data/qmapping/qfep_testrep1.out
@@ -1,30 +1,12 @@

Build and version information

Build number 6.0.8
Build date 20170817
Built:
by acmnpv
on acmnpvdell
git id 7f54fcf7fd0dc0c14e640a3fa3ce03384d771623
with GNU Fortran Debian 6.4.0-1 6.4.0 20170704
qfep version 6.0.8 , git id=7f54fcf7fd0dc0c14e640a3fa3ce03384d771623 initialising
Current date 2018- 9-27 and time 17:50:50

Welcome in qfep modification date 20170817

Q6, Copyright © 2017 Johan Åqvist, John Marelius, Shina Caroline Lynn Kamerlin and Paul Bauer
Q6 comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome
to redistribute it under certain conditions. For details, add the --help flag.
--> Number of energy files: # Number of files = 21
Number of energy files: # Number of files = 21
--> No. of states, no. of predefined off-diag elements: # Number of states = 2
# Number of off-diagonal elements = 0
--> Give kT & no, of pts to skip & calculation mode: # kT = 0.592
# Number of data points to skip = 1
# Only QQ interactions will be considered = 0
--> Give number of gap-bins: # Number of gap-bins = 20
--> Give minimum # pts/bin: # Minimum number of points per bin= 1
--> Give alpha for state 2: # Alpha for state 2 = 10.00
--> Give alpha for state 2: # Alpha for state 2 = 10.00
--> Number of off-diagonal elements:# Number of off-diagonal elements = 1
# i j A(i,j) mu(i,j) eta(i,j) rxy0(i,j)
--> i, j, A_ij, mu_ij, eta_ij, r_xy0: # 1 2 100.00 0.00 0.00 0.00
Expand Down
22 changes: 2 additions & 20 deletions tests/Qpyl/data/qmapping/qfep_testrep2.out
@@ -1,30 +1,12 @@

Build and version information

Build number 6.0.8
Build date 20170817
Built:
by acmnpv
on acmnpvdell
git id 7f54fcf7fd0dc0c14e640a3fa3ce03384d771623
with GNU Fortran Debian 6.4.0-1 6.4.0 20170704
qfep version 6.0.8 , git id=7f54fcf7fd0dc0c14e640a3fa3ce03384d771623 initialising
Current date 2018- 9-27 and time 17:50:50

Welcome in qfep modification date 20170817

Q6, Copyright © 2017 Johan Åqvist, John Marelius, Shina Caroline Lynn Kamerlin and Paul Bauer
Q6 comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome
to redistribute it under certain conditions. For details, add the --help flag.
--> Number of energy files: # Number of files = 21
Number of energy files: # Number of files = 21
--> No. of states, no. of predefined off-diag elements: # Number of states = 2
# Number of off-diagonal elements = 0
--> Give kT & no, of pts to skip & calculation mode: # kT = 0.592
# Number of data points to skip = 1
# Only QQ interactions will be considered = 0
--> Give number of gap-bins: # Number of gap-bins = 20
--> Give minimum # pts/bin: # Minimum number of points per bin= 1
--> Give alpha for state 2: # Alpha for state 2 = 10.00
--> Give alpha for state 2: # Alpha for state 2 = 10.00
--> Number of off-diagonal elements:# Number of off-diagonal elements = 1
# i j A(i,j) mu(i,j) eta(i,j) rxy0(i,j)
--> i, j, A_ij, mu_ij, eta_ij, r_xy0: # 1 2 100.00 0.00 0.00 0.00
Expand Down
19 changes: 12 additions & 7 deletions tests/Qpyl/qmapping_test.py
Expand Up @@ -52,15 +52,20 @@ def test_mapall(self):
#open(fn, "w").write(qfep_inp)
assert open(fn, "r").read() == qfep_inp


qfep_out = re.sub(".*Number of energy files",
"Number of energy files",
qfep_out, 0, re.DOTALL)

fn = "data/qmapping/qfep_" + os.path.basename(md) + ".out"

#open(fn, "w").write(qfep_out)
ref_str = re.sub("Build.*Copyright", "Copyright",
open(fn, "r").read(), flags=re.DOTALL)
ref_str = re.sub(" ", "", ref_str)
out_str = re.sub("Build.*Copyright", "Copyright",
qfep_out, flags=re.DOTALL)
out_str = re.sub(" ", "", out_str)
assert ref_str == out_str
qfep_out = re.sub(" +", " ", qfep_out)

ref_out = open(fn, "r").read()
ref_out = re.sub(" +", " ", ref_out)

assert ref_out == qfep_out

def test_fit_to_reference(self):

Expand Down
33 changes: 2 additions & 31 deletions tests/qscripts-cli/q_amber2q/1-pxn/output/pxn.prm
@@ -1,5 +1,5 @@
# Generated with q_amber2q.py, version 0.6.0
# Date: Wed Sep 5 11:45:05 2018
# Generated with q_amber2q.py, version 0.6.1
# Date: Fri Mar 29 14:39:10 2019
#
[options]

Expand Down Expand Up @@ -54,48 +54,19 @@ c3 os p5 o 0.55 3.0 0.0
c3 os p5 os 2.61 2.0 0.0 1.0
c3 os p5 os 0.0 3.0 0.0 1.0
ca ca ca ca 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca ca 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca ca 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca ca 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca ca 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca ca 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca ha 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca ha 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca ha 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca ha 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca ha 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca ha 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca ha 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca ha 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca no 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca no 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca os 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca ca os 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ca ca no o 0.7 2.0 180.0 1.0
ca ca os p5 1.75 2.0 180.0 1.0
ca os p5 o 0.8 2.0 180.0 1.0
ca os p5 o 0.1 3.0 0.0 1.0
ca os p5 os 2.4 2.0 0.0 3.0 # Generic: ? os p5 ?
ca os p5 os 2.4 2.0 0.0 3.0 # Generic: ? os p5 ?
h1 c3 c3 hc 1.4 3.0 0.0 9.0 # Generic: ? c3 c3 ?
h1 c3 c3 hc 1.4 3.0 0.0 9.0 # Generic: ? c3 c3 ?
h1 c3 c3 hc 1.4 3.0 0.0 9.0 # Generic: ? c3 c3 ?
h1 c3 c3 hc 1.4 3.0 0.0 9.0 # Generic: ? c3 c3 ?
h1 c3 c3 hc 1.4 3.0 0.0 9.0 # Generic: ? c3 c3 ?
h1 c3 c3 hc 1.4 3.0 0.0 9.0 # Generic: ? c3 c3 ?
h1 c3 c3 hc 1.4 3.0 0.0 9.0 # Generic: ? c3 c3 ?
h1 c3 c3 hc 1.4 3.0 0.0 9.0 # Generic: ? c3 c3 ?
h1 c3 c3 hc 1.4 3.0 0.0 9.0 # Generic: ? c3 c3 ?
h1 c3 c3 hc 1.4 3.0 0.0 9.0 # Generic: ? c3 c3 ?
h1 c3 c3 hc 1.4 3.0 0.0 9.0 # Generic: ? c3 c3 ?
h1 c3 c3 hc 1.4 3.0 0.0 9.0 # Generic: ? c3 c3 ?
h1 c3 os p5 0.217 3.0 0.0 1.0
ha ca ca ha 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ha ca ca ha 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ha ca ca no 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ha ca ca no 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ha ca ca os 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
ha ca ca os 14.5 2.0 180.0 4.0 # Generic: ? ca ca ?
hc c3 c3 os 0.25 1.0 0.0 1.0
hc c3 c3 os 0.0 3.0 0.0 1.0

Expand Down

0 comments on commit 4010c69

Please sign in to comment.