30int main(
int argc,
char* argv[])
32 bool useForces =
false;
39 cout <<
"USAGE: " << argv[0] <<
" <nbins> <ncutij> \n"
40 <<
" <nbins> ... Number of symmetry function"
42 <<
" <ncutij> ... Maximum number of neighbor symmetry "
43 "functions written (for each element combination).\n"
44 <<
" Execute in directory with these NNP files present:\n"
45 <<
" - input.data (structure file)\n"
46 <<
" - input.nn (NNP settings)\n"
47 <<
" - scaling.data (symmetry function scaling data)\n";
51 size_t numBins = (size_t)atoi(argv[1]);
53 MPI_Init(&argc, &argv);
54 MPI_Comm_size(MPI_COMM_WORLD, &numProcs);
55 MPI_Comm_rank(MPI_COMM_WORLD, &myRank);
58 myLog.open(
strpr(
"nnp-atomenv.log.%04d", myRank).c_str());
72 if ((
size_t)argc - 2 != n * n)
74 throw runtime_error(
"ERROR: Wrong number of neighbor cutoffs.\n");
76 vector<vector<size_t> > neighCutoff(n);
78 for (
size_t i = 0; i < n; ++i)
80 neighCutoff.at(i).resize(n, 0);
81 for (
size_t j = 0; j < n; ++j)
83 neighCutoff.at(i).at(j) = atof(argv[count+2]);
90 dataset.
log <<
"*** CALCULATING SYMMETRY FUNCTIONS ******"
91 "**************************************\n";
94 for (vector<Structure>::iterator it = dataset.
structures.begin();
98#ifdef N2P2_NO_SF_GROUPS
105 for (vector<Atom>::iterator it2 = it->atoms.begin();
106 it2 != it->atoms.end(); ++it2)
108 it2->numNeighborsUnique = 0;
109 it2->neighborsUnique.clear();
110 vector<size_t>(it2->neighborsUnique).swap(it2->neighborsUnique);
113 vector<double>(it2->dEdG).swap(it2->dEdG);
115#ifdef N2P2_FULL_SFD_MEMORY
117 vector<double>(it2->dGdxia).swap(it2->dGdxia);
123 vector<Vec3D>(it2->dGdr).swap(it2->dGdr);
127 dataset.
log <<
"*****************************************"
128 "**************************************\n";
132 "sf-scaled.%03zu.%04zu.histo");
Collect and process large data sets.
void collectSymmetryFunctionStatistics()
Collect symmetry function statistics from all processors.
int distributeStructures(bool randomize, bool excludeRank0=false, std::string const &fileName="input.data")
Read data file and distribute structures among processors.
void sortNeighborLists()
Sort all neighbor lists according to element and distance.
void writeAtomicEnvironmentFile(std::vector< std::vector< std::size_t > > neighCutoff, bool derivatives, std::string const &fileNamePrefix="atomic-env")
Write atomic environment file.
void writeNeighborLists(std::string const &fileName="neighbor-list.data")
Write neighbor list file.
void setupMPI()
Initialize MPI with MPI_COMM_WORLD.
std::vector< Structure > structures
All structures in this dataset.
void writeSymmetryFunctionHistograms(std::size_t numBins, std::string fileNameFormat="sf.%03zu.%04zu.histo")
Calculate and write symmetry function histograms.
std::size_t writeNeighborHistogram(std::string const &fileNameHisto="neighbors.histo", std::string const &fileNameStructure="neighbors.out")
Calculate and write neighbor histogram and per-structure statistics.
void setupRandomNumberGenerator()
Initialize random number generator.
void toNormalizedUnits()
Switch all structures to normalized units.
void registerStreamPointer(std::ofstream *const &streamPointer)
Register new C++ ofstream pointer.
bool writeToStdout
Turn on/off output to stdout.
void initialize()
Write welcome message with version information.
std::size_t getNumElements() const
Getter for Mode::numElements.
void setupGeneric(std::string const &nnpDir="", bool skipNormalize=false, bool initialHardness=false)
Combine multiple setup routines and provide a basic NNP setup.
double getMaxCutoffRadius() const
Getter for Mode::maxCutoffRadius.
bool useNormalization() const
Check if normalization is enabled.
void calculateSymmetryFunctionGroups(Structure &structure, bool const derivatives)
Calculate all symmetry function groups for all atoms in given structure.
virtual void setupSymmetryFunctionScaling(std::string const &fileName="scaling.data")
Set up symmetry function scaling from file.
bool settingsKeywordExists(std::string const &keyword) const
Check if keyword was found in settings file.
void calculateSymmetryFunctions(Structure &structure, bool const derivatives)
Calculate all symmetry functions for all atoms in given structure.
void setupSymmetryFunctionStatistics(bool collectStatistics, bool collectExtrapolationWarnings, bool writeExtrapolationWarnings, bool stopOnExtrapolationWarnings)
Set up symmetry function statistics collection.
void loadSettingsFile(std::string const &fileName="input.nn")
Open settings file and load all keywords into memory.
string strpr(const char *format,...)
String version of printf function.
int main(int argc, char *argv[])