Skip to content

Commit

Permalink
Merge pull request #49 from rk-lindsey/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
rk-lindsey authored Jan 7, 2023
2 parents ed5a315 + c0f1580 commit 3fb100f
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 51 deletions.
132 changes: 82 additions & 50 deletions chimesFF/src/chimesFF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ string chimesFF::get_next_line(istream& str)
if (rank == 0)
cout << "chimesFF: " << "Error reading line" << line << endl;
exit(0);
}
}

return line;
}
Expand Down Expand Up @@ -657,7 +657,7 @@ void chimesFF::read_parameters(string paramfile)
line = get_next_line(param_file);

split_line(line, tmp_str_items);

tmp_int = stoi(tmp_str_items[1]);

trip_params_atm_chems[tmp_int].push_back(tmp_str_items[3]);
Expand All @@ -674,27 +674,36 @@ void chimesFF::read_parameters(string paramfile)
trip_params_pair_typs[tmp_int].push_back(tmp_str_items[1]);
trip_params_pair_typs[tmp_int].push_back(tmp_str_items[2]);
trip_params_pair_typs[tmp_int].push_back(tmp_str_items[3]);

// Check for excluded triplet types

if(tmp_str_items[4] != "EXCLUDED:")
{
ncoeffs_3b[tmp_int] = stoi(tmp_str_items[7]);

get_next_line(param_file);
get_next_line(param_file);

ncoeffs_3b[tmp_int] = stoi(tmp_str_items[7]);

get_next_line(param_file);
get_next_line(param_file);

for(int i=0; i<ncoeffs_3b[tmp_int]; i++)
{
line = get_next_line(param_file);
split_line(line, tmp_str_items);
for(int i=0; i<ncoeffs_3b[tmp_int]; i++)
{
line = get_next_line(param_file);
split_line(line, tmp_str_items);

tmp_int_vec[0] = stoi(tmp_str_items[1]);
tmp_int_vec[1] = stoi(tmp_str_items[2]);
tmp_int_vec[2] = stoi(tmp_str_items[3]);
tmp_int_vec[0] = stoi(tmp_str_items[1]);
tmp_int_vec[1] = stoi(tmp_str_items[2]);
tmp_int_vec[2] = stoi(tmp_str_items[3]);

chimes_3b_powers[tmp_int].push_back(tmp_int_vec);
chimes_3b_params[tmp_int].push_back(stod(tmp_str_items[6]));
chimes_3b_powers[tmp_int].push_back(tmp_int_vec);
chimes_3b_params[tmp_int].push_back(stod(tmp_str_items[6]));

if (rank == 0)
cout << "chimesFF: " << "\t" << chimes_3b_powers[tmp_int][i][0] << " " << chimes_3b_powers[tmp_int][i][1] << " " << chimes_3b_powers[tmp_int][i][2] << " " << chimes_3b_params[tmp_int][i] << endl;
}
if (rank == 0)
cout << "chimesFF: " << "\t" << chimes_3b_powers[tmp_int][i][0] << " " << chimes_3b_powers[tmp_int][i][1] << " " << chimes_3b_powers[tmp_int][i][2] << " " << chimes_3b_params[tmp_int][i] << endl;
}
}
else
{
cout << "chimesFF: \tType is excluded... skipping." << endl;
}
}

if(line.find("TRIPMAPS:") != string::npos)
Expand Down Expand Up @@ -981,41 +990,50 @@ void chimesFF::read_parameters(string paramfile)
quad_params_pair_typs[tmp_int].push_back(tmp_str_items[3]);
quad_params_pair_typs[tmp_int].push_back(tmp_str_items[4]);
quad_params_pair_typs[tmp_int].push_back(tmp_str_items[5]);
quad_params_pair_typs[tmp_int].push_back(tmp_str_items[6]);

ncoeffs_4b[tmp_int] = stoi(tmp_str_items[10]);
quad_params_pair_typs[tmp_int].push_back(tmp_str_items[6]);

// Check for excluded triplet types

