diff --git a/html/user/lammps.php b/html/user/lammps.php
index 88e51e0a62..c97f4c85b4 100644
--- a/html/user/lammps.php
+++ b/html/user/lammps.php
@@ -1,5 +1,16 @@
strlen($start_line)
+ && substr_compare($line, $start_line, 0, strlen($start_line)) == 0
+ ) {
+ $start = 1;
+ continue;
+ }
+ if (!$start) continue;
+ $arr = preg_split("/\s+/", $line);
+ if (count($arr)!=6 || !is_numeric($arr[1])) {
+ continue;
+ }
+ $step = (int)$arr[1];
+ $cpu = (float)$arr[2];
+ if ($cpu==0) {
+ $start_step = $step;
+ } else {
+ $cur_step = $step;
+ if ($cur_step-$start_step>=5) {
+ $avg_cpu = $cpu/($cur_step-$start_step);
+ //echo "avg_cpu is ".$avg_cpu;
+ break;
+ }
+ }
+ }
+ return $avg_cpu;
+}
+
function show_submit_form() {
page_head("Submit LAMMPS jobs");
echo "
@@ -55,10 +142,28 @@ function prepare_batch($user) {
$info->command_file_path = $command_file_path;
$info->cmdline_file_path = $cmdline_file_path;
- // get FLOPS per job
- // TODO
+ // get the directory in which to run the test,
+ // clear it out,
+ // and set up links to the input files
//
- $info->rsc_fpops_est = 1e12;
+ $test_dir = "../../lammps_test/$user->id";
+ if (!is_dir($test_dir)) {
+ mkdir($test_dir);
+ }
+ if (!chdir($test_dir)) {
+ error_page("Can't chdir");
+ }
+ //system("rm *");
+ symlink($structure_file_path, "structure_file");
+ symlink($command_file_path, "lammps_script");
+ symlink($cmdline_file_path, "cmd_variables");
+ list($error, $cpu, $disk) = lammps_est();
+
+ if ($error) {
+ error_page("LAMMPS test failed");
+ }
+
+ $info->rsc_fpops_est = $cpu * 5e9;
// get disk space per job
// TODO