Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Kaymak, Cagri
PuReMD
Commits
eeee8cfd
Commit
eeee8cfd
authored
Jun 24, 2019
by
Kaymak, Cagri
Browse files
Update geo_tools.c
parent
d83a0311
Changes
1
Hide whitespace changes
Inline
Side-by-side
sPuReMD/src/geo_tools.c
View file @
eeee8cfd
...
...
@@ -487,8 +487,13 @@ void Read_BGF( const char * const bgf_file, reax_system* system, control_params
char
element
[
6
],
charge
[
9
];
char
chain_id
;
char
s_a
[
12
],
s_b
[
12
],
s_c
[
12
],
s_alpha
[
12
],
s_beta
[
12
],
s_gamma
[
12
];
char
*
endptr
=
NULL
;
int
i
,
atom_cnt
,
token_cnt
,
bgf_serial
,
ratom
=
0
;
char
*
endptr
;
int
i
,
atom_cnt
,
token_cnt
,
bgf_serial
,
ratom
,
crystx_found
;
endptr
=
NULL
;
ratom
=
0
;
crystx_found
=
FALSE
;
/* open biograf file */
bgf
=
sfopen
(
bgf_file
,
"r"
);
...
...
@@ -512,8 +517,9 @@ void Read_BGF( const char * const bgf_file, reax_system* system, control_params
tokens
[
0
][
0
]
=
0
;
token_cnt
=
Tokenize
(
line
,
&
tokens
,
MAX_TOKEN_LEN
);
if
(
!
strncmp
(
tokens
[
0
],
"ATOM"
,
MAX_TOKEN_LEN
)
||
!
strncmp
(
tokens
[
0
],
"HETATM"
,
MAX_TOKEN_LEN
)
)
if
(
!
strncmp
(
tokens
[
0
],
"ATOM"
,
4
)
||
!
strncmp
(
tokens
[
0
],
"HETATM"
,
6
)
)
{
++
system
->
N
;
}
...
...
@@ -665,6 +671,8 @@ void Read_BGF( const char * const bgf_file, reax_system* system, control_params
Setup_Box
(
atof
(
s_a
),
atof
(
s_b
),
atof
(
s_c
),
atof
(
s_alpha
),
atof
(
s_beta
),
atof
(
s_gamma
),
&
system
->
box
);
crystx_found
=
TRUE
;
}
else
if
(
!
strncmp
(
tokens
[
0
],
"CONECT"
,
6
)
)
{
...
...
@@ -707,6 +715,21 @@ void Read_BGF( const char * const bgf_file, reax_system* system, control_params
fprintf
(
stderr
,
"[ERROR] Unable to read BGF file. Terminating...
\n
"
);
exit
(
INVALID_INPUT
);
}
if
(
crystx_found
==
FALSE
)
{
fprintf
(
stderr
,
"[ERROR] improperly formatted BGF file (no CRYSTX keyword found). Terminating...
\n
"
);
exit
(
INVALID_INPUT
);
}
sfree
(
line
,
"Read_BGF::line"
);
sfree
(
backup
,
"Read_BGF::backup"
);
for
(
i
=
0
;
i
<
MAX_TOKENS
;
i
++
)
{
sfree
(
tokens
[
i
],
"Read_BGF::tokens[i]"
);
}
sfree
(
tokens
,
"Read_BGF::tokens"
);
sfclose
(
bgf
,
"Read_BGF::bgf"
);
}
...
...
@@ -741,8 +764,13 @@ void Read_BGF_from_string( char * bgf_str, reax_system* system, control_params *
char
element
[
6
],
charge
[
9
];
char
chain_id
;
char
s_a
[
12
],
s_b
[
12
],
s_c
[
12
],
s_alpha
[
12
],
s_beta
[
12
],
s_gamma
[
12
];
char
*
endptr
=
NULL
;
int
i
,
atom_cnt
,
token_cnt
,
bgf_serial
,
ratom
=
0
;
char
*
endptr
;
int
i
,
atom_cnt
,
token_cnt
,
bgf_serial
,
ratom
,
crystx_found
;
endptr
=
NULL
;
ratom
=
0
;
crystx_found
=
FALSE
;
/* allocate memory for tokenizing biograf file lines */
...
...
@@ -764,8 +792,9 @@ void Read_BGF_from_string( char * bgf_str, reax_system* system, control_params *
tokens
[
0
][
0
]
=
0
;
token_cnt
=
Tokenize
(
line
,
&
tokens
,
MAX_TOKEN_LEN
);
if
(
!
strncmp
(
tokens
[
0
],
"ATOM"
,
MAX_TOKEN_LEN
)
||
!
strncmp
(
tokens
[
0
],
"HETATM"
,
MAX_TOKEN_LEN
)
)
if
(
!
strncmp
(
tokens
[
0
],
"ATOM"
,
4
)
||
!
strncmp
(
tokens
[
0
],
"HETATM"
,
6
)
)
{
++
system
->
N
;
}
...
...
@@ -919,6 +948,8 @@ void Read_BGF_from_string( char * bgf_str, reax_system* system, control_params *
Setup_Box
(
atof
(
s_a
),
atof
(
s_b
),
atof
(
s_c
),
atof
(
s_alpha
),
atof
(
s_beta
),
atof
(
s_gamma
),
&
system
->
box
);
crystx_found
=
TRUE
;
}
else
if
(
!
strncmp
(
tokens
[
0
],
"CONECT"
,
6
)
)
{
...
...
@@ -956,6 +987,21 @@ void Read_BGF_from_string( char * bgf_str, reax_system* system, control_params *
tokens
[
i
][
0
]
=
0
;
}
}
if
(
crystx_found
==
FALSE
)
{
fprintf
(
stderr
,
"[ERROR] improperly formatted BGF file (no CRYSTX keyword found). Terminating...
\n
"
);
exit
(
INVALID_INPUT
);
}
sfree
(
line
,
"Read_BGF::line"
);
sfree
(
backup
,
"Read_BGF::backup"
);
for
(
i
=
0
;
i
<
MAX_TOKENS
;
i
++
)
{
sfree
(
tokens
[
i
],
"Read_BGF::tokens[i]"
);
}
sfree
(
tokens
,
"Read_BGF::tokens"
);
/*
if ( ferror( bgf ) )
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment