 |
Bsoft
2.1.0
Bernard's software package
|
Go to the documentation of this file.
37 cout <<
"DEBUG read_symat: Getting symmetry matrices from: " << filename << endl;
39 char* symop =
read_symop(filename, spacegroup, nsym);
62 if ( spacegroup < 1 || spacegroup > 100000 )
return 0;
68 symopfile =
"symop.star";
73 cout <<
"DEBUG read_symop: Reading symmetry operator file " << symopfile << endl;
79 if ( spacegroup > 1 ) {
86 cerr <<
"Error: No symmetry operator file read!" << endl;
90 cout <<
"DEBUG read_symop: Symmetry operator file read: " << filename << endl;
105 char* symop =
read_symop(temp, spacegroup, nsym);
106 if ( !symop || !nsym )
return -1;
142 cerr <<
"Error: File type for " << filename <<
" not supported!" << endl;
165 for ( block = star->
block; block && notfound; block = block->
next ) {
168 symop =
new char[nsym*80];
169 for ( i=0; i<nsym*80; i++ ) symop[i] = 0;
172 for ( data=item->
data, i=0; data && i<nsym; data=data->next, i++ )
173 strcpy(symop+80*i, data->
c_str());
186 int i, j, k(0), notfound(1), number(0), nlines;
187 char aline[80], symall[4000];
188 for ( i=0; i<4000; i++ ) symall[i] = 0;
191 cout <<
"DEBUG read_symop_lib: Symmetry operator library: " << filename << endl << endl;
195 if ( filename.
empty() ) symopfile = filename;
196 else symopfile =
"symop.lib";
198 if ( access(symopfile.
c_str(), R_OK) != 0 )
202 fsym.open(symopfile.
c_str());
203 if ( fsym.fail() )
return NULL;
206 cout <<
"DEBUG read_symop_lib: Symmetry operator library: " << symopfile << endl << endl;
208 while ( notfound && fsym.getline(aline, 80) ) {
209 sscanf( aline,
"%d %d", &number, &nlines );
210 if ( number == spacegroup ) notfound = 0;
218 for ( i=nsym=0; i<nlines; i++ ) {
219 fsym.getline(aline, 80);
220 for ( j=0; j<(int)strlen(aline); j++ ) {
221 if ( aline[j] !=
' ' && aline[j] !=
'\n' ) {
222 symall[k] = tolower(aline[j]);
225 if ( aline[j] ==
'*' ) nsym++;
233 cout <<
"DEBUG read_symop_lib: Spacegroup=" << number <<
" Noperators=" << nsym << endl;
235 char* symop =
new char[nsym*80];
236 for ( i=0; i<nsym*80; i++ ) symop[i] = 0;
239 for ( i=0; i<nsym; i++ ) {
241 while( symall[j] !=
'*' && k<80 ) {
242 symop[i*80+k] = symall[j];
248 cout <<
"DEBUG read_symop_lib: " << &symop[80*i] << endl;
271 for ( i=0; i<nsym; i++ ) {
274 if ( !item->
data ) item->
data = data;
280 for ( i=0; i<nsym; i++ ) {
283 if ( !item->
data ) item->
data = data;
293 if ( err < 0 ) i = err;
312 star->
comment =
"# Symmetry from bsym\n\n";
319 for ( i=0; i<sym->
n; i++ )
320 v[i] = mat * sym->
op[i].
axis;
325 for ( i=0; i<sym->
n; i++ ) {
328 if ( !item->
data ) item->
data = data;
334 for ( i=0; i<sym->
n; i++ ) {
337 if ( !item->
data ) item->
data = data;
343 for ( i=0; i<sym->
n; i++ ) {
346 if ( !item->
data ) item->
data = data;
352 for ( i=0; i<sym->
n; i++ ) {
355 if ( !item->
data ) item->
data = data;
Header file for reading and writing symmetry operators.
int write_pointgroup(Bstring &filename, Bstring &symmetry_string, View ref_view)
Writing point group symmetry operators.
int item_index(Bstar_block *block, const char *tag)
Gets the STAR item associated with a tag in a STAR data block.
int item_get_integer(Bstar_block *block, const char *tag)
Gets an integer value associated with a tag in a STAR data block.
char * add_item(char **list, unsigned long size)
Adds an item to a linked list.
int write_symat(Bstring &filename, int spacegroup)
Writing crystallographic symmetry operators.
Bstring parameter_file_path(Bstring filename)
Finds the parameter file path.
int loop_set_identifier(Bstar_block *block, int loop, int n,...)
Assigns a loop identification number to items.
int star_set_string_lengths(Bstar *star)
Sets the maximum string lengths for each item in each block.
Bstar_item * item_find_or_make(Bstar_block *block, const char *tag)
Gets the STAR item associated with a tag in a STAR data block.
float * read_symat(Bstring &filename, int spacegroup, int &nsym)
Reading crystallographic symmetry operators.
int write_star_pointgroup(Bstring &filename, Bsymmetry *sym, View ref_view)
int item_put_integer(Bstar_block *block, const char *tag, int value, const char *format)
Writes a integer into a data item associated with a specific data block and tag in a STAR data base.
int write_star(const char *filename, Bstar *star)
Writes a STAR data base to one or more STAR format files.
float * sym_matrices_from_text_list(int nsym, char *symop, int line_len)
Calculates symmetry matrices from a list of strings.
char * read_symop_lib(Bstring &filename, int spacegroup, int &nsym)
long item_get_number_for_block(Bstar_block *block, const char *tag)
Gets the number of values associated with a tag in a STAR data block.
char * read_symop_star(Bstring &filename, int spacegroup, int &nsym)
Header file for general utilities.
int read_star(const char *filename, Bstar *star)
Reads paramaters and data into a STAR data base from a list of files.
Bsymmetry * init_point_group_symmetry(Bstring symmetry_string)
Sets up a symmetry structure from a string identifier.
int write_symop_star(Bstring &filename, int spacegroup, int nsym, char *symop, int line_len)
int kill_star(Bstar *star)
Destroys a STAR data base.
int kill_symmetry(Bsymmetry *sym)
Deallocates a symmetry structure.
Header file for generalized linked list functions.
Bstar_item * item_find(Bstar_block *block, const char *tag)
Gets the STAR item associated with a tag in a STAR data block.
A header file for STAR format files.
int item_put_string(Bstar_block *block, const char *tag, char *string)
Writes a string into a data item associated with a specific data block and tag in a STAR data base.
bool contains(const Bstring &s)
Bstring * string_add(Bstring **list, const char *string)
Adds a string to a linked list.
Bstar * init_star()
Creates a STAR data base.
char * read_symop(Bstring &filename, int spacegroup, int &nsym)
Reading crystallographic symmetry operators.