Skip to content

Commit

Permalink
env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
enitram committed Oct 31, 2018
1 parent b40ced1 commit 789ae48
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 9 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ sudo yum install rdkit

Installation instructions for nauty are available on the [Nauty
homepage](http://pallini.di.uniroma1.it/). You will have to either add its
directory to your PATH variable, or add the location of the dreadnaut program
directory to your PATH variable, set the NAUTY_EXC environment variable to
the directory, or add the location of the dreadnaut program
to charge/settings.py.

Next, we can make a virtual environment and install charge_assign and its
Expand Down
39 changes: 32 additions & 7 deletions charge/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,49 @@

import os

for path in os.environ["PATH"].split(os.pathsep):
path = path.strip('"')
fpath = os.path.join(path, 'dreadnaut')
NAUTY_EXC = None
"""Location of the dreadnaut executable."""

if 'NAUTY_EXC' in os.environ:
fpath = os.path.join(os.environ['NAUTY_EXC'], 'dreadnaut')
if os.path.isfile(fpath) and os.access(fpath, os.X_OK):
NAUTY_EXC = fpath
break
else:
NAUTY_EXC = os.path.expanduser('~/workspace/nauty26r7/dreadnaut')

if not NAUTY_EXC:
for path in os.environ["PATH"].split(os.pathsep):
path = path.strip('"')
fpath = os.path.join(path, 'dreadnaut')
if os.path.isfile(fpath) and os.access(fpath, os.X_OK):
NAUTY_EXC = fpath
break
else:
raise Exception('Could not find nauty executable.')

ILP_SOLVER_MAX_SECONDS = 60
"""Time limit for the ILP solver in seconds."""

DEFAULT_TOTAL_CHARGE = 0
"""Default target total charge."""

DEFAULT_TOTAL_CHARGE_DIFF = 0.01
"""Default allowed deviation from target total charge."""

MAX_BINS = 25
"""Maximal number of bins for the histogram calculations."""

ROUNDING_DIGITS = 3
"""Default number of digits after the decimal point for the assigned charges."""

MAX_ROUNDING_DIGITS = 9
"""Maximal number of digits after the decimal point for the assigned charges."""

REPO_LOCATION=None
"""Default repository location."""

REPO_LOCATION='atb_0_3.zip'
if 'REPO_LOCATION' in os.environ:
fpath = os.environ['REPO_LOCATION']
if os.path.isfile(fpath) and os.access(fpath, os.R_OK):
REPO_LOCATION = fpath

IACM_MAP = {
'O': 'O', 'OM': 'O', 'OA': 'O', 'OE': 'O', 'OW': 'O', 'N': 'N',
Expand Down
2 changes: 1 addition & 1 deletion doc/source/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Once you have obtained a repository, the basic usage of charge_assign is simple
for u, data in mol.nodes(data=True):
print(u, data['partial_charge_redist'])

charge_assign offers several different possible charger methods, see the :mod:`charger <charge.chargers>` module.
charge_assign offers several different possible charger methods, see the :mod:`charger <charge.chargers>` module. To set a default repository location, set the REPO_LOCATION environment variable or add it to charge/settings.py.


Batch Computations
Expand Down

0 comments on commit 789ae48

Please sign in to comment.