Skip to content

Commit

Permalink
Added min python version to readme and README.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
connorourke committed Jan 30, 2019
2 parents f02f40a + e704329 commit 08b86ed
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ crystal_torture/devel
*.swp
*pyc
crystal_torture/.f2py_f2cmap
crystal_torture/_tort*
check_run.py
check_doping.py
*/*so
Expand All @@ -24,7 +25,6 @@ build/*
docs/build/*
MANIFEST
README.rst
README.txt
.idea/
.DS_Store
paper/apa.csl
Expand Down
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ python:
- "3.5-dev"
- "3.6"
- "3.6-dev"
matrix:
include:
- python: 3.7
dist: xenial
sudo: true
os:
- linux

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Build Status](https://travis-ci.com/connorourke/crystal_torture.svg?token=nTMqYYEUasQRTBsU6oCc&branch=master)](https://travis-ci.com/connorourke/crystal_torture)
[![Coverage Status](https://coveralls.io/repos/github/connorourke/crystal_torture/badge.svg?branch=master)](https://coveralls.io/github/connorourke/crystal_torture?branch=master)
[![Documentation Status](https://readthedocs.org/projects/crystal-torture/badge/?version=latest)](https://crystal-torture.readthedocs.io/en/latest/?badge=latest)
[![Python 3.6+](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)

### **crystal_torture:**
`crystal_torture` is a Python, Fortran and OpenMP crystal structure analysis module. The module contains a set of classes
Expand All @@ -16,11 +17,13 @@ that enable:

## Installation

`crystal_torture` requires python 3.5 and above. To install do:

```
pip install crystal_torture
```

or download directly from [GitHub](https://github.com/connorourke/crystal_torture/archive/v1.0.0.tar.gz), or clone:
or download directly from [GitHub](https://github.com/connorourke/crystal_torture/releases/latest), or clone:

```
git clone https://github.com/connorourke/crystal_torture
Expand Down
67 changes: 67 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
|Build Status| |Coverage Status|

**crystal\_torture:**
~~~~~~~~~~~~~~~~~~~~~

``crystal_torture`` is a Python, Fortran and OpenMP crystal structure
analysis module. The module contains a set of classes that enable:

- a crystal structure to be converted into a graph for network analysis
- connected clusters of crystal sites (nodes) to be retrieved and
output
- periodicity of connected clusters of crystal sites to be determined
- relative path tortuosity to traverse a crystal within a connected
cluster to be calculated for each site

Installation
------------

`crystal_torture` requires python 3.5 and above. To install do:

::

pip install crystal_torture

or download directly from
`GitHub <http://github.com/connorourke/crystal_torture/releases>`__, or
clone:

::

git clone https://github.com/connorourke/crystal_torture

and install

::

cd crystal_torture
python setup.py install

Tests
-----

``crystal_torture`` is automatically tested on each commit
`here <http://travis-ci.org/connorourke/crystal_torture>`__, but the
tests can be manually run:

::

python -m unittest discover

Examples
--------

Examples on how to use ``crystal_torture`` can be found in a Jupyter
notebook in the ``examples`` directory
`crystal\_torture\_examples.ipynb <http://nbviewer.jupyter.org/github/connorourke/crystal_torture/blob/master/examples/crystal_torture_examples.ipynb>`__

Documentation
-------------

Documentation can be found
`here <https://crystal-torture.readthedocs.io/en/latest/>`__

.. |Build Status| image:: https://travis-ci.com/connorourke/crystal_torture.svg?token=nTMqYYEUasQRTBsU6oCc&branch=master
:target: https://travis-ci.com/connorourke/crystal_torture
.. |Coverage Status| image:: https://coveralls.io/repos/github/connorourke/crystal_torture/badge.svg?branch=master
:target: https://coveralls.io/github/connorourke/crystal_torture?branch=master
Binary file removed crystal_torture/tort_mod.mod
Binary file not shown.
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ddt
coverage
numpy
pymatgen
ddt
numpy>=1.15.4
f90wrap
pymatgen
44 changes: 21 additions & 23 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ def setup_tort_ext(args,parent_package='',top_path=''):
tort_src = [join('crystal_torture/','tort.f90')]

config.add_library('_tort', sources=tort_src,
extra_f90_compile_args = [ args["compile_args"]],
extra_link_args=[args["link_args"]])
extra_f90_compile_args = args["compile_args"],
extra_link_args=args["link_args"])

sources = [join('crystal_torture','f90wrap_tort.f90')]

config.add_extension(name='_tort',
sources=sources,
extra_f90_compile_args = [ args["compile_args"]],
extra_link_args=[args["link_args"]],
extra_f90_compile_args = args["compile_args"],
extra_link_args=args["link_args"],
libraries=['_tort'],
include_dirs=['build/temp.' + return_include_dir()])

dist_src = [join('crystal_torture/','dist.f90')]
config.add_extension(name='dist',
sources=dist_src,
extra_f90_compile_args = [ args["compile_args"]],
extra_link_args=[args["link_args"]])
extra_f90_compile_args = args["compile_args"],
extra_link_args=args["link_args"])


return config
Expand All @@ -48,34 +48,32 @@ def check_compiler_gnu():

def check_f2py_compiler():

result = subprocess.check_output('f2py3 -c --help-fcompiler | grep -A 1 \'Fortran compilers found\' ',shell=True)
print(result)
result = subprocess.check_output('f2py -c --help-fcompiler | grep -A 1 \'Fortran compilers found\' ',shell=True)

if not check_compiler_gnu():
print(' GNU compiler not installed. Checking f2py comompiler - this is UNTESTED' )
print(' Speculatively setting flags - if compile fails, or OpenMP doesn\'t work install gfortran and retry')


if 'GNU' in str(result):
print('Found gnu compiler. Setting OpenMP flag to \'-fopenmp\'')
compile_args = '-fopenmp -lgomp -O3'
link_args = '-lgomp'
compile_args = ['-fopenmp', '-lgomp', '-O3']
link_args = ['-lgomp']
elif 'Intel' in str(result):
print('Found intel compiler. Setting OpenMP flag to \'-openmp\'')
compile_args = '-openmp -O3'
link_args = ''
compile_args = ['-openmp', '-O3']
link_args = []
elif 'Portland' in str(result):
print('Found portland compiler. Setting OpenMP flag to \'-mp\'')
compile_args = '-mp -O3'
link_args = ''
compile_args = ['-mp', '-O3']
link_args = []
elif 'NAG' in str(result):
print('Found NAG compiler. Setting OpenMP flag to \'-openmp\'')
compile_args = '-openmp -O3'
link_args = ''
compile_args = ['-openmp', '-O3']
link_args = []
else:
print('Not sure what compiler f2py uses. Speculatively setting OpenMP flag to \'-openmp\'')
compile_args = '-openmp -O3'
link_args = ''
compile_args = ['-openmp', '-O3']
link_args = []

args = {'link_args':link_args,'compile_args':compile_args}

Expand Down Expand Up @@ -122,19 +120,19 @@ def read(fname):
from numpy.distutils.core import setup

exec(open('crystal_torture/version.py').read())

args = check_f2py_compiler()

config = {'name':'CrystalTorture',
'version':__version__,
'project_description':'A Crystal Tortuosity Module',
'description':'A Crystal Tortuosity Module',
'long_description': open('README.md').read(),
'long_description': open('README.txt').read(),
'long_description_content_type':'text/markdown',
'author':'Conn O\'Rourke',
'author_email':'conn.orourke@gmail.com',
'url':'https://github.com/connorourke/crystaltorture',
'python_requires':'>=3.3',
'python_requires':'>=3.5',
'packages':['crystal_torture'],
'package_dir':{'crystal_torture':'crystal_torture'},
'package_data':{'crystal_torture':['*so','*tort*','*dist*','*o*']},
Expand All @@ -143,7 +141,7 @@ def read(fname):
'install_requires': ['ddt',
'coverage',
'f90wrap',
'numpy',
'numpy>=1.15.4',
'pymatgen'
]
}
Expand Down

0 comments on commit 08b86ed

Please sign in to comment.