Giter VIP home page Giter VIP logo

qstem's Introduction

qstem's People

Contributors

jat255 avatar msarahan avatar robbmcleod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qstem's Issues

QSTEM/Master: Input .CFG overwritten by total projected potential

Stemlib.cpp :: make3Dslices() has some variable confusion

Function has (input) FILE fileName as an argument and then declares (output) FILE filename. Needless to say this causes confusion and at the bottom of the function the total projected potential is written to the (input) file, overwriting the original .cfg file used to run stem3.exe.

FIX: Rename variables to fileIn and fileOut respectively. Correct sprintf of projected potential at bottom of function.

Working code fragment:

ifndef WIN32

        sprintf(fileOut,"%s/%s%d.img",muls->folder,muls->fileBase,iz);

else

        sprintf(fileOut,"%s\\%s%d.img",muls->folder,muls->fileBase,iz);

endif

        if (muls->printLevel >= 3)
            printf( "Saving (complex) potential layer %d to file %s (r: %g..%g)\n", iz, fileOut, ddx, ddy );

        imageIO->SetThickness(muls->sliceThickness);
        sprintf(buf,"Projected Potential (slice %d)",iz);        
        imageIO->SetComment(buf);
        imageIO->WriteComplexImage( (void **)muls->trans[iz], fileOut );
    } // loop through all slices
} /* end of if savePotential ... */
if (muls->saveTotalPotential) {
    if (tempPot == NULL) tempPot = float2D(muls->potNx,muls->potNy,"total projected potential");

    for (ix=0;ix<muls->potNx;ix++) for (iy=0;iy<muls->potNy;iy++) {
        tempPot[ix][iy] = 0;
        for (iz=0;iz<nlayer;iz++) tempPot[ix][iy] += muls->trans[iz][ix][iy][0];
    }

    for (ddx=tempPot[0][0],ddy = potVal,ix=0;ix<muls->potNy*muls->potNx;potVal = tempPot[0][++ix]) {
        if (ddy<potVal) ddy = potVal; 
        if (ddx>potVal) ddx = potVal; 
    }

ifndef WIN32

    sprintf(fileOut,"%s/%sProj.img",muls->folder,muls->fileBase);   

else

    // RAM DEBUG : this is overwriting the original config file, why?  is filename something else?
    // RAM RESOLVED: both fileName and filename were defined above...
    sprintf( fileOut, "%s\\%sProj.img", muls->folder, muls->fileBase );

endif

    if (muls->printLevel >= 2)
        printf( "Saving total projected potential to file %s (r: %g..%g)\n", fileOut, ddx, ddy );
    imageIO->SetThickness(nlayer*muls->sliceThickness);
    sprintf(buf,"Projected Potential (sum of %d slices)",muls->slices);
    imageIO->SetComment(buf);
    imageIO->WriteRealImage( (void **)tempPot, fileOut );
}

Does not compile with double precision

Using double precision by setting FLOATING_PRECISION to something other than 1 in libs/stemtypes_fftw3.h gives the following errors when compiling:

[ 31%] Building CXX object libs/CMakeFiles/qstem_libs.dir/data_containers.cpp.o
QSTEM/libs/data_containers.cpp: In constructor ‘WAVEFUNC::WAVEFUNC(int, int, float, float)’:
QSTEM/libs/data_containers.cpp:41: error: cannot convert ‘double**’ to ‘float**’ in assignment
QSTEM/libs/data_containers.cpp:42: error: cannot convert ‘double**’ to ‘float**’ in assignment
QSTEM/libs/data_containers.cpp:55: error: ‘fftMeasureFlag’ was not declared in this scope
QSTEM/libs/data_containers.cpp: In constructor ‘Detector::Detector(int, int, float, float)’:
QSTEM/libs/data_containers.cpp:124: error: cannot convert ‘double**’ to ‘float**’ in assignment
QSTEM/libs/data_containers.cpp:125: error: cannot convert ‘double**’ to ‘float**’ in assignment

XYZ files created from VMD not working

In line 55 of convert2cfg.m it is asumed that first 2 characters are alphabets of element symbol. VMD for some reason in its XYZ files leave first character as blank space ' '. Hence it breaks on XYZ files created from VMD, which quite popular open source alternative.
I made it work by simply checking for white spaces in beginning:
Currently:

 for k1=1:natom
         % data(k1,:)=fscanf(fid,'%2c %f32 %f32 %f32',1);
         buf = fgets(fid);
         type(k1,1:2) = buf(1:2);

         coords(k1,1:3)=sscanf(buf(3:end),' %f %f %f');
     end 

modified to:

for k1=1:natom
        % data(k1,:)=fscanf(fid,'%2c %f32 %f32 %f32',1);
        buf = fgets(fid);
        space_counter=1;
        while buf(space_counter)==' '
            space_counter=space_counter+1;
        end
        type(k1,1:2) = buf(space_counter:space_counter + 1);

        coords(k1,1:3)=sscanf(buf(space_counter+2:end),' %f %f %f');
    end

This way convert2cfg can handle arbitrary amount of white spaces before element symbol.

Shared_ptr not initialized

msarahan/QSTEM/C++ refactor:

Stem3.exe crashes on runtime with message, “Assertion failed: px != 0, file E:\lib\boost_1_55_0\boost/smart_ptr/shared_ptr.hpp, line 653”

Debugged finds const boost::shared_ptrQSTEM::IConfigReader * is the offender. CConfigReaderFactory constructor does not initialize a pointer. This may cause memory leak issues? Browsing the various classes that sub-type shared_ptr they do not seem to do pointer initialization. Unsure on how to proceed to fix.

Migrate to standard file format

HDF5, perhaps?

Purpose: not only store some few parameters, but also document all settings that went into a simulation. Allow transparent identification of parameters. Enable compression, and make file management simpler.

CMake does not produce good solution for VS2013

In VS2013 with msarahan/QSTEM/C++ refactor:

By default QSTEM is a dynamic library, but project expects a static one. In Config Props -> General -> Config Type change to static library (.lib).

Default build location for QSTEM is X:\GitHub\QSTEM\bin\Debug but projects expect it to be in X:\GitHub\QSTEM\libs\Debug. Change Config Props -> General -> Output Directory.

Many projects (STEM3, and test scripts) trying to link directly to hdf5.dll. In general linking to dll will not work. Change to library, in Config Props -> Linker -> Input -> Additional Deps -> Edit and change *\bin\hdf5.dll to *\lib\hdf5.lib

(Linux) Compile Error - make: *** [Makefile:91: all] Error 2

Hi all,

I'm trying to compile stem3 in Linux (manjaro). cmake looks to run pretty well, but I have a error by running make:

/home/USER/QSTEM-master/stem3/stem3.cpp:2762:34: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]

2762 | while (readparam("sequence: ",buf,0)) {
| ^~~~~~~~~~~~
make[2]: *** [stem3/CMakeFiles/stem3.dir/build.make:90: stem3/CMakeFiles/stem3.dir/stem3.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:223: stem3/CMakeFiles/stem3.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Any advice to solve it?
Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.