help with atomistic stress calculation

Hello Jon,

Thanks for your help earlier. I’m learning how to compile the USER-ATC package on my windows workstation using cygwin (later, I will be building on a Bluegene system). I was hoping you could clarify a build issue for me.

I have tried to build the atc library (“C:\cygwin\home\Emil\LAMMPS\lammps-16Sep11\lib\atc”) and it says cannot find the mpi.h file (I’ve installed MPICH2 in the directory “C:\Program Files (x86)\MPICH2” for reference). Since I have not built LAMMPS before (I just downloaded the executable) I’m not sure how to reference the MPI directories in the “Makefile.g++” file located in the atc library.

The only place I can see to specify the MPI path in the Makefile is:

------ SETTINGS ------

include any MPI settings needed for the ATC library to build with

the same MPI library that LAMMPS is built with

CC = g++

CCFLAGS = -O -g -I…/…/src -DMPICH_IGNORE_CXX_SEEK

ARCHIVE = ar

ARCHFLAG = -rc

DEPFLAGS = -M

LINK = g++

LINKFLAGS = -O

USRLIB =

SYSLIB =

For the USRLIB and SYSLIB, what should I input?

-Emil

You specify the MPI paths below the section you listed. It is
clearly documented in all the lo-level Makefiles.

Steve

Hi Steve,

I apologize- I'm a novice when it comes to compiling, I've checked the
Makefile documentation and LAMMPS website descriptions and I am not sure
which fields to update. To build the ATC library, I've updated the
Makefile.g++ in its directory by changing CCFLAGS to map to the directory
that contains mpi.h:

CCFLAGS = -O -g -I"../../../../../../cygdrive/c/Program Files
(x86)/MPICH2/include" -DMPICH_IGNORE_CXX_SEEK

When I compile I get the following error:

Array2d.h:33:23: error: 'FILE' has not been declared

Have I correctly referenced the mpi library, etc.?

-Emil

ok - now I see that you are building the ATC lib file,
not LAMMPS itself. The -I switch is the right
idea. I've never seen adding an argument
in quotes to it. First, I would specify an
absolute path, not one with many ../ in it.
Second, I think the typical way on Windows
to use a path with a space in it is
Program\ Files.

Steve

Steve,

Thanks for the response- to clarify I am compiling in cygwin (it’s uses UNIX
syntax). I referenced the absolute path, removed the quotes and added the
forward slashes for the spaces:

CCFLAGS = -O -g -I /cygdrive/c/Program\ Files\ (x86)/MPICH2/include
-DMPICH_IGNORE_CXX_SEEK

And received a syntax error:

/bin/sh: -c: line0: syntax error near unexpected token '('

Everywhere I've looked has indicated that for UNIX syntax it is appropriate
to use quotation marks to include spaces. When I put in the absolute path
with quotations and no forward slashes:

CCFLAGS = -O -g -I "/cygdrive/c/Program Files (x86)/MPICH2/include"
-DMPICH_IGNORE_CXX_SEEK

it gives me the old error:
In file included from PhysicsModel.h:18:0
      from ATC_Transfer.h:12
      from ATC_Transfer.cpp:2:
Array2D.h:33:23: error: 'FILE' has not been declared
Array2D.h:142:38: error 'f' was not declared in this scope

Have you compiled this user package before? I'm stuck on this error.

-Emil

emil,

Steve,

Thanks for the response- to clarify I am compiling in cygwin (it’s uses UNIX
syntax). I referenced the absolute path, removed the quotes and added the
forward slashes for the spaces:

CCFLAGS = -O -g -I /cygdrive/c/Program\ Files\ (x86)/MPICH2/include
-DMPICH_IGNORE_CXX_SEEK

And received a syntax error:

/bin/sh: -c: line0: syntax error near unexpected token '('

Everywhere I've looked has indicated that for UNIX syntax it is appropriate
to use quotation marks to include spaces. When I put in the absolute path
with quotations and no forward slashes:

CCFLAGS = -O -g -I "/cygdrive/c/Program Files (x86)/MPICH2/include"
-DMPICH_IGNORE_CXX_SEEK

it gives me the old error:
In file included from PhysicsModel.h:18:0
from ATC_Transfer.h:12
from ATC_Transfer.cpp:2:
Array2D.h:33:23: error: 'FILE' has not been declared
Array2D.h:142:38: error 'f' was not declared in this scope

a quick look at the code reveals, that the source code
is at fault here, not the compilers.

Array2D.h includes <iostream> but then also uses
the FILE pointer object which is part of the C stdio
library. while most implementations of iostreams are
based on C stdio, this is not a requirement, so the
use of the FILE pointer requires you to either do a forward
declaration in the header, or include the suitable header
file. since the code further down does use the stdio API,
i'd go with the latter and change the first lines of Array2D.h
from:

#ifndef ARRAY2D_H
#define ARRAY2D_H

#include <string>
#include <iostream>

template<typename T>

to:

#ifndef ARRAY2D_H
#define ARRAY2D_H

#include <string>
#include <iostream>
#include <cstdio>

template<typename T>

and try again.

cheers,
     axel.

Axel,

Thank you so much, that fixed the aforementioned build problem. I was able
to get around a similar problem in Array.h.

It compiles for a while, and when it reaches LammpsInterface.cpp, it gives
the error:

In file included from LammpsInterface.cpp:2:0:
LammpsInterface.h:8:66: fatal error: lammps.h: No such file or directory

I've double-checked the src folder and there is a lammps.h header file. The
LammpsInterface.h header file references it properly it appears. Any
suggestions?

Thanks a million!

-Emil

I'm forwarding this to the AtC developers - looks like there is a code
issue they can fix with respect to building with repsect to one
of their header files ... see the note from Axel about array.h below.

Also, I note that the -I switch in your Makefile should not have
a space after it.

Steve

hi,

please find attached a patch with _all_ changes that i needed
to make to compile the LAMMPS-ICMS branch with ATC support
under a MinGW cross-compiler. the LAMMPS-ICMS branch is
currently not fully in sync with the main development, but that
should not make a difference here.

cheers,
    axel.

lammps-atc-icms-fixes.diff.gz (1.73 KB)

Reese, Jeremy - I haven't looked at the details, I presume
they are all inside the ATC package. I willl release this
if you sign off on it ...

Steve