Recent Forum Posts
From categories:
page 1123...next »
  1. include <stdlib.h>
  2. include <stdio.h>
  3. include <time.h>
  4. include <omp.h>
  1. define NV 6

int main ( int argc, char **argv );
int *dijkstra_distance ( int ohd[NV][NV] );
void find_nearest ( int s, int e, int mind[NV], int connected[NV], int *d,int *v );
void init ( int ohd[NV][NV] );
void timestamp ( void );
void update_mind ( int s, int e, int mv, int connected[NV], int ohd[NV][NV],int mind[NV] );

int main ( int argc, char **argv )
{
int i;
int i4_huge = 2147483647;
int j;
int *mind;
int ohd[NV][NV];

timestamp ( );
fprintf ( stdout, " \n" );
fprintf ( stdout, " DIJKSTRA_OPENMP\n" );
fprintf ( stdout, " C version\n" );
fprintf ( stdout, " Use Dijkstra's algorithm to determine the minimum\n" );
fprintf ( stdout, " distance from node 0 to each node in a graph,\n" );
fprintf ( stdout, " given the distances between each pair of nodes.\n" );
fprintf ( stdout, " \n" );
fprintf ( stdout, " Although a very small example is considered, we\n" );
fprintf ( stdout, " demonstrate the use of OpenMP directives for\n" );
fprintf ( stdout, " parallel execution.\n" );
init ( ohd );

fprintf ( stdout, " \n" );
fprintf ( stdout, " Distance matrix:\n" );
fprintf ( stdout, " \n" );
for ( i = 0; i < NV; i++ )
{
for ( j = 0; j < NV; j++ )
{
if ( ohd[i][j] == i4_huge )
{
fprintf ( stdout, " Inf" );
}
else
{
fprintf ( stdout, " %3d", ohd[i][j] );
}
}
fprintf ( stdout, "\n" );
}

mind = dijkstra_distance ( ohd );

fprintf ( stdout, "\n" );
fprintf ( stdout, " Minimum distances from node 0:\n");
fprintf ( stdout, "\n" );
for ( i = 0; i < NV; i++ )
{
for ( j = 0; j < NV; j++ )
{
if ( ohd[i][j] == i4_huge )
{
fprintf ( stdout, " Inf" );
}
else
{
fprintf ( stdout, " %3d", ohd[i][j] );
}
}
fprintf ( stdout, "\n" );
}

mind = dijkstra_distance ( ohd );

fprintf ( stdout, "\n" );
fprintf ( stdout, " Minimum distances from node 0:\n");
fprintf ( stdout, "\n" );
for ( i = 0; i < NV; i++ )
{
fprintf ( stdout, " %2d %2d\n", i, mind[i] );
}

free ( mind );

fprintf ( stdout, "\n" );
fprintf ( stdout, "DIJKSTRA_OPENMP\n" );
fprintf ( stdout, " Normal end of execution.\n" );

fprintf ( stdout, "\n" );
timestamp ( );
return 0;
}

int *dijkstra_distance ( int ohd[NV][NV] )

{
int *connected;
int i;
int i4_huge = 2147483647;
int md;
int *mind;
int mv;
int my_first;
int my_id;
int my_last;
int my_md;
int my_mv;
int my_step;
int nth;

connected = ( int * ) malloc ( NV * sizeof ( int ) );

connected[0] = 1;
for ( i = 1; i < NV; i++ )
{
connected[i] = 0;
}

mind = ( int * ) malloc ( NV * sizeof ( int ) );

for ( i = 0; i < NV; i++ )
{
mind[i] = ohd[0][i];
}

# pragma omp parallel private ( my_first, my_id, my_last, my_md, my_mv, my_step ) shared ( connected, md, mind, mv, nth, ohd )
{
my_id = omp_get_thread_num ( );
nth = omp_get_num_threads ( );
my_first = ( my_id * NV ) / nth;
my_last = ( ( my_id + 1 ) * NV ) / nth - 1;

# pragma omp single
{
printf ( "\n" );
printf ( " P%d: Parallel region begins with %d threads\n", my_id, nth );
printf ( "\n" );
}
fprintf ( stdout, " P%d: First=%d Last=%d\n", my_id, my_first, my_last );

for ( my_step = 1; my_step < NV; my_step++ )
{

# pragma omp single
{
md = i4_huge;
mv = -1;
}

find_nearest ( my_first, my_last, mind, connected, &my_md, &my_mv );

# pragma omp critical
{
if ( my_md < md )
{
md = my_md;
mv = my_mv;
}
}

  1. pragma omp barrier

# pragma omp single
{
if ( mv != - 1 )
{
connected[mv] = 1;
printf ( " P%d: Connecting node %d.\n", my_id, mv );
}
}

# pragma omp barrier

if ( mv != -1 )
{
update_mind ( my_first, my_last, mv, connected, ohd, mind );
}

#pragma omp barrier
}

# pragma omp single
{
printf ( "\n" );
printf ( " P%d: Exiting parallel region.\n", my_id );
}
}

free ( connected );

return mind;
}
void find_nearest ( int s, int e, int mind[NV], int connected[NV], int *d, int *v )
{
int i;
int i4_huge = 2147483647;

*d = i4_huge;
*v = -1;

for ( i = s; i <= e; i++ )
{
if ( !connected[i] && ( mind[i] < *d ) )
{
*d = mind[i];
*v = i;
}
}
return;
}
void init ( int ohd[NV][NV] )
{
int i;
int i4_huge = 2147483647;
int j;

for ( i = 0; i < NV; i++ )
{
for ( j = 0; j < NV; j++ )
{
if ( i == j )
{
ohd[i][i] = 0;
}
else
{
ohd[i][j] = i4_huge;
}
}
}
ohd[0][1] = ohd[1][0] = 40;
ohd[0][2] = ohd[2][0] = 15;
ohd[1][2] = ohd[2][1] = 20;
ohd[1][3] = ohd[3][1] = 10;
ohd[1][4] = ohd[4][1] = 25;
ohd[2][3] = ohd[3][2] = 100;
ohd[1][5] = ohd[5][1] = 6;
ohd[4][5] = ohd[5][4] = 8;

return;
}
void timestamp ( void )
{

  1. define TIME_SIZE 40

static char time_buffer[TIME_SIZE];
const struct tm *tm;
size_t len;
time_t now;

now = time ( NULL );
tm = localtime ( &now );

len = strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm );

printf ( "%s\n", time_buffer );

return;

  1. undef TIME_SIZE

}
void update_mind ( int s, int e, int mv, int connected[NV], int ohd[NV][NV], int mind[NV] )
{
int i;
int i4_huge = 2147483647;

for ( i = s; i <= e; i++ )
{
if ( !connected[i] )
{
if ( ohd[mv][i] < i4_huge )
{
if ( mind[mv] + ohd[mv][i] < mind[i] )
{
mind[i] = mind[mv] + ohd[mv][i];
}
}
}
}
return;
}

  1. include <stdlib.h>
  2. include <stdio.h>
  3. include <time.h>
  4. include <omp.h>
  1. define NV 6

int main ( int argc, char **argv );
int *dijkstra_distance ( int ohd[NV][NV] );
void find_nearest ( int s, int e, int mind[NV], int connected[NV], int *d,int *v );
void init ( int ohd[NV][NV] );
void timestamp ( void );
void update_mind ( int s, int e, int mv, int connected[NV], int ohd[NV][NV],int mind[NV] );

