Giter Club home page Giter Club logo

pycrystal's Introduction

CRYSTAL ab initio code utilities

DOI PyPI

CRYSTAL ab initio code with the LCAO Gaussian basis sets, by Turin university

Intro

The CRYSTAL is an ab initio solid state modeling suite employing the Gaussian basis sets in the LCAO framework. The pycrystal Python utilities are good for:

  • quick logs parsing, getting the maximum information, and presenting it in a systematic machine-readable way
  • preparing and handling the Gaussian LCAO basis sets, based on the EMSL and own CRYSTAL libraries

All the popular versions of the CRYSTAL code are supported (CRYSTAL03, CRYSTAL06, CRYSTAL09, CRYSTAL14, and CRYSTAL17).

The pycrystal was tested on about 20k in-house simulation logs for about 700 distinct materials systems, produced with the different CRYSTAL versions. Its development was initiated in 2009 by Maxim Losev at the quantum chemistry chair, chemistry dept. of St. Petersburg State University (Russia) under supervision of Professor Robert Evarestov.

Installation

pip install pycrystal

Usage

Parsing is done as follows:

import os, sys
from pprint import pprint

from pycrystal import CRYSTOUT

try:
    sys.argv[1] and os.path.exists(sys.argv[1])
except (IndexError, OSError):
    sys.exit("USAGE: <script> <file>")

assert CRYSTOUT.acceptable(sys.argv[1])
result = CRYSTOUT(sys.argv[1])
pprint(result.info)

Also, for any basis set taken from EMSL in Gaussian'94 format:

import os, sys

from pycrystal import parse_bs

try:
    sys.argv[1] and os.path.exists(sys.argv[1])
except (IndexError, OSError):
    sys.exit("USAGE: <script> <file>")

content = open(sys.argv[1]).read()
for atom in parse_bs(content):
    print(atom.crystal_input())

To deal with the CRYSTAL (University of Turin) online BS library:

from pycrystal import download_basis_library

library = download_basis_library()
print(library['Bi'])

Related work

There is another Python parser ejplugins for CRYSTAL14 and CRYSTAL17 by Chris Sewell (Imperial College London, UK). The comparison was done using cmp_unito_crystal_parsers.py script on the above-mentioned 20k logs, the results are as follows:

  • the final total energies and atomic structures are the same in more than 99% cases
  • pycrystal supports slightly more CRYSTAL features than ejplugins
  • pycrystal is more lightweight than ejplugins and has less dependencies
  • performance is nearly the same

pycrystal's People

Contributors

ansobolev avatar blokhin avatar jan-janssen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pycrystal's Issues

CVE-2021-34141 (Medium) detected in numpy-1.21.6-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

CVE-2021-34141 - Medium Severity Vulnerability

Vulnerable Library - numpy-1.21.6-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

NumPy is the fundamental package for array computing with Python.

Library home page: https://files.pythonhosted.org/packages/6d/ad/ff3b21ebfe79a4d25b4a4f8e5cf9fd44a204adb6b33c09010f566f51027a/numpy-1.21.6-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl

Path to dependency file: /requirements.txt

Path to vulnerable library: /requirements.txt,/requirements.txt

Dependency Hierarchy:

  • โŒ numpy-1.21.6-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (Vulnerable Library)

Found in HEAD commit: 65fd1d33fb4108677a14960e522f7ed781cbf4c9

Found in base branch: master

Vulnerability Details

An incomplete string comparison in the numpy.core component in NumPy before 1.22.0 allows attackers to trigger slightly incorrect copying by constructing specific string objects. NOTE: the vendor states that this reported code behavior is "completely harmless."
Mend Note: After conducting further research, Mend has determined that versions 1.12.0 through 1.21.6 of numpy are vulnerable to CVE-2021-34141

Publish Date: 2021-12-17

URL: CVE-2021-34141

CVSS 3 Score Details (5.3)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: None
    • Scope: Unchanged
  • Impact Metrics:
    • Confidentiality Impact: None
    • Integrity Impact: None
    • Availability Impact: Low

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Origin: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-34141

Release Date: 2021-12-17

Fix Resolution: 1.22.0


Step up your Open Source Security Game with Mend here

Phonon-related properties to be extracted

  • polarizability (alpha(re, im)), dielectric (epsilon(re, im)) and first-order electric susceptibility (chi(1)) tensors (independent components)

  • first hyperpolarizability (beta) and second electric susceptibility (chi(2)) tensors (independent components)

  • second hyperpolarizability (gamma) and third electric susceptibility (chi(3)) tensors

Elastcon parsing error

/root/.aiida/repository-default/repository/node/39/69/1198-d9f2-48df-815a-3a85a640a599/path/_scheduler-stderr.txt unexpected CRYSTOUT parser error in /root/.aiida/repository-default/repository/node/39/69/1198-d9f2-48df-815a-3a85a640a599/path/_scheduler-stderr.txt:
 Traceback (most recent call last):
  File "/root/tilde/tilde/core/api.py", line 280, in _parse
    for calc in self.Parsers[parser_name].iparse(parsable):
  File "/root/tilde/tilde/parsers/__init__.py", line 117, in iparse
    return [cls(filename)]
  File "/root/tilde/tilde/parsers/CRYSTAL/CRYSTAL.py", line 17, in __init__
    result = _CRYSTOUT(filename)
  File "/usr/local/lib/python3.5/dist-packages/pycrystal/output.py", line 283, in __init__
    self.info['elastic']['elastic_moduli'] = self.get_elastic('elastic_moduli')
  File "/usr/local/lib/python3.5/dist-packages/pycrystal/output.py", line 785, in get_elastic
    constants[-1].append(float(ec))
ValueError: could not convert string to float: '178.7547-193.8748'

Skipped conversion to eV?

# dealing with Fermi energies
state_dict['e_fermi'] = float(self.patterns['e_fermi'].search(self.data).groups()[0])
state_dict['e_fermi_units'] = 'Ha'

* Hartree ?

CVE-2019-6446 High Severity Vulnerability detected by WhiteSource

CVE-2019-6446 - High Severity Vulnerability

Vulnerable Library - numpy-1.16.1-cp35-cp35m-manylinux1_x86_64.whl

NumPy is the fundamental package for array computing with Python.

path: /tmp/git/pycrystal/requirements.txt,/tmp/git/pycrystal

Library home page: https://files.pythonhosted.org/packages/ad/15/690c13ae714e156491392cdbdbf41b485d23c285aa698239a67f7cfc9e0a/numpy-1.16.1-cp35-cp35m-manylinux1_x86_64.whl

Dependency Hierarchy:

  • ase-3.16.2-py3-none-any.whl (Root Library)
    • โŒ numpy-1.16.1-cp35-cp35m-manylinux1_x86_64.whl (Vulnerable Library)

Vulnerability Details

An issue was discovered in NumPy 1.16.0 and earlier. It uses the pickle Python module unsafely, which allows remote attackers to execute arbitrary code via a crafted serialized object, as demonstrated by a numpy.load call.

Publish Date: 2019-01-16

URL: CVE-2019-6446

CVSS 3 Score Details (9.8)

Base Score Metrics:

  • Exploitability Metrics:
    • Attack Vector: Network
    • Attack Complexity: Low
    • Privileges Required: None
    • User Interaction: None
    • Scope: Unchanged
  • Impact Metrics:
    • Confidentiality Impact: High
    • Integrity Impact: High
    • Availability Impact: High

For more information on CVSS3 Scores, click here.


Step up your Open Source Security Game with WhiteSource here

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.