Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pycgtool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
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
Show more breadcrumbs
James Graham
pycgtool
Commits
fcbb23a1
Commit
fcbb23a1
authored
9 years ago
by
James Graham
Browse files
Options
Downloads
Patches
Plain Diff
Add optional constraint conversion to sanitize.py
parent
144af6f4
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
sanitize.py
+32
-1
32 additions, 1 deletion
sanitize.py
with
32 additions
and
1 deletion
sanitize.py
+
32
−
1
View file @
fcbb23a1
...
...
@@ -10,24 +10,55 @@ def main(args):
"
dihedrals
"
:
8
,
"
constraints
"
:
4
,
"
pairs
"
:
-
1
}
has_constr
=
False
constr_lines
=
[]
for
line
in
infile
:
line
=
line
.
strip
(
"
\n
"
)
if
line
.
startswith
(
"
[
"
):
section
=
line
.
strip
(
"
[ ]
"
)
if
args
.
fc
is
not
None
and
section
==
"
constraints
"
:
print
(
line
,
file
=
outfile
)
has_constr
=
True
for
c_line
in
constr_lines
:
print
(
c_line
,
file
=
outfile
)
continue
if
section
==
"
system
"
and
not
has_constr
and
constr_lines
:
print
(
"
[ constraints ]
"
,
file
=
outfile
)
for
c_line
in
constr_lines
:
print
(
c_line
,
file
=
outfile
)
print
(
file
=
outfile
)
print
(
line
,
file
=
outfile
)
continue
elif
line
.
startswith
(
"
#
"
)
or
line
.
startswith
(
"
;
"
)
or
line
==
""
:
pass
print
(
line
,
file
=
outfile
)
continue
elif
len
(
line
.
split
())
<
expected_toks
.
get
(
section
,
0
):
continue
elif
expected_toks
.
get
(
section
,
0
)
<
0
:
continue
# Convert high force constants to constraints
if
args
.
fc
is
not
None
and
section
==
"
bonds
"
and
float
(
line
.
split
()[
4
])
>=
args
.
fc
:
constr_lines
.
append
(
line
[:
line
.
rindex
(
line
.
split
()[
4
])
-
1
])
continue
if
args
.
fc
is
not
None
and
section
==
"
constraints
"
:
print
(
line
,
file
=
outfile
)
if
__name__
==
"
__main__
"
:
parser
=
argparse
.
ArgumentParser
(
description
=
"
Sanitize PDB2GMX output topology.
"
)
parser
.
add_argument
(
'
-i
'
,
type
=
str
,
required
=
True
,
help
=
"
Input topology file
"
)
parser
.
add_argument
(
'
-o
'
,
type
=
str
,
required
=
True
,
help
=
"
Output topology file
"
)
parser
.
add_argument
(
'
-fc
'
,
type
=
float
,
default
=
None
,
help
=
"
Convert high force constants to constraints
"
)
args
=
parser
.
parse_args
()
...
...
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