예제 #1
0
int main(){

    std::ifstream file("/home/blacklizard/Desktop/MigrationLIst/bin/Debug/member.csv");
    CSV * data = new CSV;
    data->readAllRow(file);
    data->writeToFile();
    return 0;
}
예제 #2
0
FreeMillerLibrary::FreeMillerLibrary(std::string filename, double maxResolution)
{
    double freeProportion = FileParser::getKey("FREE_MILLER_FRACTION", 0.05);
    int spaceGroup = FileParser::getKey("SPACE_GROUP", 0);
    std::vector<double> unitCell = FileParser::getKey("UNIT_CELL", std::vector<double>());

    if (spaceGroup == 0)
    {
        std::cout << "Space group is unassigned! Please assign your space group using the command SPACE_GROUP in order to generate a free Miller set during refinement." << std::endl;
        exit(1);
    }

    if (unitCell.size() == 0)
    {
        std::cout << "Please specify the UNIT_CELL in order to generate a free Miller set during refinement." << std::endl;
        exit(1);
    }

    UnitCellLatticePtr lattice = UnitCellLatticePtr(new UnitCellLattice(unitCell[0], unitCell[1], unitCell[2],
                                 unitCell[3], unitCell[4], unitCell[5], spaceGroup, maxResolution));

    for (int i = 0; i < lattice->standardVectorCount(); i++)
    {
        vec3<int> oneVec = lattice->intVector(i);

        double randomNumber = rand() / (double)RAND_MAX;

        if (randomNumber < freeProportion)
        {
            freeIndices.push_back(oneVec);
        }
    }

    if (filename != "")
    {
        CSV csv = CSV(3, "h", "k", "l");

        for (int i = 0; i < freeIndexCount(); i++)
        {
            csv.addEntry(0, (double)freeIndices[i][0], (double)freeIndices[i][1], (double)freeIndices[i][2]);
        }

        csv.writeToFile(filename);
    }
}