int main ( int argc, char **argv )
{
int i;
int i4_huge = 2147483647;
int j;
int *mind;
int ohd[NV][NV];

timestamp ( );
fprintf ( stdout, " \n" );
fprintf ( stdout, " DIJKSTRA_OPENMP\n" );
fprintf ( stdout, " C version\n" );
fprintf ( stdout, " Use Dijkstra's algorithm to determine the minimum\n" );
fprintf ( stdout, " distance from node 0 to each node in a graph,\n" );
fprintf ( stdout, " given the distances between each pair of nodes.\n" );
fprintf ( stdout, " \n" );
fprintf ( stdout, " Although a very small example is considered, we\n" );
fprintf ( stdout, " demonstrate the use of OpenMP directives for\n" );
fprintf ( stdout, " parallel execution.\n" );
init ( ohd );

fprintf ( stdout, " \n" );
fprintf ( stdout, " Distance matrix:\n" );
fprintf ( stdout, " \n" );
for ( i = 0; i < NV; i++ )
{
for ( j = 0; j < NV; j++ )
{
if ( ohd[i][j] == i4_huge )
{
fprintf ( stdout, " Inf" );
}
else
{
fprintf ( stdout, " %3d", ohd[i][j] );
}
}
fprintf ( stdout, "\n" );
}

mind = dijkstra_distance ( ohd );

fprintf ( stdout, "\n" );
fprintf ( stdout, " Minimum distances from node 0:\n");
fprintf ( stdout, "\n" );
for ( i = 0; i < NV; i++ )
{
for ( j = 0; j < NV; j++ )
{
if ( ohd[i][j] == i4_huge )
{
fprintf ( stdout, " Inf" );
}
else
{
fprintf ( stdout, " %3d", ohd[i][j] );
}
}
fprintf ( stdout, "\n" );
}

mind = dijkstra_distance ( ohd );

fprintf ( stdout, "\n" );
fprintf ( stdout, " Minimum distances from node 0:\n");
fprintf ( stdout, "\n" );
for ( i = 0; i < NV; i++ )
{
fprintf ( stdout, " %2d %2d\n", i, mind[i] );
}

free ( mind );

fprintf ( stdout, "\n" );
fprintf ( stdout, "DIJKSTRA_OPENMP\n" );
fprintf ( stdout, " Normal end of execution.\n" );

fprintf ( stdout, "\n" );
timestamp ( );
return 0;
}

int *dijkstra_distance ( int ohd[NV][NV] )

{
int *connected;
int i;
int i4_huge = 2147483647;
int md;
int *mind;
int mv;
int my_first;
int my_id;
int my_last;
int my_md;
int my_mv;
int my_step;
int nth;

connected = ( int * ) malloc ( NV * sizeof ( int ) );

connected[0] = 1;
for ( i = 1; i < NV; i++ )
{
connected[i] = 0;
}

mind = ( int * ) malloc ( NV * sizeof ( int ) );

for ( i = 0; i < NV; i++ )
{
mind[i] = ohd[0][i];
}

# pragma omp parallel private ( my_first, my_id, my_last, my_md, my_mv, my_step ) shared ( connected, md, mind, mv, nth, ohd )
{
my_id = omp_get_thread_num ( );
nth = omp_get_num_threads ( );
my_first = ( my_id * NV ) / nth;
my_last = ( ( my_id + 1 ) * NV ) / nth - 1;

# pragma omp single
{
printf ( "\n" );
printf ( " P%d: Parallel region begins with %d threads\n", my_id, nth );
printf ( "\n" );
}
fprintf ( stdout, " P%d: First=%d Last=%d\n", my_id, my_first, my_last );

for ( my_step = 1; my_step < NV; my_step++ )
{

# pragma omp single
{
md = i4_huge;
mv = -1;
}

find_nearest ( my_first, my_last, mind, connected, &my_md, &my_mv );

# pragma omp critical
{
if ( my_md < md )
{
md = my_md;
mv = my_mv;
}
}

  1. pragma omp barrier

# pragma omp single
{
if ( mv != - 1 )
{
connected[mv] = 1;
printf ( " P%d: Connecting node %d.\n", my_id, mv );
}
}

# pragma omp barrier

if ( mv != -1 )
{
update_mind ( my_first, my_last, mv, connected, ohd, mind );
}

#pragma omp barrier
}

# pragma omp single
{
printf ( "\n" );
printf ( " P%d: Exiting parallel region.\n", my_id );
}
}

free ( connected );

return mind;
}
void find_nearest ( int s, int e, int mind[NV], int connected[NV], int *d, int *v )
{
int i;
int i4_huge = 2147483647;

*d = i4_huge;
*v = -1;

for ( i = s; i <= e; i++ )
{
if ( !connected[i] && ( mind[i] < *d ) )
{
*d = mind[i];
*v = i;
}
}
return;
}
void init ( int ohd[NV][NV] )
{
int i;
int i4_huge = 2147483647;
int j;

for ( i = 0; i < NV; i++ )
{
for ( j = 0; j < NV; j++ )
{
if ( i == j )
{
ohd[i][i] = 0;
}
else
{
ohd[i][j] = i4_huge;
}
}
}
ohd[0][1] = ohd[1][0] = 40;
ohd[0][2] = ohd[2][0] = 15;
ohd[1][2] = ohd[2][1] = 20;
ohd[1][3] = ohd[3][1] = 10;
ohd[1][4] = ohd[4][1] = 25;
ohd[2][3] = ohd[3][2] = 100;
ohd[1][5] = ohd[5][1] = 6;
ohd[4][5] = ohd[5][4] = 8;

return;
}
void timestamp ( void )
{

  1. define TIME_SIZE 40

static char time_buffer[TIME_SIZE];
const struct tm *tm;
size_t len;
time_t now;

now = time ( NULL );
tm = localtime ( &now );

len = strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm );

printf ( "%s\n", time_buffer );

return;

  1. undef TIME_SIZE

}
void update_mind ( int s, int e, int mv, int connected[NV], int ohd[NV][NV], int mind[NV] )
{
int i;
int i4_huge = 2147483647;

for ( i = s; i <= e; i++ )
{
if ( !connected[i] )
{
if ( ohd[mv][i] < i4_huge )
{
if ( mind[mv] + ohd[mv][i] < mind[i] )
{
mind[i] = mind[mv] + ohd[mv][i];
}
}
}
}
return;
}

//can everyone help me, i get the 'omp_get_thread_num' and 'omp_get_num_thread'

please help

by Riko (guest), 01 Dec 2017 09:53
Caterina CocchiCaterina Cocchi 29 Nov 2017 16:37
in discussion Forum / Support Questions » Xcrysden

Dear Sahel Loushab,

as I understand, your problem is related to the installation of XCrysDen. This type of support is out of our competences. I recommend you to contact the developers of XCrysDen or to post your question to other forums specifically dedicated to the support on this software.

Best regards,
Caterina Cocchi
(exciting team)

by Caterina CocchiCaterina Cocchi, 29 Nov 2017 16:37
sahel loushab (guest) 28 Nov 2017 15:24
in discussion Forum / Support Questions » sh 1: bad substitution

Dear Christian,
I got the same problem too.gfortran 5 in linux mint 18.2 and default shell GNOME Terminal 3.18.3 and architecture x86_64.
Best regards,
Sahel loushab

by sahel loushab (guest), 28 Nov 2017 15:24
sahel loushab (guest) 28 Nov 2017 15:15
in discussion Forum / Support Questions » Xcrysden

Dear Catrina,
I want install xcrysden from source package. during installation process, get this error:
Leaving directory '/opt/xcrysden-1.5.53/external/src'
Makefile:45: recipe for target 'tk' failed
make: *** [tk] Error 2
install tcl, tk, Mesa library and change Make.sys as follows:
on comment this line:
TK_LIB = -ltk8.5
TCL_LIB = -ltcl8.5
GLU_LIB = -lGLU
GL_LIB = -lGL
FFTW3_LIB = -lfftw3

  1. # this is only used for some testing purposes

##MESCHACH_LIB = -lmeschach

Best regards,
Sahel loushab

by sahel loushab (guest), 28 Nov 2017 15:15

Dear exciting team,

I am working on MoS2 with spin-orbit coupling (SOC) in GGA_PBE. When I do a volume optimization with just SOC, I get a reasonable equilibrium lattice constant. When I do the same but freeze the core electrons (frozencore="true") my energy-vs-volume curve does not exhibit a minimum. Apart from minor changes in the energies of the lowest lying bands, the bandstructure looks identical.

Could you maybe explain this behaviour? Does something go wrong in the GS calculation?

Thanks in advance,
Valerie

Re: PDOS
Caterina CocchiCaterina Cocchi 22 Nov 2017 10:22
in discussion Forum / Support Questions » PDOS

Dear Manu,

the answer to this question that you asked already is posted on our forum at this link.

Best regards,
Caterina Cocchi

Re: PDOS by Caterina CocchiCaterina Cocchi, 22 Nov 2017 10:22
PDOS
hegdemanuhegdemanu 21 Nov 2017 03:07
in discussion Forum / Support Questions » PDOS

Hello,

I am new to exciting. Is it possible to get orbital projected DOS in exciting code?
Manu
(University of Waterloo)

PDOS by hegdemanuhegdemanu, 21 Nov 2017 03:07
Re: Xcrysden
Caterina CocchiCaterina Cocchi 20 Nov 2017 22:00
in discussion Forum / Support Questions » Xcrysden

Dear Sahel Loshoub,

I am not sure I have understood your problem. Detailed instructions for configuring XCrysDen for exciting are given at this link.

If the issue persists, please let us know, describing it as clearly as possible.

Best regards,
Caterina Cocchi
(exciting team)

Re: Xcrysden by Caterina CocchiCaterina Cocchi, 20 Nov 2017 22:00
Xcrysden
sahel loushab (guest) 19 Nov 2017 17:08
in discussion Forum / Support Questions » Xcrysden

Dear Caterina;
I have linux mint18.2, i want install xcrysden and set it for exciting.when i install xcrysden…sheard.tar.gz and set it for exciting,i can not find a file with this name in xcrysden directory,custom-definitions,So i make it and then copy this command in it; addOption exciting $env(EXCITINGSCRIPTS)/ex2xsf {
load structure from exciting input.xml format}.
But when i excute this comman; $ xcrysden —exciting input.xml & i see this message: Errore bad option
exciting .and i cant install sorce pakage. In installation sorce pakage after make all, when i execute comman ./xcConfigure, i see this message :bash: ./xcConfigure: No such file or directory
.
can you help me?
Best regards,
Sahel loshoub

Xcrysden by sahel loushab (guest), 19 Nov 2017 17:08
Re: PDOS
Caterina CocchiCaterina Cocchi 18 Nov 2017 11:30
in discussion Forum / Controversy » PDOS

Dear Manu,

to obtain the angular momentum projected DOS you have to set to true the attribute lmirep inside the element dos.

Best regards,
Caterina Cocchi
(exciting team)

Re: PDOS by Caterina CocchiCaterina Cocchi, 18 Nov 2017 11:30
PDOS
hegdemanuhegdemanu 17 Nov 2017 17:15
in discussion Forum / Controversy » PDOS

Hello,
I am new to exciton. I have successfully installed and ran few examples. It works well. But I do not know how to get orbital angular momentum projected DOS or PDOS using exciting. Could you please help me regarding it.
Thanks,
Manu
(University of Waterloo, Canada)

PDOS by hegdemanuhegdemanu, 17 Nov 2017 17:15
Error while compilation
D. P. Rai (guest) 30 Oct 2017 05:39
in discussion Forum / Controversy » Error while compilation

Dear Users,
I am trying to install Exciting-Carbon. while installation with ifort I have encountered this error
compilation aborted for ../../src/mod_potential_and_density.F90 (code 1)
Makefile.mkmf:961: recipe for target 'mod_potential_and_density.o' failed
make[3]: * [mod_potential_and_density.o] Error 1
make[3]: Leaving directory '/home/dprai/TUTORIALS/exciting/build/serial'
../Make.common:39: recipe for target 'bin' failed
make[2]: *
[bin] Error 2
make[2]: Leaving directory '/home/dprai/TUTORIALS/exciting/build/serial'
Makefile:3: recipe for target 'all' failed
make[1]: * [all] Error 2
make[1]: Leaving directory '/home/dprai/TUTORIALS/exciting/build/serial'
Makefile:14: recipe for target 'serial' failed
make: *
[serial] Error 2
my ifort is composer_xe_2013.1.117 in ubuntu 16.04.

Your Kind help is appreciated.

Regards

Error while compilation by D. P. Rai (guest), 30 Oct 2017 05:39

Dear Sahel Loushab,