if(tmp_str_items[7] != "EXCLUDED:")
{
ncoeffs_4b[tmp_int] = stoi(tmp_str_items[10]);

get_next_line(param_file);
get_next_line(param_file);
get_next_line(param_file);
get_next_line(param_file);

vector<int> tmp_int_vec(6);
vector<int> tmp_int_vec(6);

for(int i=0; i<ncoeffs_4b[tmp_int]; i++)
{
line = get_next_line(param_file);
split_line(line, tmp_str_items);
for(int i=0; i<ncoeffs_4b[tmp_int]; i++)
{
line = get_next_line(param_file);
split_line(line, tmp_str_items);

tmp_int_vec[0] = stoi(tmp_str_items[1]);
tmp_int_vec[1] = stoi(tmp_str_items[2]);
tmp_int_vec[2] = stoi(tmp_str_items[3]);
tmp_int_vec[3] = stoi(tmp_str_items[4]);
tmp_int_vec[4] = stoi(tmp_str_items[5]);
tmp_int_vec[5] = stoi(tmp_str_items[6]);
tmp_int_vec[0] = stoi(tmp_str_items[1]);
tmp_int_vec[1] = stoi(tmp_str_items[2]);
tmp_int_vec[2] = stoi(tmp_str_items[3]);
tmp_int_vec[3] = stoi(tmp_str_items[4]);
tmp_int_vec[4] = stoi(tmp_str_items[5]);
tmp_int_vec[5] = stoi(tmp_str_items[6]);

chimes_4b_powers[tmp_int].push_back(tmp_int_vec);
chimes_4b_powers[tmp_int].push_back(tmp_int_vec);

chimes_4b_params[tmp_int].push_back(stod(tmp_str_items[9]));
chimes_4b_params[tmp_int].push_back(stod(tmp_str_items[9]));

if (rank == 0)
cout << "chimesFF: " << "\t" <<
chimes_4b_powers[tmp_int][i][0] << " " <<
chimes_4b_powers[tmp_int][i][1] << " " <<
chimes_4b_powers[tmp_int][i][2] << " " <<
chimes_4b_powers[tmp_int][i][3] << " " <<
chimes_4b_powers[tmp_int][i][4] << " " <<
chimes_4b_powers[tmp_int][i][5] << " " <<
chimes_4b_params[tmp_int][i] << endl;
}
if (rank == 0)
cout << "chimesFF: " << "\t" <<
chimes_4b_powers[tmp_int][i][0] << " " <<
chimes_4b_powers[tmp_int][i][1] << " " <<
chimes_4b_powers[tmp_int][i][2] << " " <<
chimes_4b_powers[tmp_int][i][3] << " " <<
chimes_4b_powers[tmp_int][i][4] << " " <<
chimes_4b_powers[tmp_int][i][5] << " " <<
chimes_4b_params[tmp_int][i] << endl;
}
}
else
{
cout << "chimesFF: \tType is excluded... skipping." << endl;
}
}

if(line.find("QUADMAPS:") != string::npos)
Expand Down Expand Up @@ -2116,6 +2134,10 @@ void chimesFF::build_pair_int_quad_map()
int idx = i*natmtyps*natmtyps*natmtyps + j*natmtyps*natmtyps + k*natmtyps + l ;
int quadidx = atom_int_quad_map[idx];

// Skip excluded interactions
if (quadidx < 0)
continue;

build_atom_and_pair_mappers(natoms, npairs, typ_idxs, quad_params_pair_typs[quadidx], pair_map);

// Save for re-use in force evaluators.
Expand All @@ -2136,7 +2158,10 @@ void chimesFF::build_pair_int_quad_map()
{
if ( pair_int_quad_map[i].size() == 0 )
{
cout << "Error: Did not initialize pair_int_quad_map entry " << i << endl ;
if (atom_int_quad_map[i] >= 0)
cout << "Error: Did not initialize pair_int_quad_map for entry " << i << endl ;
else
cout << "Warning: Did not initialize pair_int_quad_map for excluded entry " << i << endl ;
}
}
}
Expand All @@ -2151,7 +2176,7 @@ void chimesFF::build_pair_int_trip_map()
vector<int> pair_map(npairs) ;
vector<int> typ_idxs(natoms) ;

if ( atom_int_trip_map.size() == 0 ) return ; // No quads !
if ( atom_int_trip_map.size() == 0 ) return ; // No trips !

pair_int_trip_map.resize(natmtyps*natmtyps*natmtyps) ;

Expand All @@ -2165,6 +2190,10 @@ void chimesFF::build_pair_int_trip_map()
{
typ_idxs[2] = k ;
int tripidx = atom_int_trip_map[i*natmtyps*natmtyps + j*natmtyps + k];

// Skip excluded interactions
if (tripidx < 0)
continue;

build_atom_and_pair_mappers(natoms, npairs, typ_idxs, trip_params_pair_typs[tripidx], pair_map);

Expand All @@ -2185,7 +2214,10 @@ void chimesFF::build_pair_int_trip_map()
{
if ( pair_int_trip_map[i].size() == 0 )
{
cout << "Error: Did not initialize pair_int_trip_map entry " << i << endl ;
if (atom_int_trip_map[i] >= 0)
cout << "Error: Did not initialize pair_int_trip_map for entry " << i << endl ;
else
cout << "Warning: Did not initialize pair_int_trip_map for excluded entry " << i << endl ;
}
}

Expand Down
2 changes: 1 addition & 1 deletion serial_interface/tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

STYLE=${1-"LONG"} # By default,run "LONG" test, but if user runs with "./run_tests SHORT, runs short tests
PREFX=${2-""} # By default, don't set any special install prefix
PYTH3=python3.7
PYTH3=python3

# Populate FFS, CFGS, and OPTIONS from test_list.dat

Expand Down

0 comments on commit 3fb100f

Please sign in to comment.