Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
parser-gaussian
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nomad-lab
parser-gaussian
Commits
6994bd4b
"tests/git@gitlab.mpcdf.mpg.de:nomad-lab/nomad-FAIR.git" did not exist on "1e8082c62541a9876fd49172bd1dc2ac33dba580"
Commit
6994bd4b
authored
9 years ago
by
Rosendo Valero Montero
Browse files
Options
Downloads
Patches
Plain Diff
Simplified version of parser
parent
55aece61
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
parser/parser-gaussian/parser_gaussian.py
+28
-34
28 additions, 34 deletions
parser/parser-gaussian/parser_gaussian.py
with
28 additions
and
34 deletions
parser/parser-gaussian/parser_gaussian.py
+
28
−
34
View file @
6994bd4b
...
...
@@ -4,6 +4,7 @@ from nomadcore.local_meta_info import loadJsonFile, InfoKindEl
from
nomadcore.caching_backend
import
CachingLevel
import
os
,
sys
,
json
,
logging
import
numpy
as
np
import
ase
# description of the output
mainFileDescription
=
SM
(
...
...
@@ -33,38 +34,29 @@ mainFileDescription = SM(
subFlags
=
SM
.
SubFlags
.
Unordered
,
forwardMatch
=
True
,
subMatchers
=
[
SM
(
r
"
\s*%[Cc]hk=(?P<gaussian_chk_file>[A-Za-z0-9.]*)
"
),
SM
(
r
"
\s*%[Mm]em=(?P<gaussian_memory>[A-Za-z0-9.]*)
"
),
SM
(
r
"
\s*%[Nn][Pp]roc=(?P<gaussian_number_of_processors>[A-Za-z0-9.]*)
"
)
SM
(
r
"
\s*%[Cc]hk=(?P<
x_
gaussian_chk_file>[A-Za-z0-9.]*)
"
),
SM
(
r
"
\s*%[Mm]em=(?P<
x_
gaussian_memory>[A-Za-z0-9.]*)
"
),
SM
(
r
"
\s*%[Nn][Pp]roc=(?P<
x_
gaussian_number_of_processors>[A-Za-z0-9.]*)
"
)
]
),
SM
(
name
=
'
charge_multiplicity
'
,
sections
=
[
'
section_system_description
'
,
'
gaussian_section_
labels
'
],
sections
=
[
'
section_system_description
'
,
'
x_
gaussian_section_
chargemult
'
],
startReStr
=
r
"
\s*Charge =
"
,
subFlags
=
SM
.
SubFlags
.
Sequenced
,
forwardMatch
=
True
,
subMatchers
=
[
SM
(
r
"
\s*Charge =\s*(?P<total_charge>[-+0-9]+) Multiplicity =\s*(?P<target_multiplicity>[0-9]+)
"
),
SM
(
r
"
\sModel
"
),
SM
(
r
"
\sShort
"
),
SM
(
r
"
\s*Atom
"
),
SM
(
r
"
\s*\d\d?\d?\s{7,8}?[A-Za-z-]
"
,
repeats
=
True
),
SM
(
r
"
\s*Generated
"
),
SM
(
r
"
\sNo Z-Matrix found in file|\sZ-Matrix found in file
"
),
SM
(
r
"
\sRedundant internal coordinates found in file
"
),
SM
(
r
"
\s*(?P<gaussian_atom_label>([A-Za-z][A-Za-z]|[A-WYZa-wyz]|\d\d?\d?))[^A-Za-z]
"
,
repeats
=
True
),
SM
(
r
"
\sRecover connectivity data from disk.
"
),
SM
(
r
"
\s*Variables:|\s*------|\s*\r?\n
"
)
]
SM
(
r
"
\s*Charge =\s*(?P<total_charge>[-+0-9]+) Multiplicity =\s*(?P<target_multiplicity>[0-9]+)
"
),
]
),
SM
(
name
=
'
geometry
'
,
sections
=
[
'
section_system_description
'
,
'
gaussian_section_geometry
'
],
startReStr
=
r
"
\s*Z-Matrix orientation:|\s*Input orientation:|\s*Standard orientation:
"
,
sections
=
[
'
section_system_description
'
,
'
x_gaussian_section_geometry
'
],
startReStr
=
r
"
\s*Input orientation:|\s*Z-Matrix orientation:|\s*Standard orientation:
"
,
subFlags
=
SM
.
SubFlags
.
Sequenced
,
subMatchers
=
[
SM
(
r
"
\s+[0-9]+\s+[0-9]+\s+[0-9]+\s+(?P<gaussian_atom_x_coord__angstrom>[-+0-9EeDd.]+)\s+(?P<gaussian_atom_y_coord__angstrom>[-+0-9EeDd.]+)\s+(?P<gaussian_atom_z_coord__angstrom>[-+0-9EeDd.]+)
"
,
repeats
=
True
)
SM
(
r
"
\s+[0-9]+\s+(?P<x_gaussian_atomic_number>[0-9]+)\s+[0-9]+\s+(?P<x_gaussian_atom_x_coord__angstrom>[-+0-9EeDd.]+)\s+(?P<x_gaussian_atom_y_coord__angstrom>[-+0-9EeDd.]+)\s+(?P<x_gaussian_atom_z_coord__angstrom>[-+0-9EeDd.]+)
"
,
repeats
=
True
),
SM
(
r
"
\s*Distance matrix|\s*Rotational constants|\s*Stoichiometry
"
)
]
),
SM
(
r
"
\s*Symmetry|\s*Stoichiometry
"
)
])
])
...
...
@@ -85,29 +77,31 @@ class GaussianParserContext(object):
def
startedParsing
(
self
,
path
,
parser
):
self
.
parser
=
parser
def
onClose_gaussian_section_labels
(
self
,
backend
,
gIndex
,
section
):
labels
=
section
[
"
gaussian_atom_label
"
]
backend
.
addValue
(
"
atom_label
"
,
labels
)
def
onClose_gaussian_section_geometry
(
self
,
backend
,
gIndex
,
section
):
xCoord
=
section
[
"
gaussian_atom_x_coord
"
]
yCoord
=
section
[
"
gaussian_atom_y_coord
"
]
zCoord
=
section
[
"
gaussian_atom_z_coord
"
]
def
onClose_x_gaussian_section_geometry
(
self
,
backend
,
gIndex
,
section
):
xCoord
=
section
[
"
x_gaussian_atom_x_coord
"
]
yCoord
=
section
[
"
x_gaussian_atom_y_coord
"
]
zCoord
=
section
[
"
x_gaussian_atom_z_coord
"
]
numbers
=
section
[
"
x_gaussian_atomic_number
"
]
atom_positions
=
np
.
zeros
((
len
(
xCoord
),
3
),
dtype
=
float
)
atom_numbers
=
np
.
zeros
(
len
(
xCoord
),
dtype
=
int
)
atomic_symbols
=
np
.
empty
((
len
(
xCoord
)),
dtype
=
object
)
for
i
in
range
(
len
(
xCoord
)):
atom_positions
[
i
,
0
]
=
xCoord
[
i
]
atom_positions
[
i
,
1
]
=
yCoord
[
i
]
atom_positions
[
i
,
2
]
=
zCoord
[
i
]
for
i
in
range
(
len
(
xCoord
)):
atom_numbers
[
i
]
=
numbers
[
i
]
atomic_symbols
[
i
]
=
ase
.
data
.
chemical_symbols
[
atom_numbers
[
i
]]
backend
.
addArrayValues
(
"
atom_position
"
,
atom_positions
)
backend
.
addArrayValues
(
"
atom_label
"
,
atomic_symbols
)
# which values to cache or forward (mapping meta name -> CachingLevel)
cachingLevelForMetaName
=
{
"
gaussian_atom_x_coord
"
:
CachingLevel
.
Cache
,
"
gaussian_atom_y_coord
"
:
CachingLevel
.
Cache
,
"
gaussian_atom_z_coord
"
:
CachingLevel
.
Cache
,
"
gaussian_atom_label
"
:
CachingLevel
.
Cache
,
"
gaussian_section_geometry
"
:
CachingLevel
.
Ignore
,
"
gaussian_section_labels
"
:
CachingLevel
.
Ignore
,
"
x_gaussian_atom_x_coord
"
:
CachingLevel
.
Cache
,
"
x_gaussian_atom_y_coord
"
:
CachingLevel
.
Cache
,
"
x_gaussian_atom_z_coord
"
:
CachingLevel
.
Cache
,
"
x_gaussian_atomic_number
"
:
CachingLevel
.
Cache
,
"
x_gaussian_section_geometry
"
:
CachingLevel
.
Ignore
,
}
if
__name__
==
"
__main__
"
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment