diff --git a/.travis.yml b/.travis.yml index 8c5cd8c..9368615 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,4 +16,4 @@ script: - make install - cd test - cp $HOME/ProtoMol/bin/ProtoMol . - - python test.py --serial --parallel --errorfailure + - go run test.go --verbose --parallel --errorfailure diff --git a/protomol/integrator/hessian/BlockHessian.cpp b/protomol/integrator/hessian/BlockHessian.cpp index 962bab9..7fb8db2 100644 --- a/protomol/integrator/hessian/BlockHessian.cpp +++ b/protomol/integrator/hessian/BlockHessian.cpp @@ -1273,8 +1273,8 @@ void BlockHessian::evaluateNumericalResidues(const Vector3DBlock *myPositions, unsigned int block_start = 0; const unsigned int size = myPositions->size(); - - const Real epsilon = 1e-12; + + const Real epsilon = 1e-6; const Real inv_epsilon = 1.0 / epsilon; diff --git a/protomol/integrator/hessian/BlockHessianDiagonalize.cpp b/protomol/integrator/hessian/BlockHessianDiagonalize.cpp index e98eb41..25ee9ef 100644 --- a/protomol/integrator/hessian/BlockHessianDiagonalize.cpp +++ b/protomol/integrator/hessian/BlockHessianDiagonalize.cpp @@ -231,7 +231,7 @@ namespace ProtoMol { Vector3DBlock tempForce = *(intg->getForces()); //define epsilon - Real epsilon = 1e-9; + Real epsilon = 1e-6; //loop over each eigenvector purtubation for(int eg=0; eggetId())) { - std::cout << "LJ Test" << std::endl; myLennardJones = true; myCoulomb = true; vector Fparam; //lSwitch = cSwitch = 1; diff --git a/test/test.go b/test/test.go new file mode 100644 index 0000000..281d52d --- /dev/null +++ b/test/test.go @@ -0,0 +1,772 @@ +package main + +import ( + "bufio" + "encoding/binary" + "errors" + "flag" + "fmt" + "io" + "io/ioutil" + "log" + "math" + "os" + "os/exec" + "path/filepath" + "strconv" + "strings" +) + +var debug bool +var verbose bool +var parallel bool +var errorfailure bool + +var vLogger *log.Logger + +func main() { + flag.BoolVar(&debug, "debug", false, "Enable debugging of ProtoMol execution") + flag.BoolVar(&verbose, "verbose", false, "Enable verbose output") + flag.BoolVar(¶llel, "parallel", false, "Enable parallel ProtoMol execution") + flag.BoolVar(&errorfailure, "errorfailure", false, "Force failure of on a single test failure") + single := flag.String("single", "", "Single test to run") + flag.Parse() + + // Setup Verbose Logger + if verbose { + vLogger = log.New(os.Stdout, "", log.LstdFlags) + } else { + vLogger = log.New(ioutil.Discard, "", log.LstdFlags) + } + + // Update Path Variable + os.Setenv("PATH", ".:"+os.Getenv("PATH")) + + // Check if we can find ProtoMol + if _, err := exec.LookPath("ProtoMol"); err != nil { + log.Fatalln("ProtoMol executable could not be found") + } + + if parallel { + // Check if we can find mpirun + if _, err := exec.LookPath("mpirun"); err != nil { + log.Fatalln("MPI executable could not be found") + } + + // Check if protomol was built with MPI + out, _ := exec.Command("ProtoMol").CombinedOutput() + if strings.Contains(string(out), "No MPI compilation") { + log.Fatalln("Parallel tests unavailable. Please recompile ProtoMol with MPI support.") + } + } + + // Create Output Directory + os.Mkdir("tests/output", 0755) + + // Find Tests + tests, err := filepath.Glob("tests/*.conf") + if err != nil { + log.Fatalln(err) + } + + if len(*single) > 0 { + tests = []string{*single} + } + + // Run Tests + for _, test := range tests { + RunTest(test, false) + if parallel { + RunTest(test, true) + } + } +} + +func RunTest(config string, parallel bool) { + basename := strings.Replace(filepath.Base(config), filepath.Ext(config), "", -1) + + var cmd *exec.Cmd + if parallel { + log.Println("Executing Parallel Test:", basename) + cmd = exec.Command("mpirun", "-np", "2", "ProtoMol", config) + } else { + log.Println("Executing Test:", basename) + cmd = exec.Command("ProtoMol", config) + } + + if debug { + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stdout + } else { + cmd.Stdout = nil + cmd.Stderr = nil + } + + if err := cmd.Run(); err != nil { + log.Println("\tIgnored") + return + } + + // Find Expected Results + expects, err := filepath.Glob("tests/expected/" + basename + ".*") + if err != nil { + log.Fatalln(err) + } + + // Compare Results + for _, expected := range expects { + output := "tests/output/" + filepath.Base(expected) + extension := filepath.Ext(output) + if extension == ".header" { + continue + } + + log.Println(fmt.Sprintf("\tTesting %s vs %s", output, expected)) + + var result bool + switch extension { + case ".dcd": + result = isMatchingDCD(output, expected) + break + case ".energy": + result = isMatchingEnergy(output, expected) + break + case ".forces": + result = isMatchingForce(output, expected) + break + case ".pos": + result = isMatchingPosition(output, expected) + break + case ".vel": + result = isMatchingVelocity(output, expected) + break + case ".vec": + result = isMatchingVelocity(output, expected) + break + case ".val": + result = isMatchingVelocity(output, expected) + break + default: + log.Println("\t\tIgnored") + continue + } + + if !result { + if errorfailure { + log.Fatalln("\t\tFailed") + } else { + log.Println("\t\tFailed") + } + } else { + log.Println("\t\tPassed") + } + } +} + +// Generic Parsing +type AtomPosition struct { + Name string + X, Y, Z float64 +} + +func ParseAtomPosition(line string) (*AtomPosition, error) { + var values []string + for _, value := range strings.Split(line, " ") { + if len(value) > 0 { + values = append(values, strings.TrimSpace(value)) + } + } + + if len(values) != 4 { + return nil, errors.New("invalid atom position line") + } + + result := AtomPosition{Name: values[0]} + + x, err := strconv.ParseFloat(values[1], 64) + if err != nil { + return nil, err + } + result.X = x + + y, err := strconv.ParseFloat(values[2], 64) + if err != nil { + return nil, err + } + result.Y = y + + z, err := strconv.ParseFloat(values[3], 64) + if err != nil { + return nil, err + } + result.Z = z + + return &result, nil +} + +// DCD Comparison +func isMatchingDCD(actual, expected string) bool { + dcdActual, err := ReadDCD(actual) + if err != nil { + return true + } + + dcdExpected, err := ReadDCD(expected) + if err != nil { + return true + } + + if dcdActual.Header.Frames != dcdExpected.Header.Frames { + vLogger.Println("Atom Count Differs") + return false + } + + if dcdActual.Header.FirstStep != dcdExpected.Header.FirstStep { + vLogger.Printf("First Step Differs. Should be %d but is %d\n", dcdExpected.Header.FirstStep, dcdActual.Header.FirstStep) + return false + } + + if dcdActual.Atoms != dcdExpected.Atoms { + vLogger.Printf("Atom Count Differs. Should be %d but is %d\n", dcdExpected.Atoms, dcdActual.Atoms) + return false + } + + diffs := 0 + for frame := int32(0); frame < dcdExpected.Header.Frames; frame++ { + for atom := int32(0); atom < dcdExpected.Atoms; atom++ { + ePosition := dcdExpected.Frames[frame].Position[atom] + aPosition := dcdActual.Frames[frame].Position[atom] + + xDiff := math.Max(ePosition.X, aPosition.X) - math.Min(ePosition.X, aPosition.X) + if xDiff > 0.00001 { + diffs++ + vLogger.Printf("Frame %d, Atom %d Differs X. Expected: %f, Actual: %f, Difference: %f\n", frame, atom, ePosition.X, aPosition.X, xDiff) + } + + yDiff := math.Max(ePosition.Y, aPosition.Y) - math.Min(ePosition.Y, aPosition.Y) + if yDiff > 0.00001 { + diffs++ + vLogger.Printf("Frame %d, Atom %d Differs Y. Expected: %f, Actual: %f, Difference: %f\n", frame, atom, ePosition.Y, aPosition.Y, yDiff) + } + + zDiff := math.Max(ePosition.X, aPosition.X) - math.Min(ePosition.X, aPosition.X) + if zDiff > 0.00001 { + diffs++ + vLogger.Printf("Frame %d, Atom %d Differs Z. Expected: %f, Actual: %f, Difference: %f\n", frame, atom, ePosition.Z, aPosition.Z, zDiff) + } + } + } + + return diffs == 0 +} + +// DCD Parsing +type Vector3f struct { + X, Y, Z float64 +} +type DCDFile struct { + Header DCDHeader + Comment []byte + Atoms int32 + Frames []DCDFrame +} + +type DCDFrame struct { + Position []Vector3f +} +type DCDHeader struct { + Frames int32 + FirstStep int32 + _ [24]byte + FreeIndexes int32 + _ [44]byte + _ [4]byte +} + +func ReadDCD(filename string) (*DCDFile, error) { + file, err := os.Open(filename) + if err != nil { + return nil, err + } + defer file.Close() + + // Read Endian + var endian int32 + if err := binary.Read(file, binary.LittleEndian, &endian); err != nil { + return nil, err + } + + // Test Endian + var order binary.ByteOrder = binary.LittleEndian + if endian != 84 { + order = binary.BigEndian + } + + // Read Cord + var cord [4]byte + if err := binary.Read(file, order, &cord); err != nil { + return nil, err + } + + // Check Magic Number + if cord != [4]byte{'C', 'O', 'R', 'D'} { + return nil, err + } + + var result DCDFile + + // Read Header + if err := binary.Read(file, order, &result.Header); err != nil { + return nil, err + } + + // Read Comment + if err := FortranReadString(file, order, &result.Comment); err != nil { + return nil, err + } + + // Read Atoms + if err := FortranRead(file, order, &result.Atoms); err != nil { + return nil, err + } + + // Skip Free Indexies + if result.Header.FreeIndexes > 0 { + io.CopyN(ioutil.Discard, file, int64(4*(result.Atoms-result.Header.FreeIndexes+2))) + } + + // Read Frames + tempX := make([]float32, result.Atoms) + tempY := make([]float32, result.Atoms) + tempZ := make([]float32, result.Atoms) + + for i := int32(0); i < result.Header.Frames; i++ { + var frame DCDFrame + + // Read X + if err := FortranRead(file, order, &tempX); err != nil { + return nil, err + } + + // Read Y + if err := FortranRead(file, order, &tempY); err != nil { + return nil, err + } + + // Read Z + if err := FortranRead(file, order, &tempZ); err != nil { + return nil, err + } + + for j := int32(0); j < result.Atoms; j++ { + frame.Position = append(frame.Position, Vector3f{X: float64(tempX[j]), Y: float64(tempY[j]), Z: float64(tempZ[j])}) + } + result.Frames = append(result.Frames, frame) + } + + return &result, nil +} + +func FortranRead(file io.Reader, order binary.ByteOrder, data interface{}) error { + var head int32 + if err := binary.Read(file, order, &head); err != nil { + return err + } + + if err := binary.Read(file, order, data); err != nil { + return err + } + + var tail int32 + if err := binary.Read(file, order, &tail); err != nil { + return err + } + + if head != tail { + return errors.New(fmt.Sprintf("head (%d) does not match tail (%d)", head, tail)) + } + + return nil +} + +func FortranReadString(file io.Reader, order binary.ByteOrder, data *[]byte) error { + var head int32 + if err := binary.Read(file, order, &head); err != nil { + return err + } + + *data = make([]byte, head) + if err := binary.Read(file, order, data); err != nil { + return err + } + + var tail int32 + if err := binary.Read(file, order, &tail); err != nil { + return err + } + + return nil +} + +// Energy Comparison +func isMatchingEnergy(actual, expected string) bool { + energyActual, err := ReadEnergy(actual) + if err != nil { + return true + } + + energyExpected, err := ReadEnergy(expected) + if err != nil { + return true + } + + if len(energyActual.Column) != len(energyExpected.Column) { + vLogger.Printf("Column Count Differs. Should be %d but is %d\n", len(energyActual.Column), len(energyExpected.Column)) + return false + } + + var diffs int + for i := 0; i < len(energyExpected.Column); i++ { + if energyActual.Column[i].Name != energyExpected.Column[i].Name { + vLogger.Printf("Column Name Differs. Should be %s but is %s\n", energyActual.Column[i].Name, energyExpected.Column[i].Name) + return false + } + + if len(energyActual.Column[i].Values) != len(energyExpected.Column[i].Values) { + vLogger.Printf("Column Value Count Differs. Should be %d but is %d\n", len(energyActual.Column[i].Values), len(energyExpected.Column[i].Values)) + return false + } + + for j := 0; j < len(energyExpected.Column[i].Values); j++ { + xExpected := energyExpected.Column[i].Values[j] + xActual := energyActual.Column[i].Values[j] + + if math.Max(float64(xExpected), float64(xActual))-math.Min(float64(xExpected), float64(xActual)) > 0.00001 { + diffs++ + vLogger.Printf("Column Value Differs. Expected: %f, Actual: %f, Difference: %f\n", xExpected, xActual, math.Max(float64(xExpected), float64(xActual))-math.Min(float64(xExpected), float64(xActual))) + } + } + } + + return diffs == 0 +} + +// Energy Parsing +type EnergyFile struct { + Column []EnergyFileColumn +} + +type EnergyFileColumn struct { + Name string + Values []float32 +} + +func ReadEnergy(filename string) (*EnergyFile, error) { + // Parse Headers + sHeader, err := ioutil.ReadFile(fmt.Sprintf("%s.header", filename)) + if err != nil { + return nil, err + } + + var result EnergyFile + + for _, header := range strings.Split(string(sHeader), " ") { + if len(header) == 0 { + continue + } + result.Column = append(result.Column, EnergyFileColumn{Name: header}) + } + + // Parse File + file, err := os.Open(filename) + if err != nil { + return nil, err + } + defer file.Close() + + scanner := bufio.NewScanner(file) + for scanner.Scan() { + columnID := 0 + for _, column := range strings.Split(scanner.Text(), " ") { + if len(column) == 0 { + continue + } + + value, err := strconv.ParseFloat(column, 32) + if err != nil { + return nil, err + } + + result.Column[columnID].Values = append(result.Column[columnID].Values, float32(value)) + columnID++ + } + } + + if err := scanner.Err(); err != nil { + return nil, err + } + + return &result, nil +} + +// Force Comparison +func isMatchingForce(actual, expected string) bool { + aForce, err := ReadForce(actual) + if err != nil { + return true + } + + eForce, err := ReadForce(expected) + if err != nil { + return true + } + + if aForce.FrameCount != eForce.FrameCount { + vLogger.Printf("Frame Count Differs. Should be %d but is %d\n", eForce.FrameCount, aForce.FrameCount) + return false + } + + if aForce.AtomCount != eForce.AtomCount { + vLogger.Printf("Atom Count Differs. Should be %d but is %d\n", eForce.AtomCount, aForce.AtomCount) + return false + } + + diffs := 0 + for frame := 0; frame < eForce.FrameCount; frame++ { + for atom := 0; atom < eForce.AtomCount; atom++ { + xExpected := eForce.Frame[frame].Atom[atom].X + xActual := aForce.Frame[frame].Atom[atom].X + + if math.Max(xExpected, xActual)-math.Min(xExpected, xActual) > 0.00001 { + diffs++ + vLogger.Printf("Frame %d, Atom %d Differs. Expected: %f, Actual: %f, Difference: %f\n", frame, atom, xExpected, xActual, math.Max(xExpected, xActual)-math.Min(xExpected, xActual)) + } + + yExpected := eForce.Frame[frame].Atom[atom].Y + yActual := aForce.Frame[frame].Atom[atom].Y + + if math.Max(yExpected, yActual)-math.Min(yExpected, yActual) > 0.00001 { + diffs++ + vLogger.Printf("Frame %d, Atom %d Differs. Expected: %f, Actual: %f, Difference: %f\n", frame, atom, yExpected, yActual, math.Max(yExpected, yActual)-math.Min(yExpected, yActual)) + } + + zExpected := eForce.Frame[frame].Atom[atom].Z + zActual := aForce.Frame[frame].Atom[atom].Z + + if math.Max(zExpected, zActual)-math.Min(zExpected, zActual) > 0.00001 { + diffs++ + vLogger.Printf("Frame %d, Atom %d Differs. Expected: %f, Actual: %f, Difference: %f\n", frame, atom, zExpected, zActual, math.Max(zExpected, zActual)-math.Min(zExpected, zActual)) + } + } + } + + return diffs == 0 +} + +// Energy Parsing +type ForceFile struct { + FrameCount int + AtomCount int + Frame []ForceFileFrame +} + +type ForceFileFrame struct { + Atom []AtomPosition +} + +func ReadForce(filename string) (*ForceFile, error) { + // Parse File + file, err := os.Open(filename) + if err != nil { + return nil, err + } + defer file.Close() + + r := bufio.NewReader(file) + + // Read Framecount and atomcount + sFrames, err := r.ReadString('\n') + if err != nil { + return nil, err + } + + sAtoms, err := r.ReadString('\n') + if err != nil { + return nil, err + } + + // Convert framecount and atomcount + frameCount, err := strconv.Atoi(sFrames) + if err != nil { + return nil, err + } + + atomCount, err := strconv.Atoi(sAtoms) + if err != nil { + return nil, err + } + + result := ForceFile{FrameCount: frameCount, AtomCount: atomCount} + + // Parse Frames + for frame := 0; frame < result.FrameCount; frame++ { + var frameData ForceFileFrame + for atom := 0; atom < result.AtomCount; atom++ { + sAtom, err := r.ReadString('\n') + if err != nil { + return nil, err + } + + atomValue, err := ParseAtomPosition(sAtom) + if err != nil { + return nil, err + } + + frameData.Atom = append(frameData.Atom, *atomValue) + } + result.Frame = append(result.Frame, frameData) + } + + return &result, nil +} + +// Position Comparison +func isMatchingPosition(actual, expected string) bool { + aPosition, err := ReadPosition(actual) + if err != nil { + return true + } + + ePosition, err := ReadPosition(expected) + if err != nil { + return true + } + + if aPosition.AtomCount != ePosition.AtomCount { + vLogger.Printf("Atom Count Differs. Should be %d but is %d\n", ePosition.AtomCount, aPosition.AtomCount) + return false + } + + diffs := 0 + for atom := 0; atom < ePosition.AtomCount; atom++ { + xExpected := ePosition.Atom[atom].X + xActual := aPosition.Atom[atom].X + + if math.Max(xExpected, xActual)-math.Min(xExpected, xActual) > 0.00001 { + diffs++ + vLogger.Printf("Atom %d Differs. Expected: %f, Actual: %f, Difference: %f\n", atom, xExpected, xActual, math.Max(xExpected, xActual)-math.Min(xExpected, xActual)) + } + + yExpected := ePosition.Atom[atom].Y + yActual := aPosition.Atom[atom].Y + + if math.Max(yExpected, yActual)-math.Min(yExpected, yActual) > 0.00001 { + diffs++ + vLogger.Printf("Atom %d Differs. Expected: %f, Actual: %f, Difference: %f\n", atom, yExpected, yActual, math.Max(yExpected, yActual)-math.Min(yExpected, yActual)) + } + + zExpected := ePosition.Atom[atom].Z + zActual := aPosition.Atom[atom].Z + + if math.Max(zExpected, zActual)-math.Min(zExpected, zActual) > 0.00001 { + diffs++ + vLogger.Printf("Atom %d Differs. Expected: %f, Actual: %f, Difference: %f\n", atom, zExpected, zActual, math.Max(zExpected, zActual)-math.Min(zExpected, zActual)) + } + } + + return diffs == 0 +} + +// Energy Parsing +type PositionFile struct { + AtomCount int + Atom []AtomPosition +} + +func ReadPosition(filename string) (*PositionFile, error) { + // Parse File + file, err := os.Open(filename) + if err != nil { + return nil, err + } + defer file.Close() + + r := bufio.NewReader(file) + + // Read AtomCount and convert + sAtoms, err := r.ReadString('\n') + if err != nil { + return nil, err + } + + atomCount, err := strconv.Atoi(sAtoms) + if err != nil { + return nil, err + } + + result := PositionFile{AtomCount: atomCount} + + // Parse Frames + for atom := 0; atom < result.AtomCount; atom++ { + sAtom, err := r.ReadString('\n') + if err != nil { + return nil, err + } + + atomValue, err := ParseAtomPosition(sAtom) + if err != nil { + return nil, err + } + + result.Atom = append(result.Atom, *atomValue) + } + + return &result, nil +} + +// Velocity Comparison +func isMatchingVelocity(actual, expected string) bool { + aPosition, err := ReadPosition(actual) + if err != nil { + return true + } + + ePosition, err := ReadPosition(expected) + if err != nil { + return true + } + + if aPosition.AtomCount != ePosition.AtomCount { + vLogger.Printf("Atom Count Differs. Should be %d but is %d\n", ePosition.AtomCount, aPosition.AtomCount) + return false + } + + diffs := 0 + for atom := 0; atom < ePosition.AtomCount; atom++ { + xExpected := ePosition.Atom[atom].X + xActual := aPosition.Atom[atom].X + + if math.Max(xExpected, xActual)-math.Min(xExpected, xActual) > 0.00001 { + diffs++ + vLogger.Printf("Atom %d Differs. Expected: %f, Actual: %f, Difference: %f\n", atom, xExpected, xActual, math.Max(xExpected, xActual)-math.Min(xExpected, xActual)) + } + + yExpected := ePosition.Atom[atom].Y + yActual := aPosition.Atom[atom].Y + + if math.Max(yExpected, yActual)-math.Min(yExpected, yActual) > 0.00001 { + diffs++ + vLogger.Printf("Atom %d Differs. Expected: %f, Actual: %f, Difference: %f\n", atom, yExpected, yActual, math.Max(yExpected, yActual)-math.Min(yExpected, yActual)) + } + + zExpected := ePosition.Atom[atom].Z + zActual := aPosition.Atom[atom].Z + + if math.Max(zExpected, zActual)-math.Min(zExpected, zActual) > 0.00001 { + diffs++ + vLogger.Printf("Atom %d Differs. Expected: %f, Actual: %f, Difference: %f\n", atom, zExpected, zActual, math.Max(zExpected, zActual)-math.Min(zExpected, zActual)) + } + } + + return diffs == 0 +} diff --git a/test/test.py b/test/test.py index cc053f2..9f74018 100755 --- a/test/test.py +++ b/test/test.py @@ -66,8 +66,9 @@ def run_test(protomol_path, conf_file, pwd, parallel): cmd.append(protomol_path) cmd.append(conf_file) - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (stdout, stderr) = p.communicate() + DEVNULL = open(os.devnull, 'w') + p = subprocess.Popen(cmd, stdout=None, stderr=None) + p.communicate() if p.returncode > 0: s = 'Not able to execute Protomol!\n' s += 'cmd: ' + str(cmd) + '\n' diff --git a/test/tests/expected/penta-alanine_MetropolisEnergyNumeric.dcd b/test/tests/expected/penta-alanine_MetropolisEnergyNumeric.dcd new file mode 100644 index 0000000..f25cd24 Binary files /dev/null and b/test/tests/expected/penta-alanine_MetropolisEnergyNumeric.dcd differ diff --git a/test/tests/expected/penta-alanine_MetropolisEnergyNumeric.forces b/test/tests/expected/penta-alanine_MetropolisEnergyNumeric.forces new file mode 100644 index 0000000..66efbbd --- /dev/null +++ b/test/tests/expected/penta-alanine_MetropolisEnergyNumeric.forces @@ -0,0 +1,127 @@ +2 +62 +H0 3.15230623601557 5.44571326909291 -1.86685785150535 +C1 -32.6319529576036 -57.8414574663356 -24.6191214338873 +H0 6.77635528043883 5.47880925171481 8.01560692264925 +H0 -2.3376372370761 10.2010601433431 9.8407266923893 +C2 22.6642115716086 43.9093162088289 7.63267635774526 +O3 -10.5788633908891 -11.840696649291 -7.53671702861596 +N4 -13.8602375354943 29.3390360941246 19.047965870466 +H5 27.3656003775853 -4.82551207524639 2.95801549010824 +C1 -40.0159956513747 3.55345284918127 -6.31630286029603 +H6 42.6380377239972 -15.1326207321682 -20.0971319735282 +C1 -40.2007789223209 14.2216334804429 37.6334969726868 +H0 16.7520253618845 1.32257853850112 -10.2570764055697 +H0 17.4528553337576 0.733234608035492 1.01240073689588 +H0 0.106513594835634 -26.3292613208788 -29.9900494786517 +C2 -18.3161300240232 27.4655941889716 27.9928667854291 +O3 10.6894409075436 -16.4519890324362 -21.8273933712737 +N4 26.9422536685019 -18.878983037669 14.5654521252739 +H5 1.44823907147024 14.5853856833642 -31.345973458587 +C1 -23.9358386066373 -11.7895580780039 21.9838538023015 +H6 -12.3768278827519 -3.63985472221654 13.0082239340067 +C1 58.3917178408273 20.8075905525808 -27.3747525756201 +H0 -29.7130765421653 16.6729196233742 39.5573381372629 +H0 -1.54346252011297 -6.76681072881675 -0.173833108226618 +H0 -14.4681438997876 -25.334156506228 -10.1685403074245 +C2 11.3942705566289 -30.3522903261591 -66.4248625041747 +O3 5.24026229828992 17.9252617512043 24.4104908851335 +N4 -24.9413765653693 5.7254124418846 36.4764899510422 +H5 15.3364008812014 18.6201436681706 9.79307795675619 +C1 -8.412772605215 -15.7588087965002 -66.1715809710147 +H6 -24.2627805165215 27.9702454561988 19.1547509504795 +C1 37.2168881658741 46.9580967586748 53.4445367465105 +H0 29.0988226777294 -30.296603332427 -35.2464587274263 +H0 -22.9185763713715 -24.7235820833873 -10.6527122277646 +H0 -12.8967488498225 -2.0769022637148 -7.89387690822582 +C2 -10.8315312975593 16.1547665174559 23.8952562227692 +O3 -6.60657559102912 -36.5946122307822 -7.25122848750204 +N4 20.741220243688 23.6641775002076 48.1522927749501 +H5 -3.48159469323168 -18.1892362758611 -22.8480947149036 +C1 -17.9345575921139 13.2319817575208 0.421812287741722 +H6 -1.93730962616573 -4.21924719735397 -15.2936830369909 +C1 -9.34187086719245 4.66557821921667 -2.26087182258262 +H0 8.06401327785871 -8.3551911737203 1.72729457734301 +H0 3.47951943062437 -4.41739641002654 0.31370074503813 +H0 0.054169538734337 1.15940713843221 -2.50766733705557 +C2 12.6333684578437 -21.4330602377093 37.4527022652636 +O3 -17.1008836075268 5.55924148931962 -13.8924664100559 +N4 27.2065444630405 28.6619644250254 -31.5861531392218 +H5 -16.8965190184622 -10.2522308703817 14.7603376120103 +C1 -10.9095244559987 12.8005491522093 28.2007591077029 +H6 11.9393590436347 -15.0587480620545 4.60125502161103 +C1 -11.4259442733489 4.31036645099203 -37.9016071450721 +H0 5.77023645792767 4.93159863849221 9.80709112827587 +H0 13.4595880736121 5.72005253785644 -4.87010765603751 +H0 -0.0576300184905498 -15.0918954076306 -6.60350292843953 +C2 31.9373619465245 12.8428602843067 29.6914284755622 +O3 -22.761556171696 -0.537105626963147 -7.34705953236528 +N4 -9.83435004734298 6.40842517455529 -29.7845772391581 +H5 4.64110187700489 22.4279982802731 24.4152293765602 +C1 53.5778950616546 -52.5726861658589 -15.0405766534582 +H6 -14.432439376393 12.0428638999887 -5.86639255217758 +H6 -2.35155804741307 5.86122827080606 3.88634689250771 +H6 -36.8555346578369 -2.61804749452628 7.16375304234026 +62 +H0 -0.0100171633825181 0.00695963037903194 0.00518395455904536 +C1 -0.044631627121575 0.153233550183045 0.0946146242139761 +H0 -0.00385941294518236 0.0240167974421839 0.00383520404071272 +H0 -0.00613523983949403 0.0106623991540667 0.00713567402472288 +C2 0.109771487195494 0.122606557111457 0.224296582264546 +O3 0.255530857383083 0.275939652931779 0.390952369430084 +N4 0.163368549345962 -0.00621100126579326 0.267691478811949 +H5 0.0069627039930776 -0.00429292580595382 0.0167693549522534 +C1 0.232364322929374 -0.0139149009341849 0.166929118402384 +H6 0.0278264736114923 -0.00204479684270468 0.0264640265968487 +C1 0.423104519374535 -0.00070816651306377 -0.095042148069209 +H0 0.0533565964473687 -0.00828169526575508 -0.00774957482996646 +H0 0.0282954669939977 0.0116073050348532 -0.0272330687345157 +H0 0.0355531663619357 -0.000554992760574737 -0.00689309678709017 +C2 -0.0627077261740121 -0.00182469953452895 0.130243360453717 +O3 -0.699393195571769 -0.00813321683023993 -0.0247245406447232 +N4 0.0773555971910643 0.00724368007803822 0.258965179749885 +H5 0.0199497599689086 0.00110493873549366 0.0212492570954698 +C1 -0.250318693936973 0.0402215313458888 0.125895220111258 +H6 -0.0306519735330847 0.00905817204091652 0.00195011152987526 +C1 -0.446245650973023 -0.118448152428422 0.438098713510498 +H0 -0.0214386384989124 -0.0243056793792284 0.0529999522010783 +H0 -0.0636471469616717 -0.0031457394571682 0.0349000779891522 +H0 -0.0440109897001931 -0.0164091025158844 0.0527210389749837 +C2 -0.274590469896652 0.159342362668788 -0.0280650735831742 +O3 -0.587873212147226 0.644518125278411 -0.161668859054516 +N4 -0.205351303848469 -0.0327639838244495 -0.0408474271582133 +H5 -0.00569963831164303 -0.0132095331598873 0.000523934677065598 +C1 -0.0222030044435101 -0.0989734039062081 -0.0958211999356479 +H6 -0.000439017814013477 0.00281724604483647 -0.0146678127715061 +C1 -0.113899885641237 -0.203970862208959 0.0454065990490439 +H0 0.00105285720081303 -0.00523430442331249 0.00473826678545543 +H0 -0.0126949306658016 -0.0191506174220597 0.0182118170755264 +H0 -0.0188991543324918 -0.0271913929277649 -0.00262222050693822 +C2 0.159426928528759 -0.119995508376208 -0.0960284787786781 +O3 0.296042419303231 -0.0903448425983742 -0.174185351920768 +N4 0.246592564917754 -0.173347532164061 -0.00902203076059683 +H5 0.0166748105076136 -0.0183227013238503 0.00189720410855122 +C1 0.0734146886214525 0.033088440424745 0.0932497566355283 +H6 -0.0223400808744927 0.0205784700069544 -0.00453675983727168 +C1 0.213369948274823 0.238104918327925 0.625493389976629 +H0 0.0532539808127537 0.013546708797336 0.0589529426950358 +H0 -0.00247582803209645 0.0263017713263708 0.0542175118324999 +H0 0.0108126699872614 0.0341197735527096 0.0768573598645955 +C2 0.201072693595145 -0.214408031106294 -0.120787972380815 +O3 0.435385200470955 -0.42437640591172 -0.281598379775348 +N4 0.121288089116542 -0.239405583819691 -0.197123181671878 +H5 0.0019385773309698 -0.011689568916038 -0.00979451075916411 +C1 0.0761242630904185 -0.0792052147317282 -0.226463535982492 +H6 0.0142439074583046 -0.00115164976055607 -0.0161457001919585 +C1 0.0322248965379484 -0.103240961997521 -0.246256251917679 +H0 0.00883497644474081 -0.00506924063800727 -0.0175965458524643 +H0 0.00224578516160392 -0.0182141241446933 -0.0254565902159587 +H0 -0.00694036594001141 -0.0041165864315258 -0.0203183653120857 +C2 -0.0339094535127374 0.000928914823035964 -0.276855526156306 +O3 -0.146747193464374 -0.0236034346396733 -0.481085456323324 +N4 -0.0652422542104612 0.0978061601759224 -0.253904071811672 +H5 -0.000264592540165909 0.00851234670812778 -0.0154924329282103 +C1 -0.151664341433046 0.148821901488176 -0.252124407097685 +H6 -0.00451159093778037 0.0091404073162847 -0.0399483768117611 +H6 -0.0282479269421508 0.0251614411681612 -0.021738164955124 +H6 -0.0104097497305042 0.00983047622625376 -0.00865929978465617 diff --git a/test/tests/expected/penta-alanine_MetropolisEnergyNumeric.pos b/test/tests/expected/penta-alanine_MetropolisEnergyNumeric.pos new file mode 100644 index 0000000..6e1c5c1 --- /dev/null +++ b/test/tests/expected/penta-alanine_MetropolisEnergyNumeric.pos @@ -0,0 +1,63 @@ +62 +H0 8.51917900630655 -46.9979513610429 27.9304406982306 +C1 8.56501807552504 -46.5671295041995 26.9248047517541 +H0 7.60066359800211 -46.75325563757 26.4193206778334 +H0 9.30035145763951 -47.1146800875141 26.3019422355015 +C2 8.82035383934384 -45.1400489282084 26.9518649497325 +O3 7.95312733731121 -44.2668252364039 26.8800951720814 +N4 10.0906351131437 -44.8547361770892 27.1859343618481 +H5 10.6089797594884 -45.6616159299593 27.4259344338632 +C1 10.5040268277659 -43.4677513640886 27.5978007634107 +H6 9.61863249533235 -43.0370327015548 28.2188417127559 +C1 11.7755217511805 -43.5254397827157 28.4716350954628 +H0 11.4571432546515 -44.1833351181564 29.309943885139 +H0 12.5556398254398 -43.9705923868659 27.882695172207 +H0 11.9949139376227 -42.5367171931715 29.0055762308779 +C2 10.658459434897 -42.5642998830011 26.3323830230517 +O3 10.9490442424587 -42.9937089508386 25.2336084481591 +N4 10.4336221552838 -41.2493681546323 26.5324386179587 +H5 10.2719750287313 -41.0375831885307 27.5417750243817 +C1 10.8457553124665 -40.1863282990573 25.5494637605839 +H6 11.38568663906 -40.5768160978023 24.655560300492 +C1 9.52682606526866 -39.504557997693 25.1014554452132 +H0 9.10970624076928 -39.0898095670046 25.9310251168314 +H0 9.77603278146745 -38.6502953359284 24.4538607679067 +H0 8.84085343600752 -40.1092865242068 24.5876887410688 +C2 11.7821543915056 -39.1684736512684 26.2446856153431 +O3 11.6608424842353 -38.9135736899725 27.4237773784261 +N4 12.7042954340251 -38.6870359102232 25.3647062076406 +H5 12.6126907869431 -39.0561864934491 24.4053842488661 +C1 13.4142188519675 -37.4251953157484 25.6898725022088 +H6 12.8669273269891 -36.9453439239048 26.424264175867 +C1 14.7173444340476 -37.700187503964 26.3572020630757 +H0 15.342388028751 -38.1884974675526 25.7301738398755 +H0 15.2715338508294 -36.7391514883263 26.6255661809661 +H0 14.6653076951211 -38.2506501190423 27.3063769304565 +C2 13.5423301461707 -36.5042468111686 24.3977039686133 +O3 13.1151802616465 -36.7768683222629 23.2871534044856 +N4 14.0092798901354 -35.2729880952441 24.5495493750496 +H5 14.2093621558406 -34.9050142189185 25.5064352396139 +C1 14.3244333268268 -34.3351099564745 23.4738919517312 +H6 14.30503506479 -34.8743868667339 22.5473845414161 +C1 13.2285025697155 -33.2427875228169 23.435177546977 +H0 13.2788060637505 -32.5086729491743 24.252892434092 +H0 13.2626446979194 -32.6762995124486 22.4983602286548 +H0 12.2503882566813 -33.7283489302274 23.4998232480892 +C2 15.7320729579595 -33.7741599119585 23.581936305959 +O3 16.4018054759459 -33.9508998877047 24.6320089914865 +N4 16.2784983323511 -33.2465162046089 22.5078316929245 +H5 15.8281767147865 -33.0647560356752 21.6098343876367 +C1 17.6933701369151 -32.8921217442254 22.5194042532234 +H6 18.2125813967602 -33.75804979936 22.8582243248031 +C1 18.1886426009285 -32.5848364269073 21.1614482931359 +H0 17.8061966474059 -31.6416669907679 20.7618696653443 +H0 19.2580083079727 -32.6609094831688 21.1568020704581 +H0 17.7977643712969 -33.303035385739 20.4702740546195 +C2 18.0764952275129 -31.7430558448492 23.4739001684311 +O3 17.282242429183 -30.9660094845618 23.9999958231018 +N4 19.394325761014 -31.5865003635547 23.7503063365106 +H5 19.9738526282968 -32.2329388801795 23.1750942844881 +C1 19.9479249940464 -30.3443336907962 24.4230869617928 +H6 19.5748877367496 -29.4311378759173 24.012480376616 +H6 19.7653739981178 -30.4266238813003 25.4925995848936 +H6 21.0829077890461 -30.3105424447606 24.2589590523586 diff --git a/test/tests/expected/penta-alanine_MetropolisEnergyNumeric.vel b/test/tests/expected/penta-alanine_MetropolisEnergyNumeric.vel new file mode 100644 index 0000000..6215a08 --- /dev/null +++ b/test/tests/expected/penta-alanine_MetropolisEnergyNumeric.vel @@ -0,0 +1,63 @@ +62 +H0 -0.0472691519805796 0.0896062633615641 0.0858185917099604 +C1 -0.0277175359598375 0.100513847466764 0.0912282061213927 +H0 -0.0310374196666943 0.13940384699462 0.0825616966560074 +H0 -0.0418180449978861 0.0829641226423361 0.0905257951933675 +C2 0.0256314884495978 0.0902445172922096 0.112629919570377 +O3 0.0529874375623766 0.118411323534437 0.135201484332887 +N4 0.0378025719327773 0.0478765594956022 0.102575725724912 +H5 0.0201302506843804 0.0306794325266252 0.0828591371643806 +C1 0.0706001932097169 0.0385719670792249 0.101049368224879 +H6 0.0949142712671684 0.0376390281890478 0.136197604579278 +C1 0.109864786954658 0.0249246123405991 0.0451918149860362 +H0 0.148150661165578 0.00314620718317708 0.0423268333207704 +H0 0.0869037395894447 0.0492418299038077 -0.0059180002930647 +H0 0.118604251451091 0.0188821609305642 0.0528523067714499 +C2 0.0140120274307257 0.0525317435775453 0.102458056479104 +O3 -0.0878507574545627 0.0607850678607612 0.066220227262907 +N4 0.0486605779070056 0.0536799010679077 0.135322611513934 +H5 0.0882484027149742 0.0480088287440095 0.144045200346665 +C1 -0.0176197348635123 0.0676245301993432 0.123239267754224 +H6 -0.0400633318471083 0.087640390078276 0.100128799636858 +C1 -0.0587572056073729 0.0364198394580111 0.191684749525849 +H0 -0.0152766916026023 0.000257613288148084 0.234263329895601 +H0 -0.12416006330463 0.0539750466352529 0.187796676716086 +H0 -0.0778438017203218 0.0218695170679709 0.233197175028708 +C2 -0.0256466838820187 0.0905185395356891 0.0984900025514995 +O3 -0.0559001024608992 0.145113832654273 0.0825562280499653 +N4 -0.0123325862541775 0.0632769950582947 0.0966930599555819 +H5 0.00395739635171568 0.0404154300961698 0.104253779650259 +C1 0.00312655335145803 0.0583973039754193 0.0825916720971057 +H6 0.00482593034711873 0.0756774096064706 0.0719096939405916 +C1 -0.00634104492360807 0.0524157063164409 0.0994315956913934 +H0 0.00964805113274966 0.0670381854808843 0.103358956098889 +H0 -0.0123735734348384 0.0517788884223685 0.114973242671972 +H0 -0.018146243012075 0.0421178025110462 0.0926161799653113 +C2 0.0170050773997819 0.0501556997599042 0.0783318291234966 +O3 0.00762267013437112 0.0539493474654167 0.0812583932770348 +N4 0.0285507896018114 0.0462608775838867 0.0780707260983721 +H5 0.0389708033148506 0.0411207573762609 0.0780220153460959 +C1 -0.0263572429056535 0.0741214001923401 0.0825031021012177 +H6 -0.0960655294908963 0.102497802469627 0.0621393648856768 +C1 -0.0167735416031446 0.0955352710042219 0.18455045018527 +H0 0.0663640153626172 0.093032373222373 0.188208620100567 +H0 -0.0845359123930741 0.0966239639769814 0.178699603209197 +H0 -0.0262247650857641 0.114965387544453 0.262528594182006 +C2 -0.00799305475743729 0.049023124396494 0.0131519611539795 +O3 0.0295775609931133 0.0605872164666238 -0.00742470502126935 +N4 -0.0441660251716344 0.0250070877744099 -0.0181030450649148 +H5 -0.0746596751887609 0.0225239211901433 -0.00395356219114665 +C1 -0.0469734513681479 0.0406683837447593 -0.0628576409902856 +H6 -0.0277234790867087 0.0535092138267851 -0.0576359845454519 +C1 -0.0837032820436421 0.0154500116297923 -0.0810988365599234 +H0 -0.087362778377799 0.011537498320777 -0.0867034337441725 +H0 -0.0838691764015849 0.00687509700572363 -0.110245238212332 +H0 -0.109189325784111 0.00548637080260415 -0.0576727528709415 +C2 -0.0416661949510409 0.0629883806991361 -0.0924108337579321 +O3 -0.0333126369080184 0.111820055932904 -0.156287279445574 +N4 -0.0487366296157399 0.0263151647170359 -0.0479810134738466 +H5 -0.0470897560909407 0.00046881334556824 -0.0160681023774778 +C1 -0.0336872750496131 0.00652255115645908 -0.0241635509486395 +H6 -0.0571143308647628 0.0183795614355961 0.0353748873385495 +H6 0.00421557522328445 -0.0395173554061172 -0.0245415744215612 +H6 -0.0392173927068545 0.0198199882230754 -0.0525415436070148 diff --git a/test/tests/penta-alanine_MetropolisEnergyNumeric.conf b/test/tests/penta-alanine_MetropolisEnergyNumeric.conf new file mode 100644 index 0000000..733d944 --- /dev/null +++ b/test/tests/penta-alanine_MetropolisEnergyNumeric.conf @@ -0,0 +1,125 @@ +firststep 0 +numsteps 20 +outputfreq 20 + +#set random type so works on Windows +randomtype 1 + +# Constraints +boundaryConditions Vacuum +cellManager Cubic +cellsize 5 +firststep 0 +removeAngularMomentum 0 +removeLinearMomentum 0 + +seed 1234 + +# Inputs +gromacstprfile data/ala5-extended.tpr +temperature 300 +temperature 300 + +# Outputs +dcdfile output/penta-alanine_MetropolisEnergyNumeric.dcd +XYZForceFile output/penta-alanine_MetropolisEnergyNumeric.forces +finXYZPosFile output/penta-alanine_MetropolisEnergyNumeric.pos +finXYZVelFile output/penta-alanine_MetropolisEnergyNumeric.vel + +Integrator { + level 2 NormalModeDiagonalize { + cyclelength 1 + rediagFrequency 10 + fullDiag false + postDiagonalizeMinimize false + numericHessians true + blockVectorCols 16 + residuesPerBlock 1 + + geometricfdof true + force Angle + force Bond + force Dihedral + force RBDihedral + + force LennardJones Coulomb + -algorithm NonbondedSimpleFull + + force GBBornRadii + -algorithm NonbondedSimpleFull + + force GBPartialSum + -algorithm NonbondedSimpleFull + + force GBForce + -algorithm NonbondedSimpleFull + -solutedielec 1.0 + -solventdielec 78.3 + + force GBACEForce + -algorithm NonbondedSimpleFull + } + + level 1 NormalModeLangevinLeapfrog { + cyclelength 1 + firstmode 1 + numbermodes 12 + + seed 13649 + temperature 300 + gamma 91 + + force Angle + force Bond + force Dihedral + force RBDihedral + + force LennardJones Coulomb + -algorithm NonbondedSimpleFull + + force GBBornRadii + -algorithm NonbondedSimpleFull + + force GBPartialSum + -algorithm NonbondedSimpleFull + + force GBForce + -algorithm NonbondedSimpleFull + -solutedielec 1.0 + -solventdielec 78.3 + + force GBACEForce + -algorithm NonbondedSimpleFull + } + + level 0 NormalModeMinimizer { + timestep 5 + seed 13649 + temperature 300 + randforce 0 + metropolis true + metropolisnoise 0 + + force Angle + force Bond + force Dihedral + force RBDihedral + + force LennardJones Coulomb + -algorithm NonbondedSimpleFull + + force GBBornRadii + -algorithm NonbondedSimpleFull + + force GBPartialSum + -algorithm NonbondedSimpleFull + + force GBForce + -algorithm NonbondedSimpleFull + -solutedielec 1.0 + -solventdielec 78.3 + + force GBACEForce + -algorithm NonbondedSimpleFull + } +}