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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This project is archived. Its data is
read-only
.
Show more breadcrumbs
nomad-lab
parser-gaussian
Commits
db28c8d7
Commit
db28c8d7
authored
Mar 15, 2016
by
Rosendo Valero Montero
Browse files
Options
Downloads
Patches
Plain Diff
Update of element labels and geometry parsing
parent
9a8ce92e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
parser/parser-gaussian/parser_gaussian.py
+23
-10
23 additions, 10 deletions
parser/parser-gaussian/parser_gaussian.py
with
23 additions
and
10 deletions
parser/parser-gaussian/parser_gaussian.py
+
23
−
10
View file @
db28c8d7
...
...
@@ -34,18 +34,28 @@ mainFileDescription = SM(
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*%[Nn][Pp]roc=(?P<gaussian_number_of_processors>[A-Za-z0-9.]*)
"
)
]
),
SM
(
name
=
'
geometry_
charge_multiplicity
'
,
sections
=
[
'
section_system_description
'
,
'
gaussian_section_
geometry
'
],
SM
(
name
=
'
charge_multiplicity
'
,
sections
=
[
'
section_system_description
'
,
'
gaussian_section_
labels
'
],
startReStr
=
r
"
\s*Symbolic Z-matrix:
"
,
subMatchers
=
[
SM
(
r
"
\s*Charge =\s*(?P<total_charge>[-+0-9]+) Multiplicity =\s*(?P<target_multiplicity>[0-9]+)
"
),
SM
(
r
"
\s*(?P<gaussian_atom_label>\w+)\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*NAtoms=
"
)
SM
(
r
"
\s*(?P<gaussian_atom_label>\D{1,2}?(?=\s*[0-9,-]))
"
,
repeats
=
True
),
SM
(
r
"
\s*(?P<gaussian_atom_label>\w{1,2}(?=\s))
"
,
repeats
=
True
),
SM
(
r
"
\s*Variables:|\s*NAtoms=|\s*Z-MATRIX
"
),
SM
(
r
"
\s*
"
),
]
),
SM
(
name
=
'
geometry
'
,
sections
=
[
'
section_system_description
'
,
'
gaussian_section_geometry
'
],
startReStr
=
r
"
\s*Z-Matrix orientation:|\s*Input orientation:|\s*Standard orientation:
"
,
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*Symmetry|\s*Stoichiometry
"
)
])
])
...
...
@@ -66,22 +76,24 @@ 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
"
]
logging
.
error
(
"
labels:%s
"
,
labels
)
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
"
]
labels
=
section
[
"
gaussian_atom_label
"
]
logging
.
error
(
"
x:%s
"
,
xCoord
)
logging
.
error
(
"
y:%s
"
,
yCoord
)
logging
.
error
(
"
z:%s
"
,
zCoord
)
logging
.
error
(
"
labels:%s
"
,
labels
)
atom_positions
=
np
.
zeros
((
len
(
xCoord
),
3
),
dtype
=
float
)
for
i
in
range
(
len
(
xCoord
)):
atom_positions
[
i
,
0
]
=
xCoord
[
i
]
atom_positions
[
i
,
1
]
=
yCoord
[
i
]
atom_positions
[
i
,
2
]
=
zCoord
[
i
]
backend
.
addArrayValues
(
"
atom_position
"
,
atom_positions
)
backend
.
addValue
(
"
atom_label
"
,
labels
)
# which values to cache or forward (mapping meta name -> CachingLevel)
cachingLevelForMetaName
=
{
...
...
@@ -90,6 +102,7 @@ cachingLevelForMetaName = {
"
gaussian_atom_z_coord
"
:
CachingLevel
.
Cache
,
"
gaussian_atom_label
"
:
CachingLevel
.
Cache
,
"
gaussian_section_geometry
"
:
CachingLevel
.
Ignore
,
"
gaussian_section_labels
"
:
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
sign in
to comment