本文整理汇总了Golang中github.com/rmera/gochem/v3.Matrix.AddVec方法的典型用法代码示例。如果您正苦于以下问题:Golang Matrix.AddVec方法的具体用法?Golang Matrix.AddVec怎么用?Golang Matrix.AddVec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/rmera/gochem/v3.Matrix
的用法示例。
在下文中一共展示了Matrix.AddVec方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Super
//Super determines the best rotation and translations to superimpose the coords in test
//listed in testlst on te atoms of molecule templa, frame frametempla, listed in templalst.
//It applies those rotation and translations to the whole frame frametest of molecule test, in palce.
//testlst and templalst must have the same number of elements. If any of the two slices, or both, are
//nil or have a zero lenght, they will be replaced by a list containing the number of all atoms in the
//corresponding molecule.
func Super(test, templa *v3.Matrix, testlst, templalst []int) (*v3.Matrix, error) {
//_, testcols := test.Dims()
//_, templacols := templa.Dims()
structs := []*v3.Matrix{test, templa}
lists := [][]int{testlst, templalst}
//In case one or both lists are nil or have lenght zero.
for k, v := range lists {
if v == nil || len(v) == 0 {
lists[k] = make([]int, structs[k].NVecs(), structs[k].NVecs())
for k2, _ := range lists[k] {
lists[k][k2] = k2
}
}
}
//fmt.Println(lists[0])
if len(lists[0]) != len(lists[1]) {
return nil, CError{fmt.Sprintf("Mismatched template and test atom numbers: %d, %d", len(lists[1]), len(lists[0])), []string{"Super"}}
}
ctest := v3.Zeros(len(lists[0]))
ctest.SomeVecs(test, lists[0])
ctempla := v3.Zeros(len(lists[1]))
ctempla.SomeVecs(templa, lists[1])
_, rotation, trans1, trans2, err1 := RotatorTranslatorToSuper(ctest, ctempla)
if err1 != nil {
return nil, errDecorate(err1, "Super")
}
test.AddVec(test, trans1)
// fmt.Println("test1",test, rotation) /////////////77
test.Mul(test, rotation)
// fmt.Println("test2",test) ///////////
test.AddVec(test, trans2)
// fmt.Println("test3",test) ///////
return test, nil
}