the default size of the muffin-tin (MT) radius of an element is included in the species files incorporated in the release. In some (rare) cases they are fine as they are, meaning that the default value can be used as it is. However, a good practice is always to tune the size of the MT spheres according to chemical composition of your system (i.e., bond lengths), keeping in mind that spheres of different atoms cannot overlap.

Best regards,
Caterina Cocchi
(exciting team)

Re: Attribute: rmt by Caterina CocchiCaterina Cocchi, 24 Oct 2017 18:27

Dear exciting group,

How can i find best rmt for an element?

Best regards,
sahel loushab

Attribute: rmt by sahel loushabsahel loushab, 24 Oct 2017 06:21

Dear Sahel Loushab,

in order to reduce the number of atoms only to the relevant ones, you have simply to delete the redundant ones in the atomic coordinate attributes.

Best regards,
Caterina Cocchi
(exciting team)

I creat an input file by wyckoff atomic position.can you tell me how can i reduce atom coordinat?

<input>

<title>Phosphorene</title>

<structure speciespath="/opt/exciting/species">

<crystal scale="1.0">
<basevect> 6.261229596 0.000000000 0.000000000 </basevect>
<basevect> 0.000000000 19.79110179 0.000000000 </basevect>
<basevect> 0.000000000 0.000000000 8.265662105 </basevect>
</crystal>
<species speciesfile="P.xml" rmt="2.20">
<atom coord="0.00000000 0.10340 0.08060 "/>
<atom coord="1.00000000 0.10340 0.08060 "/>
<atom coord="0.00000000 0.39660 0.58060 "/>
<atom coord="1.00000000 0.39660 0.58060 "/>
<atom coord="0.00000000 0.89660 0.91940 "/>
<atom coord="1.00000000 0.89660 0.91940 "/>
<atom coord="0.00000000 0.60340 0.41940 "/>
<atom coord="1.00000000 0.60340 0.41940 "/>
<atom coord="0.50000000 0.60340 0.08060 "/>
<atom coord="0.50000000 0.39660 0.91940 "/>
<atom coord="0.50000000 0.89660 0.58060 "/>
<atom coord="0.50000000 0.10340 0.41940 "/>
<atom coord="-0.50000000 0.10340 0.41940 "/>
<atom coord="0.00000000 -0.10340 -0.08060 "/>
<atom coord="1.00000000 -0.10340 -0.08060 "/>
<atom coord="1.50000000 0.10340 0.41940 "/>
<atom coord="-0.50000000 0.89660 0.58060 "/>
<atom coord="0.00000000 1.10340 1.08060 "/>
<atom coord="1.00000000 1.10340 1.08060 "/>
<atom coord="1.50000000 0.89660 0.58060 "/>
<atom coord="-0.50000000 0.39660 0.91940 "/>
<atom coord="1.50000000 0.39660 0.91940 "/>
<atom coord="0.50000000 0.39660 -0.08060 "/>
</species>

</structure>
<input>

Re: Posphorene input.xml by sahel loushabsahel loushab, 19 Oct 2017 12:47

Dear Sahel Loushab,

in order to convert a cif file to and input for exciting we suggest you to use the visualization program VESTA. You can then proceed in producing the input file as suggested in this older post in our forum: http://exciting-code.org/forum/t-1155705

The number of atoms in the structure is given by the number of entries in the element atom.

exciting supports both multi-threading and MPI. To execute a parallel run, you have to correctly set-up your submission script, which is solely dependent on your machine.

I hope this helps.

Best regards,
Caterina Cocchi
(exciting team)

It's cif file number is: 9012486.cif
I can't post this file!!!

Re: Posphorene input.xml by sahel loushabsahel loushab, 18 Oct 2017 15:36

Dear exciting group,
I am a new user of this code. I want building an input file for Phosphorene. I got cif file for this structure of Crystallography Open Database.
But i can't change atom coordinate and basevectores to input.xml.Can you help me? and how can i controle the number of atoms in a structure? and at the end,is Exciting code multithread? if no how can i execute a MPI run?
Best regards,
sahel loushab

Posphorene input.xml by sahel loushabsahel loushab, 18 Oct 2017 15:31
page 1123...next »
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License