Skip to content

Commit

Permalink
Merges changes from master
Browse files Browse the repository at this point in the history
  • Loading branch information
ansobolev committed Mar 3, 2020
1 parent 6324a2f commit 257fe82
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
8 changes: 6 additions & 2 deletions aiida_crystal/io/f9.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
from scipy.io import FortranFile
from ase import Atoms
from aiida.common.exceptions import ParsingError
from aiida_crystal.utils.geometry import cart2frac


Expand All @@ -23,8 +24,11 @@ def __init__(self, file_name):
raise ValueError("Expected fort.9 as the file name, got {} instead".format(os.path.basename(file_name)))
self._geometry = None
# read arrays from file
with FortranFile(file_name) as f:
self._data = [f.read_record(rtype) for rtype in self._record_types]
try:
with FortranFile(file_name) as f:
self._data = [f.read_record(rtype) for rtype in self._record_types]
except TypeError:
raise ParsingError("Something is wrong with {} file, please check".format(file_name))

def _read_geometry(self):
"""Returns geometry from fort.9. All lengths are in Bohr. If scale=True, then convert positions to fractional.
Expand Down
31 changes: 17 additions & 14 deletions examples/test_MgO_MPDS.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

inputs = MPDSCrystalWorkchain.get_builder()
inputs.crystal_code = Code.get_from_string('Pcrystal@torquessh')
inputs.properties_code = Code.get_from_string('properties@torquessh')
# inputs.properties_code = Code.get_from_string('properties@torquessh')

inputs.crystal_parameters = DataFactory('dict')(dict={
"title": "Crystal calc",
Expand All @@ -33,15 +33,15 @@
}
}
})
inputs.properties_parameters = DataFactory('dict')(dict={
"band": {
"shrink": 8,
"k_points": 30,
},
"dos": {
"n_e": 100
}
})
# inputs.properties_parameters = DataFactory('dict')(dict={
# "band": {
# "shrink": 8,
# "k_points": 30,
# },
# "dos": {
# "n_e": 100
# }
# })

inputs.basis_family, _ = DataFactory('crystal.basis_family').get_or_create('MINIMAL')
inputs.mpds_query = DataFactory('dict')(dict={
Expand All @@ -52,10 +52,13 @@

inputs.options = DataFactory('dict')(dict={
'need_phonons': False,
'resources': {
'num_machines': 1,
'num_mpiprocs_per_machine': 2
}
'need_elastic_constants': False,
'need_electronic_properties': False,
'try_oxi_if_fails': True,
'resources': {
'num_machines': 1,
'num_mpiprocs_per_machine': 2
}
})
inputs.metadata = {"label": "MgO/225"}

Expand Down

0 comments on commit 257fe82

Please sign in to comment.