Skip to content

Commit

Permalink
Move data files from quickff/share to quickff/quickff/data and use pa…
Browse files Browse the repository at this point in the history
…th routine from importlib.resources
  • Loading branch information
lvduyfhu committed Sep 26, 2019
1 parent c7429ca commit c6e356d
Show file tree
Hide file tree
Showing 53 changed files with 147 additions and 858 deletions.
2 changes: 1 addition & 1 deletion HEADER
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
QuickFF is a code to quickly derive accurate force fields from ab initio input.
Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
Steven Vandenbrande <[email protected]>,
Jelle Wieme <[email protected]>,
Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include README
include LICENSE
include quickff/data/*
include quickff/data/systems/*.*
include quickff/data/systems/*/*.*
Binary file removed doc/atypes_high.png
Binary file not shown.
Binary file removed doc/atypes_medium.png
Binary file not shown.
Binary file removed doc/quickff_logo.png
Binary file not shown.
Binary file removed doc/quickff_logo_trans_small.png
Binary file not shown.
Binary file removed doc/toc1.png
Binary file not shown.
Binary file removed doc/toc2.png
Binary file not shown.
2 changes: 1 addition & 1 deletion quickff/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand Down
77 changes: 0 additions & 77 deletions quickff/context.py

This file was deleted.

2 changes: 1 addition & 1 deletion quickff/cost.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand Down
25 changes: 25 additions & 0 deletions quickff/data/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
# (CMM), Ghent University, Ghent, Belgium; all rights reserved unless otherwise
# stated.
#
# This file is part of QuickFF.
#
# QuickFF is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# QuickFF is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>
#
#--
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion quickff/io.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand Down
2 changes: 1 addition & 1 deletion quickff/log.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand Down
2 changes: 1 addition & 1 deletion quickff/paracontext.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand Down
2 changes: 1 addition & 1 deletion quickff/perturbation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand Down
2 changes: 1 addition & 1 deletion quickff/program.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand Down
2 changes: 1 addition & 1 deletion quickff/reference.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand Down
2 changes: 1 addition & 1 deletion quickff/scripts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand Down
14 changes: 10 additions & 4 deletions quickff/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand Down Expand Up @@ -30,6 +30,12 @@
from molmod.units import parse_unit
import os

try:
from importlib.resources import path
except ImportError:
from importlib_resources import path


__all__ = ['Settings']

def is_not_none(key, value):
Expand Down Expand Up @@ -158,10 +164,10 @@ def __init__(self, fn=None, **kwargs):
'''
#first read general RC settings from .quickffrc file
from .context import context
self.read_config_file(context.get_fn('quickffrc'))
with path('quickff.data', 'quickffrc') as fn_default:
self.read_config_file(fn_default)
#if a config file is provided, read settings from this file and
#overwrite the general RC settings
#overwrite the default RC settings
if fn is not None:
self.read_config_file(fn)
#if settings are defined through keyword arguments to this init
Expand Down
25 changes: 25 additions & 0 deletions quickff/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
# (CMM), Ghent University, Ghent, Belgium; all rights reserved unless otherwise
# stated.
#
# This file is part of QuickFF.
#
# QuickFF is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# QuickFF is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>
#
#--
22 changes: 16 additions & 6 deletions quickff/tests/common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand Down Expand Up @@ -33,7 +33,6 @@

from quickff.io import read_abinitio

from quickff.context import context
from quickff.io import read_abinitio
from quickff.reference import SecondOrderTaylor
from quickff.valence import ValenceFF
Expand All @@ -43,15 +42,26 @@
from quickff.log import log
log.set_level('silent')

try:
from importlib.resources import path
except ImportError:
from importlib_resources import path


__all__ = ['log', 'read_system', 'tmpdir']

def read_system(name):
# Load system data.
fn = context.get_fn(os.path.join('systems', name))
numbers, coords, energy, grad, hess, masses, rvecs, pbc = read_abinitio(fn)
# Load system data
dn = 'quickff.data.systems'
if '/' in name:
words = name.split('/')
dn += '.%s' %('.'.join(words[:-1]))
name = words[-1]
with path(dn, name) as fn:
numbers, coords, energy, grad, hess, masses, rvecs, pbc = read_abinitio(fn)
fns_wpart = glob(os.path.join(os.path.dirname(fn), 'gaussian_mbis.h5'))
# Try to load charges.
charges = None
fns_wpart = glob(os.path.join(os.path.dirname(fn), 'gaussian_mbis.h5'))
if len(fns_wpart) > 0:
with h5.File(fns_wpart[0], 'r') as f:
charges = f['charges'][:]
Expand Down
16 changes: 10 additions & 6 deletions quickff/tests/test_examples.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand Down Expand Up @@ -35,10 +35,15 @@
from quickff.tools import set_ffatypes
from quickff.program import DeriveFF
from quickff.settings import Settings
from quickff.context import context
from quickff.reference import SecondOrderTaylor

from common import log, read_system, tmpdir
from .common import log, read_system, tmpdir

try:
from importlib.resources import path
except ImportError:
from importlib_resources import path


def test_h2():
#frequency of H2 stretch mode in gaussian.fchk calculation is 4416.656/cm
Expand Down Expand Up @@ -199,8 +204,8 @@ def test_uio66zrbrick_crossterms():
# Load input data for a ficticious system of an isolated
# UiO-66 brick
name = 'uio66-zr-brick/system.chk'
fn = context.get_fn(os.path.join('systems', name))
data = load_chk(fn)
with path(quickff.data.systems, name) as fn:
data = load_chk(fn)
system = System(data['numbers'],data['pos'],charges=data['charges'],
ffatypes=data['ffatypes'],bonds=data['bonds'],radii=data['radii'])
system.set_standard_masses()
Expand All @@ -224,4 +229,3 @@ def test_uio66zrbrick_crossterms():
fc_diag = program.valence.get_params(term.diag_term_indexes[i], only='fc')
print("%50s %15.6f %15.6f %50s" % (term.basename,fc,fc_diag,program.valence.terms[term.diag_term_indexes[i]].basename))
if fc_diag==0.0: assert fc==0.0

4 changes: 2 additions & 2 deletions quickff/tests/test_reference.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand All @@ -25,7 +25,7 @@
#--
from molmod.units import angstrom, kjmol

from common import log, read_system
from .common import log, read_system

from nose import SkipTest

Expand Down
4 changes: 2 additions & 2 deletions quickff/tests/test_valence.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand Down Expand Up @@ -32,7 +32,7 @@

from itertools import permutations

from common import log, read_system
from .common import log, read_system

import numpy as np

Expand Down
2 changes: 1 addition & 1 deletion quickff/tools.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand Down
2 changes: 1 addition & 1 deletion quickff/valence.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# QuickFF is a code to quickly derive accurate force fields from ab initio input.
# Copyright (C) 2012 - 2018 Louis Vanduyfhuys <[email protected]>
# Copyright (C) 2012 - 2019 Louis Vanduyfhuys <[email protected]>
# Steven Vandenbrande <[email protected]>,
# Jelle Wieme <[email protected]>,
# Toon Verstraelen <[email protected]>, Center for Molecular Modeling
Expand Down
Loading

0 comments on commit c6e356d

Please sign in to comment.