diff --git a/README.md b/README.md index b2dabd5..9db4f2a 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/charge/settings.py b/charge/settings.py index cd0d42c..ce4395b 100644 --- a/charge/settings.py +++ b/charge/settings.py @@ -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', diff --git a/doc/source/intro.rst b/doc/source/intro.rst index 40b5ec0..142e65c 100644 --- a/doc/source/intro.rst +++ b/doc/source/intro.rst @@ -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 ` module. +charge_assign offers several different possible charger methods, see the :mod:`charger ` module. To set a default repository location, set the REPO_LOCATION environment variable or add it to charge/settings.py. Batch Computations